43c424e535f4116269a6f8400de5baacd530203b.svn-base 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package cn.com.goldenwater.dcproj.controller.fjpjmgdp;
  2. import cn.com.goldenwater.dcproj.model.AttFjpjmgdpBase;
  3. import cn.com.goldenwater.dcproj.param.AttFjpjmgdpBaseParam;
  4. import cn.com.goldenwater.dcproj.service.AttFjpjmgdpBaseService;
  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.RequestParam;
  21. import org.springframework.web.bind.annotation.RestController;
  22. import java.util.List;
  23. /**
  24. * @author lhc
  25. * @date 2023-11-8
  26. */
  27. @Api(value = "ATT 水利工程管理单位管理",tags="ATT 水利工程管理单位管理")
  28. @RestController
  29. @RequestMapping("/att/fjpjmgdp/base")
  30. public class AttFjpjmgdpBaseController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private AttFjpjmgdpBaseService attFjpjmgdpBaseService;
  34. @ApiOperation(value = "添加xxx")
  35. @RequestMapping(value = "", method = RequestMethod.POST)
  36. public BaseResponse<AttFjpjmgdpBase> insert(@ApiParam(name = "attFjpjmgdpBase", value = "AttFjpjmgdpBase", required = true) @RequestBody AttFjpjmgdpBase attFjpjmgdpBase) {
  37. if(StringUtils.isBlank(attFjpjmgdpBase.getId())) {
  38. attFjpjmgdpBaseService.insert(attFjpjmgdpBase);
  39. }
  40. else{
  41. attFjpjmgdpBaseService.update(attFjpjmgdpBase);
  42. }
  43. return buildSuccessResponse(attFjpjmgdpBase);
  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 = attFjpjmgdpBaseService.delete(id);
  49. return buildSuccessResponse();
  50. }
  51. @ApiOperation(value = "更新xxx信息")
  52. @RequestMapping(value = "/update", method = RequestMethod.POST)
  53. public BaseResponse<AttFjpjmgdpBase> update(@ApiParam(name = "attFjpjmgdpBase", value = "AttFjpjmgdpBase", required = true) @RequestBody AttFjpjmgdpBase attFjpjmgdpBase) {
  54. Assert.notNull(attFjpjmgdpBase.getId(), "主键id为必填参数");
  55. int ret = attFjpjmgdpBaseService.update(attFjpjmgdpBase);
  56. return buildSuccessResponse(attFjpjmgdpBase);
  57. }
  58. @ApiOperation(value = "根据ID获取xxx(单表)")
  59. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  60. public BaseResponse<AttFjpjmgdpBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  61. AttFjpjmgdpBase attFjpjmgdpBase = attFjpjmgdpBaseService.get(id);
  62. return buildSuccessResponse(attFjpjmgdpBase);
  63. }
  64. @ApiOperation(value = "根据 objId 获取基本信息(单表)")
  65. @RequestMapping(value = "/getObjId/{objId}", method = {RequestMethod.GET, RequestMethod.POST})
  66. public BaseResponse<AttFjpjmgdpBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true)
  67. @PathVariable String objId) {
  68. return buildSuccessResponse(attFjpjmgdpBaseService.getObjId(objId));
  69. }
  70. }