| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- package cn.com.goldenwater.dcproj.controller.cdep;
- import cn.com.goldenwater.dcproj.model.BisInspCdepQua;
- import cn.com.goldenwater.dcproj.param.BisInspCdepQuaParam;
- import cn.com.goldenwater.dcproj.service.BisInspCdepQuaService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- 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.util.Assert;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * @author zhangcheng
- * @date 2020-11-19
- */
- @Api(value = "资质复核管理",tags="资质复核管理")
- @RestController
- @RequestMapping("/bis/insp/cdep/qua")
- public class BisInspCdepQuaController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspCdepQuaService bisInspCdepQuaService;
- @ApiOperation(value = "添加或修改资质复核表(新疆)")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspCdepQua> insert(@ApiParam(name = "bisInspCdepQua", value = "BisInspCdepQua", required = true) @RequestBody BisInspCdepQua bisInspCdepQua) {
- if (StringUtils.isBlank(bisInspCdepQua.getRgstrId())){
- return buildFailResponse();
- }
- // 根据有无主键,来新增、更新信息
- int ret = 0;
- if(StringUtils.isBlank(bisInspCdepQua.getId())){
- BisInspCdepQuaParam param = new BisInspCdepQuaParam();
- param.setRgstrId(bisInspCdepQua.getRgstrId());
- BisInspCdepQua cap = bisInspCdepQuaService.getBy(param);
- if (null == cap){
- ret = bisInspCdepQuaService.insert(bisInspCdepQua);
- } else {
- bisInspCdepQua.setId(cap.getId());
- ret = bisInspCdepQuaService.update(bisInspCdepQua);
- }
- } else {
- ret = bisInspCdepQuaService.update(bisInspCdepQua);
- }
- return buildSuccessResponse(bisInspCdepQua);
- }
- @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 = bisInspCdepQuaService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "更新xxx信息")
- @RequestMapping(value = "/update", method = RequestMethod.POST)
- public BaseResponse<BisInspCdepQua> update(@ApiParam(name = "bisInspCdepQua", value = "BisInspCdepQua", required = true) @RequestBody BisInspCdepQua bisInspCdepQua) {
- Assert.notNull(bisInspCdepQua.getId(), "主键id为必填参数");
- int ret = bisInspCdepQuaService.update(bisInspCdepQua);
- return buildSuccessResponse(bisInspCdepQua);
- }
- @ApiOperation(value = "根据ID获取资质复核表(新疆)(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspCdepQua> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- //需要在mapper文件中,重写下面的get方法
- BisInspCdepQua bisInspCdepQua = bisInspCdepQuaService.get(id);
- if (null == bisInspCdepQua) {
- bisInspCdepQua = new BisInspCdepQua();
- bisInspCdepQua.setRgstrId(id);
- bisInspCdepQuaService.insert(bisInspCdepQua);
- }
- return buildSuccessResponse(bisInspCdepQua);
- }
- }
|