package cn.com.goldenwater.dcproj.controller.mfdpqh; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.BisInspMfdpqhCity; import cn.com.goldenwater.dcproj.param.BisInspMfdpqhCityParam; import cn.com.goldenwater.dcproj.service.BisInspMfdpqhCityService; 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-6-15 */ @Api(value = "094青海山洪灾害防御-市县管理", tags = "094青海山洪灾害防御-市县管理") @RestController @RequestMapping("/bis/insp/mfdpqh/city") public class BisInspMfdpqhCityController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspMfdpqhCityService bisInspMfdpqhCityService; @ApiOperation(value = "修改094青海山洪灾害防御-市县") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspMfdpqhCity", value = "BisInspMfdpqhCity", required = true) @RequestBody BisInspMfdpqhCity bisInspMfdpqhCity) { bisInspMfdpqhCity.setPersId(getCurrentPersId()); int ret = 0; if (StringUtils.isBlank(bisInspMfdpqhCity.getId())) { ret = bisInspMfdpqhCityService.insert(bisInspMfdpqhCity); } else { ret = bisInspMfdpqhCityService.update(bisInspMfdpqhCity); } return buildSuccessResponse(bisInspMfdpqhCity); } @ApiOperation(value = "根据ID删除094青海山洪灾害防御-市县") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = bisInspMfdpqhCityService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取094青海山洪灾害防御-市县(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspMfdpqhCity bisInspMfdpqhCity = bisInspMfdpqhCityService.get(id); return buildSuccessResponse(bisInspMfdpqhCity); } @ApiOperation(value = "列表--分页") @RequestMapping(value = "/findPage", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "bisInspChmclsUseunitwkParam", value = "bisInspChmclsUseunitwkParam", required = true) @RequestBody BisInspMfdpqhCityParam bisInspMfdpqhCityParam) { if (StringUtils.isBlank(bisInspMfdpqhCityParam.getRgstrId())) { throw new CheckException("登记表ID为必填项!"); } return buildSuccessResponse(bisInspMfdpqhCityService.findPageInfo(bisInspMfdpqhCityParam)); } @ApiOperation(value = "列表--分页") @RequestMapping(value = "/list/{rgstId}", method = RequestMethod.GET) public BaseResponse> list(@PathVariable String rgstId) { return buildSuccessResponse(bisInspMfdpqhCityService.findList(Builder .of(BisInspMfdpqhCityParam::new) .with(BisInspMfdpqhCityParam::setRgstrId, rgstId) .build())); } }