fb49b9adc7463f82902aae9829842b3ac737b655.svn-base 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package cn.com.goldenwater.dcproj.controller.base;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.StStbprpB;
  5. import cn.com.goldenwater.dcproj.param.PersObjParam;
  6. import cn.com.goldenwater.dcproj.service.StStbprpBService;
  7. import com.github.pagehelper.PageInfo;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import io.swagger.annotations.ApiParam;
  11. import org.slf4j.Logger;
  12. import org.slf4j.LoggerFactory;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.util.Assert;
  15. import org.springframework.web.bind.annotation.PathVariable;
  16. import org.springframework.web.bind.annotation.RequestBody;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RequestMethod;
  19. import org.springframework.web.bind.annotation.RestController;
  20. import javax.servlet.http.HttpServletResponse;
  21. import java.util.List;
  22. /**
  23. * @author lune
  24. * @date 2019-6-4
  25. */
  26. @Api(value = "水文站基础信息管理", tags = "水文站基础信息管理")
  27. @RestController
  28. @RequestMapping("/st/stbprp/base")
  29. public class StStbprpBController extends BaseController {
  30. private Logger logger = LoggerFactory.getLogger(getClass());
  31. @Autowired
  32. private StStbprpBService stStbprpBService;
  33. @ApiOperation(value = "添加xxx")
  34. @RequestMapping(value = "", method = RequestMethod.POST)
  35. public BaseResponse<StStbprpB> insert(@ApiParam(name = "stStbprpB", value = "StStbprpB", required = true) @RequestBody StStbprpB stStbprpB) {
  36. int ret = stStbprpBService.insert(stStbprpB);
  37. return buildSuccessResponse(stStbprpB);
  38. }
  39. @ApiOperation(value = "根据ID删除xxx")
  40. @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
  41. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  42. int ret = stStbprpBService.delete(id);
  43. return buildSuccessResponse();
  44. }
  45. @ApiOperation(value = "更新xxx信息")
  46. @RequestMapping(value = "", method = RequestMethod.PUT)
  47. public BaseResponse update(@ApiParam(name = "stStbprpB", value = "StStbprpB", required = true) @RequestBody StStbprpB stStbprpB) {
  48. Assert.notNull(stStbprpB.getStcd(), "主键id为必填参数");
  49. int ret = stStbprpBService.update(stStbprpB);
  50. return buildSuccessResponse();
  51. }
  52. @ApiOperation(value = "根据ID获取xxx(单表)")
  53. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  54. public BaseResponse<StStbprpB> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  55. StStbprpB stStbprpB = stStbprpBService.get(id);
  56. return buildSuccessResponse(stStbprpB);
  57. }
  58. @ApiOperation(value = "获取列表(地图展示)")
  59. @RequestMapping(value = "findList", method = RequestMethod.POST)
  60. public BaseResponse<List<StStbprpB>> findList(@ApiParam(name = "StStbprpBParam", value = "stStbprpBParam", required = true) @RequestBody PersObjParam persObjParam) {
  61. List<StStbprpB> stStbprpBList = stStbprpBService.findListBy(persObjParam);
  62. return buildSuccessResponse(stStbprpBList);
  63. }
  64. @ApiOperation(value = "获取列表(分页)")
  65. @RequestMapping(value = "findPageList", method = RequestMethod.POST)
  66. public BaseResponse<PageInfo<StStbprpB>> findPageList(@ApiParam(name = "StStbprpBParam", value = "stStbprpBParam", required = true) @RequestBody PersObjParam persObjParam, HttpServletResponse response) {
  67. PageInfo<StStbprpB> stStbprpBPageInfo = stStbprpBService.findPageInfoBy(persObjParam, response);
  68. return buildSuccessResponse(stStbprpBPageInfo);
  69. }
  70. }