960c35943440efe3e96b8835887481276e610f0d.svn-base 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package cn.com.goldenwater.dcproj.controller.efp;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.AttEfpBase;
  5. import cn.com.goldenwater.dcproj.param.AttEfpBaseParam;
  6. import cn.com.goldenwater.dcproj.service.AttEfpBaseService;
  7. import cn.com.goldenwater.id.util.UuidUtil;
  8. import com.github.pagehelper.PageInfo;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import io.swagger.annotations.ApiParam;
  12. import org.apache.commons.lang3.StringUtils;
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.*;
  17. import java.util.List;
  18. /**
  19. * @author lune
  20. * @date 2020-5-27
  21. */
  22. @Api(value = "ATT 超标洪水防御督查对象基础表管理",tags="ATT 超标洪水防御督查对象基础表管理")
  23. @RestController
  24. @RequestMapping("/att/efp/base")
  25. public class AttEfpBaseController extends BaseController {
  26. private Logger logger = LoggerFactory.getLogger(getClass());
  27. @Autowired
  28. private AttEfpBaseService attEfpBaseService;
  29. @ApiOperation(value = "添加/修改超标洪水防御督查对象基础表")
  30. @RequestMapping(value = "", method = RequestMethod.POST)
  31. public BaseResponse<AttEfpBase> insert(@ApiParam(name = "attEfpBase", value = "AttEfpBase", required = true) @RequestBody AttEfpBase attEfpBase) {
  32. if(StringUtils.isBlank(attEfpBase.getId())) {
  33. String uuid = UuidUtil.uuid(); // 生成uuid
  34. attEfpBase.setId(uuid);
  35. attEfpBaseService.insert(attEfpBase);
  36. }else{
  37. attEfpBaseService.update(attEfpBase);
  38. }
  39. return buildSuccessResponse(attEfpBase);
  40. }
  41. @ApiOperation(value = "根据ID删除超标洪水防御督查对象基础表")
  42. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  43. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  44. int ret = attEfpBaseService.delete(id);
  45. return buildSuccessResponse();
  46. }
  47. @ApiOperation(value = "根据ID获取超标洪水防御督查对象基础表(单表)")
  48. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  49. public BaseResponse<AttEfpBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  50. AttEfpBase attEfpBase = attEfpBaseService.get(id);
  51. return buildSuccessResponse(attEfpBase);
  52. }
  53. @ApiOperation(value = "获取超标洪水防御督查对象基础表(列表所有)")
  54. @RequestMapping(value = "/list", method = RequestMethod.POST)
  55. public BaseResponse<List<AttEfpBase>> list(@ApiParam(name = "attEfpBaseParam", value = "attEfpBaseParam", required = true) @RequestBody AttEfpBaseParam attEfpBaseParam) {
  56. List<AttEfpBase> attEfpBaseList = attEfpBaseService.findList(attEfpBaseParam);
  57. return buildSuccessResponse(attEfpBaseList);
  58. }
  59. @ApiOperation(value = "获取超标洪水防御督查对象基础表(列表--分页)")
  60. @RequestMapping(value = "/page", method = RequestMethod.POST)
  61. public BaseResponse<PageInfo<AttEfpBase>> page(@ApiParam(name = "attEfpBaseParam", value = "attEfpBaseParam", required = true) @RequestBody AttEfpBaseParam attEfpBaseParam) {
  62. PageInfo<AttEfpBase> attEfpBaseList = attEfpBaseService.findPageInfo(attEfpBaseParam);
  63. return buildSuccessResponse(attEfpBaseList);
  64. }
  65. }