b316e201e824e891b05f7a899093529965e6dbe2.svn-base 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package cn.com.goldenwater.dcproj.controller.dstfldqh;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.AttDstfldqhBase;
  5. import cn.com.goldenwater.dcproj.service.AttDstfldqhBaseService;
  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.*;
  15. /**
  16. * @author lhc
  17. * @date 2021-6-10
  18. */
  19. @Api(value = "青海水毁名录管理",tags="青海水毁名录管理")
  20. @RestController
  21. @RequestMapping("/att/dstfldqh/base")
  22. public class AttDstfldqhBaseController extends BaseController {
  23. private Logger logger = LoggerFactory.getLogger(getClass());
  24. @Autowired
  25. private AttDstfldqhBaseService attDstfldqhBaseService;
  26. @ApiOperation(value = "添加青海水毁名录")
  27. @RequestMapping(value = "", method = RequestMethod.POST)
  28. public BaseResponse<AttDstfldqhBase> insert(@ApiParam(name = "attDstfldqhBase", value = "AttDstfldqhBase", required = true) @RequestBody AttDstfldqhBase attDstfldqhBase) {
  29. if(StringUtils.isBlank(attDstfldqhBase.getId())) {
  30. attDstfldqhBaseService.insert(attDstfldqhBase);
  31. }
  32. else{
  33. attDstfldqhBaseService.update(attDstfldqhBase);
  34. }
  35. return buildSuccessResponse(attDstfldqhBase);
  36. }
  37. @ApiOperation(value = "根据ID删除青海水毁名录")
  38. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  39. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  40. int ret = attDstfldqhBaseService.delete(id);
  41. return buildSuccessResponse();
  42. }
  43. @ApiOperation(value = "更新青海水毁名录信息")
  44. @RequestMapping(value = "/update", method = RequestMethod.POST)
  45. public BaseResponse<AttDstfldqhBase> update(@ApiParam(name = "attDstfldqhBase", value = "AttDstfldqhBase", required = true) @RequestBody AttDstfldqhBase attDstfldqhBase) {
  46. Assert.notNull(attDstfldqhBase.getId(), "主键id为必填参数");
  47. int ret = attDstfldqhBaseService.update(attDstfldqhBase);
  48. return buildSuccessResponse(attDstfldqhBase);
  49. }
  50. @ApiOperation(value = "根据ID获取青海水毁名录(单表)")
  51. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  52. public BaseResponse<AttDstfldqhBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  53. AttDstfldqhBase attDstfldqhBase = attDstfldqhBaseService.get(id);
  54. return buildSuccessResponse(attDstfldqhBase);
  55. }
  56. }