61bd6d3224d27418ed475a7fdd02e0bb5eea6c50.svn-base 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package cn.com.goldenwater.dcproj.controller.safety;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  5. import cn.com.goldenwater.dcproj.model.BisInspSafetyRgstr;
  6. import cn.com.goldenwater.dcproj.param.TypeParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspSafetyRgstrService;
  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.lang.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. /**
  19. * @author lhc
  20. * @date 2021-3-11
  21. */
  22. @Api(value = "消防安全及疫情防控对象登记表管理", tags = "消防安全及疫情防控对象登记表管理")
  23. @RestController
  24. @RequestMapping("/bis/insp/safety")
  25. public class BisInspSafetyRgstrController extends BaseController {
  26. private Logger logger = LoggerFactory.getLogger(getClass());
  27. @Autowired
  28. private BisInspSafetyRgstrService bisInspSafetyRgstrService;
  29. @ApiOperation(value = "修改消防安全及疫情防控对象登记表")
  30. @RequestMapping(value = "", method = RequestMethod.POST)
  31. public BaseResponse<BisInspSafetyRgstr> insert(@ApiParam(name = "bisInspSafetyRgstr", value = "BisInspSafetyRgstr", required = true)
  32. @RequestBody BisInspSafetyRgstr bisInspSafetyRgstr) {
  33. if (StringUtils.isBlank(bisInspSafetyRgstr.getId()) || StringUtils.isNotBlank(bisInspSafetyRgstr.getRgstrId())) {
  34. // rgstrId 不为 空 时,传给ID
  35. bisInspSafetyRgstr.setId(bisInspSafetyRgstr.getRgstrId());
  36. }
  37. if (StringUtils.isBlank(bisInspSafetyRgstr.getId())) {
  38. throw new CheckException("缺少登记表编码!");
  39. }
  40. int ret = bisInspSafetyRgstrService.update(bisInspSafetyRgstr);
  41. return buildSuccessResponse(bisInspSafetyRgstr);
  42. }
  43. @ApiOperation(value = "根据ID删除消防安全及疫情防控对象登记表")
  44. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  45. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true)
  46. @PathVariable String id) {
  47. int ret = bisInspSafetyRgstrService.delete(id);
  48. return buildSuccessResponse();
  49. }
  50. @ApiOperation(value = "根据ID获取消防安全及疫情防控对象登记表(单表)")
  51. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  52. public BaseResponse<BisInspSafetyRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  53. BisInspSafetyRgstr bisInspSafetyRgstr = bisInspSafetyRgstrService.get(id);
  54. return buildSuccessResponse(bisInspSafetyRgstr);
  55. }
  56. @ApiOperation(value = "列表--分页")
  57. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  58. public BaseResponse<PageInfo<BisInspSafetyRgstr>> page(@ApiParam(name = "BisInspSafetyRgstrParam", value = "BisInspSafetyRgstrParam", required = true)
  59. @RequestBody TypeParam typeParam) {
  60. typeParam.setpType(BisInspEnum.SAFETY.getValue());
  61. typeParam.setPresId(getCurrentPersId());
  62. PageInfo<BisInspSafetyRgstr> rgstrPageInfo = bisInspSafetyRgstrService.findObjPageByType(typeParam, null);
  63. return buildSuccessResponse(rgstrPageInfo);
  64. }
  65. }