d7cb6d67535d1b3cc6a8cf62f32cfc36be1505b7.svn-base 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package cn.com.goldenwater.dcproj.controller.ducha;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspYearInfo;
  5. import cn.com.goldenwater.dcproj.service.BisInspYearInfoService;
  6. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  7. import cn.com.goldenwater.dcproj.utils.StringUtils;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import io.swagger.annotations.ApiParam;
  11. import org.slf4j.Logger;
  12. import org.slf4j.LoggerFactory;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.util.Assert;
  15. import org.springframework.web.bind.annotation.PathVariable;
  16. import org.springframework.web.bind.annotation.RequestBody;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RequestMethod;
  19. import org.springframework.web.bind.annotation.RestController;
  20. /**
  21. * @author lhc
  22. * @date 2023年4月6日
  23. */
  24. @Api(value = "年度计划批次组数据信息管理",tags="年度计划批次组数据信息管理")
  25. @RestController
  26. @RequestMapping("/bis/insp/year/info")
  27. public class BisInspYearInfoController extends BaseController {
  28. private Logger logger = LoggerFactory.getLogger(getClass());
  29. @Autowired
  30. private BisInspYearInfoService bisInspYearInfoService;
  31. @Autowired
  32. private OlBisInspOrgService inspOrgService;
  33. @ApiOperation(value = "添加年度计划批次组数据")
  34. @RequestMapping(value = "/", method = RequestMethod.POST)
  35. public BaseResponse<BisInspYearInfo> insert(@ApiParam(name = "bisInspYearInfo", value = "BisInspYearInfo", required = true) @RequestBody BisInspYearInfo bisInspYearInfo) {
  36. logger.debug("增加年度计划批次组数据信息");
  37. if(StringUtils.isBlank(bisInspYearInfo.getId())) {
  38. String curOrgId = getCurrentOrgId();
  39. bisInspYearInfo.setOrgId(curOrgId);
  40. bisInspYearInfo.setAdCode(inspOrgService.getRlProvince(curOrgId));
  41. bisInspYearInfo.setPersId(getCurrentPersId());
  42. bisInspYearInfoService.insert(bisInspYearInfo);
  43. }
  44. else{
  45. bisInspYearInfoService.update(bisInspYearInfo);
  46. }
  47. return buildSuccessResponse(bisInspYearInfo);
  48. }
  49. @ApiOperation(value = "根据ID删除年度计划批次组数据")
  50. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  51. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  52. int ret = bisInspYearInfoService.delete(id);
  53. return buildSuccessResponse();
  54. }
  55. @ApiOperation(value = "更新年度计划批次组数据信息")
  56. @RequestMapping(value = "/update", method = RequestMethod.POST)
  57. public BaseResponse<BisInspYearInfo> update(@ApiParam(name = "bisInspYearInfo", value = "BisInspYearInfo", required = true) @RequestBody BisInspYearInfo bisInspYearInfo) {
  58. Assert.notNull(bisInspYearInfo.getId(), "主键id为必填参数");
  59. int ret = bisInspYearInfoService.update(bisInspYearInfo);
  60. return buildSuccessResponse(bisInspYearInfo);
  61. }
  62. @ApiOperation(value = "根据ID获取年度计划批次组数据(单表)")
  63. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  64. public BaseResponse<BisInspYearInfo> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  65. BisInspYearInfo bisInspYearInfo = bisInspYearInfoService.get(id);
  66. return buildSuccessResponse(bisInspYearInfo);
  67. }
  68. }