22ff0ce858dcc03792ab024ea78f585a73c080ac.svn-base 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package cn.com.goldenwater.dcproj.controller.wtgt;
  2. import cn.com.goldenwater.dcproj.model.AttWtgtBase;
  3. import cn.com.goldenwater.dcproj.service.AttWtgtBaseService;
  4. import cn.com.goldenwater.core.web.BaseController;
  5. import cn.com.goldenwater.core.web.BaseResponse;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import io.swagger.annotations.ApiParam;
  9. import org.slf4j.Logger;
  10. import org.slf4j.LoggerFactory;
  11. import org.apache.commons.lang3.StringUtils;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.PathVariable;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RequestMethod;
  17. import org.springframework.web.bind.annotation.RestController;
  18. /**
  19. * @author lhc
  20. * @date 2020-9-18
  21. */
  22. @Api(value = "取水许可管理基本信息管理",tags="取水许可管理基本信息管理")
  23. @RestController
  24. @RequestMapping("/att/wtgt/base")
  25. public class AttWtgtBaseController extends BaseController {
  26. private Logger logger = LoggerFactory.getLogger(getClass());
  27. @Autowired
  28. private AttWtgtBaseService attWtgtBaseService;
  29. @ApiOperation(value = "添加或修改取水许可管理基本信息")
  30. @RequestMapping(value = "", method = RequestMethod.POST)
  31. public BaseResponse<AttWtgtBase> insert(@ApiParam(name = "attWtgtBase", value = "AttWtgtBase", required = true) @RequestBody AttWtgtBase attWtgtBase) {
  32. // 根据有无主键,来新增、更新信息
  33. int ret = 0;
  34. if(StringUtils.isBlank(attWtgtBase.getId())){
  35. ret = attWtgtBaseService.insert(attWtgtBase);
  36. } else {
  37. ret = attWtgtBaseService.update(attWtgtBase);
  38. }
  39. return buildSuccessResponse(attWtgtBase);
  40. }
  41. @ApiOperation(value = "根据ID删除取水许可管理基本信息")
  42. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  43. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  44. int ret = attWtgtBaseService.delete(id);
  45. return buildSuccessResponse();
  46. }
  47. @ApiOperation(value = "根据ID获取取水许可管理基本信息(单表)")
  48. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  49. public BaseResponse<AttWtgtBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  50. AttWtgtBase attWtgtBase = attWtgtBaseService.get(id);
  51. return buildSuccessResponse(attWtgtBase);
  52. }
  53. @ApiOperation(value = "根据 objId 获取取水许可管理基本信息(单表)")
  54. @RequestMapping(value = "/getObjId/{objId}", method = RequestMethod.GET)
  55. public BaseResponse<AttWtgtBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId) {
  56. AttWtgtBase attWtgtBase = attWtgtBaseService.getObjId(objId);
  57. return buildSuccessResponse(attWtgtBase);
  58. }
  59. }