package cn.com.goldenwater.dcproj.controller.chmcls; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.BisInspChmclsUseunitwk; import cn.com.goldenwater.dcproj.param.BisInspChmclsUseunitwkParam; import cn.com.goldenwater.dcproj.service.BisInspChmclsUseunitwkService; import cn.com.goldenwater.dcproj.utils.Builder; import cn.com.goldenwater.target.CheckException; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author lhc * @date 2021-5-13 */ @Api(value = "xxx管理", tags = "xxx管理") @RestController @RequestMapping("/bis/insp/chmcls/useunitwk") public class BisInspChmclsUseunitwkController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspChmclsUseunitwkService bisInspChmclsUseunitwkService; @ApiOperation(value = "修改xxx") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspChmclsUseunitwk", value = "BisInspChmclsUseunitwk", required = true) @RequestBody BisInspChmclsUseunitwk bisInspChmclsUseunitwk) { int ret = 0; bisInspChmclsUseunitwk.setPersId(getCurrentPersId()); if (StringUtils.isBlank(bisInspChmclsUseunitwk.getId())) { ret = bisInspChmclsUseunitwkService.insert(bisInspChmclsUseunitwk); } else { ret = bisInspChmclsUseunitwkService.update(bisInspChmclsUseunitwk); } return buildSuccessResponse(bisInspChmclsUseunitwk); } @ApiOperation(value = "根据ID删除xxx") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = bisInspChmclsUseunitwkService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取xxx(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspChmclsUseunitwk bisInspChmclsUseunitwk = bisInspChmclsUseunitwkService.get(id); return buildSuccessResponse(bisInspChmclsUseunitwk); } @ApiOperation(value = "列表--分页") @RequestMapping(value = "/findPage", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "bisInspChmclsUseunitwkParam", value = "bisInspChmclsUseunitwkParam", required = true) @RequestBody BisInspChmclsUseunitwkParam bisInspChmclsUseunitwkParam) { if (StringUtils.isBlank(bisInspChmclsUseunitwkParam.getRgstrId())) { throw new CheckException("登记表ID为必填项!"); } return buildSuccessResponse(bisInspChmclsUseunitwkService.findPageInfo(bisInspChmclsUseunitwkParam)); } @ApiOperation(value = "列表--分页") @RequestMapping(value = "/list/{rgstId}", method = RequestMethod.GET) public BaseResponse> list(@PathVariable String rgstId) { return buildSuccessResponse(bisInspChmclsUseunitwkService.findList(Builder .of(BisInspChmclsUseunitwkParam::new) .with(BisInspChmclsUseunitwkParam::setRgstrId, rgstId) .build())); } }