220257568d07d530e74f99953f654330770ee6e0.svn-base 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package cn.com.goldenwater.dcproj.controller.fjsdu;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.AttFjsduBase;
  5. import cn.com.goldenwater.dcproj.service.AttFjsduBaseService;
  6. import cn.com.goldenwater.dcproj.utils.StringUtils;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiOperation;
  9. import io.swagger.annotations.ApiParam;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.util.Assert;
  14. import org.springframework.web.bind.annotation.PathVariable;
  15. import org.springframework.web.bind.annotation.RequestBody;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RequestMethod;
  18. import org.springframework.web.bind.annotation.RestController;
  19. /**
  20. * @author lhc
  21. * @date 2023年12月18日
  22. */
  23. @Api(value = "xxx管理",tags="xxx管理")
  24. @RestController
  25. @RequestMapping("/att/fjsdu/base")
  26. public class AttFjsduBaseController extends BaseController {
  27. private Logger logger = LoggerFactory.getLogger(getClass());
  28. @Autowired
  29. private AttFjsduBaseService attFjsduBaseService;
  30. @ApiOperation(value = "添加xxx")
  31. @RequestMapping(value = "", method = RequestMethod.POST)
  32. public BaseResponse<AttFjsduBase> insert(@ApiParam(name = "attFjsduBase", value = "AttFjsduBase", required = true) @RequestBody AttFjsduBase attFjsduBase) {
  33. if(StringUtils.isBlank(attFjsduBase.getId())) {
  34. attFjsduBaseService.insert(attFjsduBase);
  35. }
  36. else{
  37. attFjsduBaseService.update(attFjsduBase);
  38. }
  39. return buildSuccessResponse(attFjsduBase);
  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 = attFjsduBaseService.delete(id);
  45. return buildSuccessResponse();
  46. }
  47. @ApiOperation(value = "更新xxx信息")
  48. @RequestMapping(value = "/update", method = RequestMethod.POST)
  49. public BaseResponse<AttFjsduBase> update(@ApiParam(name = "attFjsduBase", value = "AttFjsduBase", required = true) @RequestBody AttFjsduBase attFjsduBase) {
  50. Assert.notNull(attFjsduBase.getId(), "主键id为必填参数");
  51. int ret = attFjsduBaseService.update(attFjsduBase);
  52. return buildSuccessResponse(attFjsduBase);
  53. }
  54. @ApiOperation(value = "根据ID获取xxx(单表)")
  55. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  56. public BaseResponse<AttFjsduBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  57. AttFjsduBase attFjsduBase = attFjsduBaseService.get(id);
  58. return buildSuccessResponse(attFjsduBase);
  59. }
  60. @ApiOperation(value = "根据 objId 获取基本信息(单表)")
  61. @RequestMapping(value = "/getObjId/{objId}", method = {RequestMethod.GET, RequestMethod.POST})
  62. public BaseResponse<AttFjsduBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true)
  63. @PathVariable String objId) {
  64. return buildSuccessResponse(attFjsduBaseService.getObjId(objId));
  65. }
  66. }