9f6ae88279dd0bd722a63a43466785bd01c90037.svn-base 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package cn.com.goldenwater.dcproj.controller.villqh;
  2. import cn.com.goldenwater.dcproj.model.BisInspVillqhPoor;
  3. import cn.com.goldenwater.dcproj.service.BisInspVillqhPoorService;
  4. import cn.com.goldenwater.core.web.BaseController;
  5. import cn.com.goldenwater.core.web.BaseResponse;
  6. import cn.com.goldenwater.target.CheckException;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiOperation;
  9. import io.swagger.annotations.ApiParam;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.apache.commons.lang3.StringUtils;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.web.bind.annotation.PathVariable;
  15. import org.springframework.web.bind.annotation.RequestBody;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RequestMethod;
  18. import org.springframework.web.bind.annotation.RestController;
  19. /**
  20. * @author lhc
  21. * @date 2021-2-1
  22. */
  23. @Api(value = "农饮(青海)-农牧民情况管理",tags="农饮(青海)-农牧民情况管理")
  24. @RestController
  25. @RequestMapping("/bis/insp/villqh/poor")
  26. public class BisInspVillqhPoorController extends BaseController {
  27. @Autowired
  28. private BisInspVillqhPoorService bisInspVillqhPoorService;
  29. @ApiOperation(value = "修改农饮(青海)-农牧民情况")
  30. @RequestMapping(value = "", method = RequestMethod.POST)
  31. public BaseResponse<BisInspVillqhPoor> insert(@ApiParam(name = "bisInspVillqhPoor", value = "BisInspVillqhPoor", required = true)
  32. @RequestBody BisInspVillqhPoor bisInspVillqhPoor) {
  33. int ret = 0;
  34. if(StringUtils.isBlank(bisInspVillqhPoor.getId())){
  35. if (StringUtils.isBlank(bisInspVillqhPoor.getRegstrId()) ||
  36. StringUtils.isBlank(bisInspVillqhPoor.getAdCode())){
  37. throw new CheckException("缺少登记表编码或行政村编码");
  38. }
  39. ret = bisInspVillqhPoorService.insert(bisInspVillqhPoor);
  40. } else {
  41. ret = bisInspVillqhPoorService.update(bisInspVillqhPoor);
  42. }
  43. return buildSuccessResponse(bisInspVillqhPoor);
  44. }
  45. @ApiOperation(value = "根据ID删除农饮(青海)-农牧民情况")
  46. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  47. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  48. int ret = bisInspVillqhPoorService.delete(id);
  49. return buildSuccessResponse();
  50. }
  51. @ApiOperation(value = "根据ID获取农饮(青海)-农牧民情况(单表)")
  52. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  53. public BaseResponse<BisInspVillqhPoor> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  54. BisInspVillqhPoor bisInspVillqhPoor = bisInspVillqhPoorService.get(id);
  55. return buildSuccessResponse(bisInspVillqhPoor);
  56. }
  57. }