package cn.com.goldenwater.dcproj.controller.wtgt; import cn.com.goldenwater.dcproj.model.AttWtgtBase; import cn.com.goldenwater.dcproj.service.AttWtgtBaseService; 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.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; 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 lhc * @date 2020-9-18 */ @Api(value = "取水许可管理基本信息管理",tags="取水许可管理基本信息管理") @RestController @RequestMapping("/att/wtgt/base") public class AttWtgtBaseController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private AttWtgtBaseService attWtgtBaseService; @ApiOperation(value = "添加或修改取水许可管理基本信息") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "attWtgtBase", value = "AttWtgtBase", required = true) @RequestBody AttWtgtBase attWtgtBase) { // 根据有无主键,来新增、更新信息 int ret = 0; if(StringUtils.isBlank(attWtgtBase.getId())){ ret = attWtgtBaseService.insert(attWtgtBase); } else { ret = attWtgtBaseService.update(attWtgtBase); } return buildSuccessResponse(attWtgtBase); } @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 = attWtgtBaseService.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) { AttWtgtBase attWtgtBase = attWtgtBaseService.get(id); return buildSuccessResponse(attWtgtBase); } @ApiOperation(value = "根据 objId 获取取水许可管理基本信息(单表)") @RequestMapping(value = "/getObjId/{objId}", method = RequestMethod.GET) public BaseResponse getObjId(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId) { AttWtgtBase attWtgtBase = attWtgtBaseService.getObjId(objId); return buildSuccessResponse(attWtgtBase); } }