9e0764a3358c3de09b0dd7d341c6caccba4e0875.svn-base 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package cn.com.goldenwater.dcproj.controller.fjpjcsu;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.AttFjpjcsuBase;
  5. import cn.com.goldenwater.dcproj.model.AttFjpjcsuBase;
  6. import cn.com.goldenwater.dcproj.model.AttFjsduBase;
  7. import cn.com.goldenwater.dcproj.service.AttFjpjcsuBaseService;
  8. import cn.com.goldenwater.dcproj.utils.StringUtils;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import io.swagger.annotations.ApiParam;
  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 lxf
  23. * @date 2023年12月19日
  24. */
  25. @Api(value = "xxx管理",tags="xxx管理")
  26. @RestController
  27. @RequestMapping("/att/fjpjcsu/base")
  28. public class AttFjpjcsuBaseController extends BaseController {
  29. private Logger logger = LoggerFactory.getLogger(getClass());
  30. @Autowired
  31. private AttFjpjcsuBaseService attFjpjcsuBaseService;
  32. @ApiOperation(value = "添加xxx")
  33. @RequestMapping(value = "", method = RequestMethod.POST)
  34. public BaseResponse<AttFjpjcsuBase> insert(@ApiParam(name = "attFjpjcsuBase", value = "AttFjpjcsuBase", required = true) @RequestBody AttFjpjcsuBase attFjpjcsuBase) {
  35. if(StringUtils.isBlank(attFjpjcsuBase.getId())) {
  36. attFjpjcsuBaseService.insert(attFjpjcsuBase);
  37. }
  38. else{
  39. attFjpjcsuBaseService.update(attFjpjcsuBase);
  40. }
  41. return buildSuccessResponse(attFjpjcsuBase);
  42. }
  43. @ApiOperation(value = "根据ID删除xxx")
  44. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  45. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  46. int ret = attFjpjcsuBaseService.delete(id);
  47. return buildSuccessResponse();
  48. }
  49. @ApiOperation(value = "更新xxx信息")
  50. @RequestMapping(value = "/update", method = RequestMethod.POST)
  51. public BaseResponse<AttFjpjcsuBase> update(@ApiParam(name = "attFjpjcsuBase", value = "AttFjpjcsuBase", required = true) @RequestBody AttFjpjcsuBase attFjpjcsuBase) {
  52. Assert.notNull(attFjpjcsuBase.getId(), "主键id为必填参数");
  53. int ret = attFjpjcsuBaseService.update(attFjpjcsuBase);
  54. return buildSuccessResponse(attFjpjcsuBase);
  55. }
  56. @ApiOperation(value = "根据ID获取xxx(单表)")
  57. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  58. public BaseResponse<AttFjpjcsuBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  59. AttFjpjcsuBase attFjpjcsuBase = attFjpjcsuBaseService.get(id);
  60. return buildSuccessResponse(attFjpjcsuBase);
  61. }
  62. @ApiOperation(value = "根据 objId 获取基本信息(单表)")
  63. @RequestMapping(value = "/getObjId/{objId}", method = {RequestMethod.GET, RequestMethod.POST})
  64. public BaseResponse<AttFjpjcsuBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true)
  65. @PathVariable String objId) {
  66. return buildSuccessResponse(attFjpjcsuBaseService.getObjId(objId));
  67. }
  68. }