f73ce583e3dee4f90c711d49f75c8604d073c1ca.svn-base 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package cn.com.goldenwater.dcproj.controller.rlrw;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.AttRlrwBase;
  5. import cn.com.goldenwater.dcproj.service.AttRlrwBaseService;
  6. import cn.com.goldenwater.id.util.UuidUtil;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiOperation;
  9. import io.swagger.annotations.ApiParam;
  10. import org.apache.commons.lang3.StringUtils;
  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.*;
  16. /**
  17. * @author lhc
  18. * @date 2021-1-19
  19. */
  20. @Api(value = "xxx管理", tags = "xxx管理")
  21. @RestController
  22. @RequestMapping("/att/rlrw/base")
  23. public class AttRlrwBaseController extends BaseController {
  24. private Logger logger = LoggerFactory.getLogger(getClass());
  25. @Autowired
  26. private AttRlrwBaseService attRlrwBaseService;
  27. @ApiOperation(value = "添加/修改退地减水地块基础信息表")
  28. @RequestMapping(value = "", method = RequestMethod.POST)
  29. public BaseResponse<AttRlrwBase> insert(@ApiParam(name = "attRlrwBase", value = "AttRlrwBase", required = true)
  30. @RequestBody AttRlrwBase attRlrwBase) {
  31. if (StringUtils.isBlank(attRlrwBase.getLandCode())) {
  32. // 生成uuid
  33. String uuid = UuidUtil.uuid();
  34. attRlrwBase.setLandCode(uuid);
  35. attRlrwBaseService.insert(attRlrwBase);
  36. } else {
  37. attRlrwBaseService.update(attRlrwBase);
  38. }
  39. return buildSuccessResponse(attRlrwBase);
  40. }
  41. @ApiOperation(value = "根据ID删除xxx")
  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 = attRlrwBaseService.delete(id);
  45. return buildSuccessResponse();
  46. }
  47. @ApiOperation(value = "更新xxx信息")
  48. @RequestMapping(value = "/update", method = RequestMethod.POST)
  49. public BaseResponse<AttRlrwBase> update(@ApiParam(name = "attRlrwBase", value = "AttRlrwBase", required = true) @RequestBody AttRlrwBase attRlrwBase) {
  50. Assert.notNull(attRlrwBase.getLandCode(), "主键id为必填参数");
  51. int ret = attRlrwBaseService.update(attRlrwBase);
  52. return buildSuccessResponse(attRlrwBase);
  53. }
  54. @ApiOperation(value = "根据ID获取xxx(单表)")
  55. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  56. public BaseResponse<AttRlrwBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  57. AttRlrwBase attRlrwBase = attRlrwBaseService.get(id);
  58. return buildSuccessResponse(attRlrwBase);
  59. }
  60. @ApiOperation(value = "根据 objId 获取退地减水地块基本信息(单表)")
  61. @RequestMapping(value = "/getObjId/{objId}", method = RequestMethod.POST)
  62. public BaseResponse<AttRlrwBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId) {
  63. AttRlrwBase attCdepBase = attRlrwBaseService.getObjId(objId);
  64. return buildSuccessResponse(attCdepBase);
  65. }
  66. }