package cn.com.goldenwater.dcproj.controller; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.AttGnrlBase; import cn.com.goldenwater.dcproj.service.AttGnrlBaseService; import cn.com.goldenwater.dcproj.vo.JxEcharTotal; import cn.com.goldenwater.dcproj.vo.JxMapVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; /** * @author * @date 2021-12-6 */ @Api(value = "通用督查检查管理", tags = "通用督查检查管理") @RestController @RequestMapping("/att/gnrl/base") public class AttGnrlBaseController extends BaseController { @Autowired private AttGnrlBaseService attGnrlBaseService; @ApiOperation(value = "新增/修改通用督查检查") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "attGnrlBase", value = "AttGnrlBase", required = true) @RequestBody AttGnrlBase attGnrlBase) { int ret = 0; if (StringUtils.isBlank(attGnrlBase.getId())) { ret = attGnrlBaseService.insert(attGnrlBase); } else { ret = attGnrlBaseService.update(attGnrlBase); } return buildSuccessResponse(attGnrlBase); } @ApiOperation(value = "根据ID删除通用督查检查") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = attGnrlBaseService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取通用督查检查(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { AttGnrlBase attGnrlBase = attGnrlBaseService.get(id); return buildSuccessResponse(attGnrlBase); } @ApiOperation(value = "按问题分类,问题数量统计echars") @PostMapping("/echarsTotal") public BaseResponse> echarsTotal(@RequestBody Map map){ List ptype = attGnrlBaseService.getzichaEcharsTotal(map.get("ptype")); return buildSuccessResponse(ptype); } @ApiOperation(value = "按问题分类,问题数量统计echars") @PostMapping("/echarsDesc") public BaseResponse> echarsDesc(@RequestBody Map map){ List jxMapVos = attGnrlBaseService.getzichaEcharsDesc(map.get("adCode"), map.get("ptype")); return buildSuccessResponse(jxMapVos); } }