71dff3b61eb92360dd1697c3b04027ff8fbc7198.svn-base 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package cn.com.goldenwater.dcproj.controller.grow;
  2. import cn.com.goldenwater.dcproj.model.AttGrowBase;
  3. import cn.com.goldenwater.dcproj.param.AttGrowBaseParam;
  4. import cn.com.goldenwater.dcproj.service.AttGrowBaseService;
  5. import cn.com.goldenwater.core.web.BaseController;
  6. import cn.com.goldenwater.core.web.BaseResponse;
  7. import cn.com.goldenwater.id.util.UuidUtil;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import io.swagger.annotations.ApiParam;
  11. import org.apache.commons.lang3.StringUtils;
  12. import org.slf4j.Logger;
  13. import org.slf4j.LoggerFactory;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.util.Assert;
  16. import org.springframework.web.bind.annotation.PathVariable;
  17. import org.springframework.web.bind.annotation.RequestBody;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RequestMethod;
  20. import org.springframework.web.bind.annotation.RestController;
  21. /**
  22. * @author lhc
  23. * @date 2021-1-22
  24. */
  25. @Api(value = "xxx管理",tags="xxx管理")
  26. @RestController
  27. @RequestMapping("/att/grow/base")
  28. public class AttGrowBaseController extends BaseController {
  29. private Logger logger = LoggerFactory.getLogger(getClass());
  30. @Autowired
  31. private AttGrowBaseService attGrowBaseService;
  32. @ApiOperation(value = "添加/修改地下水机井基础信息表")
  33. @RequestMapping(value = "", method = RequestMethod.POST)
  34. public BaseResponse<AttGrowBase> insert(@ApiParam(name = "attGrowBase", value = "AttGrowBase", required = true) @RequestBody AttGrowBase attGrowBase) {
  35. if(StringUtils.isBlank(attGrowBase.getId())) {
  36. // 生成uuid
  37. String uuid = UuidUtil.uuid();
  38. attGrowBase.setId(uuid);
  39. attGrowBaseService.insert(attGrowBase);
  40. }else{
  41. attGrowBaseService.update(attGrowBase);
  42. }
  43. return buildSuccessResponse(attGrowBase);
  44. }
  45. @ApiOperation(value = "根据ID删除xxx")
  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 = attGrowBaseService.delete(id);
  49. return buildSuccessResponse();
  50. }
  51. @ApiOperation(value = "更新xxx信息")
  52. @RequestMapping(value = "/update", method = RequestMethod.POST)
  53. public BaseResponse<AttGrowBase> update(@ApiParam(name = "attGrowBase", value = "AttGrowBase", required = true) @RequestBody AttGrowBase attGrowBase) {
  54. Assert.notNull(attGrowBase.getId(), "主键id为必填参数");
  55. int ret = attGrowBaseService.update(attGrowBase);
  56. return buildSuccessResponse(attGrowBase);
  57. }
  58. @ApiOperation(value = "根据ID获取xxx(单表)")
  59. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  60. public BaseResponse<AttGrowBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  61. AttGrowBase attGrowBase = attGrowBaseService.get(id);
  62. return buildSuccessResponse(attGrowBase);
  63. }
  64. @ApiOperation(value = "根据 objId 获取地下水机井基本信息(单表)")
  65. @RequestMapping(value = "/getObjId/{objId}", method = RequestMethod.POST)
  66. public BaseResponse<AttGrowBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId) {
  67. AttGrowBase attCdepBase = attGrowBaseService.getObjId(objId);
  68. return buildSuccessResponse(attCdepBase);
  69. }
  70. @ApiOperation(value = "经纬度转换")
  71. @RequestMapping(value = "/convertTc",method = RequestMethod.POST)
  72. public BaseResponse convertTc(@ApiParam(name = "attGrowBaseParam", value = "attGrowBaseParam", required = true) @RequestBody AttGrowBaseParam attGrowBaseParam) {
  73. int result = attGrowBaseService.convertTc(attGrowBaseParam);
  74. return buildSuccessResponse();
  75. }
  76. }