72069c0586bb0b40aceb56456243430ff0b40926.svn-base 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.AttRlrwImpl;
  5. import cn.com.goldenwater.dcproj.service.AttRlrwImplService;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import io.swagger.annotations.ApiParam;
  9. import org.apache.commons.lang3.StringUtils;
  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 2021-1-19
  22. */
  23. @Api(value = "xxx管理",tags="xxx管理")
  24. @RestController
  25. @RequestMapping("/bis/insp/AttRlrwImpl")
  26. public class AttRlrwImplController extends BaseController {
  27. private Logger logger = LoggerFactory.getLogger(getClass());
  28. @Autowired
  29. private AttRlrwImplService attRlrwImplService;
  30. @ApiOperation(value = "添加xxx")
  31. @RequestMapping(value = "/", method = RequestMethod.POST)
  32. public BaseResponse<AttRlrwImpl> insert(@ApiParam(name = "attRlrwImpl", value = "AttRlrwImpl", required = true) @RequestBody AttRlrwImpl attRlrwImpl) {
  33. if(StringUtils.isBlank(attRlrwImpl.getId())) {
  34. attRlrwImplService.insert(attRlrwImpl);
  35. }
  36. else{
  37. attRlrwImplService.update(attRlrwImpl);
  38. }
  39. return buildSuccessResponse(attRlrwImpl);
  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 = attRlrwImplService.delete(id);
  45. return buildSuccessResponse();
  46. }
  47. @ApiOperation(value = "更新xxx信息")
  48. @RequestMapping(value = "/update", method = RequestMethod.POST)
  49. public BaseResponse<AttRlrwImpl> update(@ApiParam(name = "attRlrwImpl", value = "AttRlrwImpl", required = true) @RequestBody AttRlrwImpl attRlrwImpl) {
  50. Assert.notNull(attRlrwImpl.getId(), "主键id为必填参数");
  51. int ret = attRlrwImplService.update(attRlrwImpl);
  52. return buildSuccessResponse(attRlrwImpl);
  53. }
  54. @ApiOperation(value = "根据ID获取xxx(单表)")
  55. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  56. public BaseResponse<AttRlrwImpl> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  57. AttRlrwImpl attRlrwImpl = attRlrwImplService.get(id);
  58. return buildSuccessResponse(attRlrwImpl);
  59. }
  60. }