05144285216960776b3d63f8faeb6ffccc976e24.svn-base 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package cn.com.goldenwater.dcproj.controller.mfdpqh;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspMfdpqhCity;
  5. import cn.com.goldenwater.dcproj.param.BisInspMfdpqhCityParam;
  6. import cn.com.goldenwater.dcproj.service.BisInspMfdpqhCityService;
  7. import cn.com.goldenwater.dcproj.utils.Builder;
  8. import cn.com.goldenwater.target.CheckException;
  9. import com.github.pagehelper.PageInfo;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import io.swagger.annotations.ApiParam;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.slf4j.Logger;
  15. import org.slf4j.LoggerFactory;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.*;
  18. import java.util.List;
  19. /**
  20. * @author lhc
  21. * @date 2021-6-15
  22. */
  23. @Api(value = "094青海山洪灾害防御-市县管理", tags = "094青海山洪灾害防御-市县管理")
  24. @RestController
  25. @RequestMapping("/bis/insp/mfdpqh/city")
  26. public class BisInspMfdpqhCityController extends BaseController {
  27. private Logger logger = LoggerFactory.getLogger(getClass());
  28. @Autowired
  29. private BisInspMfdpqhCityService bisInspMfdpqhCityService;
  30. @ApiOperation(value = "修改094青海山洪灾害防御-市县")
  31. @RequestMapping(value = "", method = RequestMethod.POST)
  32. public BaseResponse<BisInspMfdpqhCity> insert(@ApiParam(name = "bisInspMfdpqhCity", value = "BisInspMfdpqhCity", required = true) @RequestBody BisInspMfdpqhCity bisInspMfdpqhCity) {
  33. bisInspMfdpqhCity.setPersId(getCurrentPersId());
  34. int ret = 0;
  35. if (StringUtils.isBlank(bisInspMfdpqhCity.getId())) {
  36. ret = bisInspMfdpqhCityService.insert(bisInspMfdpqhCity);
  37. } else {
  38. ret = bisInspMfdpqhCityService.update(bisInspMfdpqhCity);
  39. }
  40. return buildSuccessResponse(bisInspMfdpqhCity);
  41. }
  42. @ApiOperation(value = "根据ID删除094青海山洪灾害防御-市县")
  43. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  44. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  45. int ret = bisInspMfdpqhCityService.delete(id);
  46. return buildSuccessResponse();
  47. }
  48. @ApiOperation(value = "根据ID获取094青海山洪灾害防御-市县(单表)")
  49. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  50. public BaseResponse<BisInspMfdpqhCity> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  51. BisInspMfdpqhCity bisInspMfdpqhCity = bisInspMfdpqhCityService.get(id);
  52. return buildSuccessResponse(bisInspMfdpqhCity);
  53. }
  54. @ApiOperation(value = "列表--分页")
  55. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  56. public BaseResponse<PageInfo<BisInspMfdpqhCity>> page(@ApiParam(name = "bisInspChmclsUseunitwkParam", value = "bisInspChmclsUseunitwkParam", required = true)
  57. @RequestBody BisInspMfdpqhCityParam bisInspMfdpqhCityParam) {
  58. if (StringUtils.isBlank(bisInspMfdpqhCityParam.getRgstrId())) {
  59. throw new CheckException("登记表ID为必填项!");
  60. }
  61. return buildSuccessResponse(bisInspMfdpqhCityService.findPageInfo(bisInspMfdpqhCityParam));
  62. }
  63. @ApiOperation(value = "列表--分页")
  64. @RequestMapping(value = "/list/{rgstId}", method = RequestMethod.GET)
  65. public BaseResponse<List<BisInspMfdpqhCity>> list(@PathVariable String rgstId) {
  66. return buildSuccessResponse(bisInspMfdpqhCityService.findList(Builder
  67. .of(BisInspMfdpqhCityParam::new)
  68. .with(BisInspMfdpqhCityParam::setRgstrId, rgstId)
  69. .build()));
  70. }
  71. }