345b3f92302224f62aa17a8e880aaf4d92dd5822.svn-base 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package cn.com.goldenwater.dcproj.controller.tac;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.TacSlbLawBook;
  5. import cn.com.goldenwater.dcproj.param.TacSlbLawBookParam;
  6. import cn.com.goldenwater.dcproj.service.TacSlbLawBookService;
  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 2019-9-25
  21. */
  22. @Api(value = "TAC 水利稽察法规管理", tags = "TAC 水利稽察法规管理")
  23. @RestController
  24. @RequestMapping("/tac/slb/law/book")
  25. public class TacSlbLawBookController extends BaseController {
  26. private Logger logger = LoggerFactory.getLogger(getClass());
  27. @Autowired
  28. private TacSlbLawBookService tacSlbLawBookService;
  29. @ApiOperation(value = "添加/修改水利稽察法规")
  30. @RequestMapping(value = "", method = RequestMethod.POST)
  31. public BaseResponse<TacSlbLawBook> insert(@ApiParam(name = "tacSlbLawBook", value = "TacSlbLawBook", required = true) @RequestBody TacSlbLawBook tacSlbLawBook) {
  32. if (StringUtils.isBlank(tacSlbLawBook.getId())) {
  33. String uuid = UuidUtil.uuid(); // 生成uuid
  34. tacSlbLawBook.setId(uuid);
  35. tacSlbLawBookService.insert(tacSlbLawBook);
  36. } else {
  37. tacSlbLawBookService.update(tacSlbLawBook);
  38. }
  39. return buildSuccessResponse(tacSlbLawBook);
  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 = tacSlbLawBookService.delete(id);
  45. return buildSuccessResponse();
  46. }
  47. @ApiOperation(value = "根据ID获取水利稽察法规(单表)")
  48. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  49. public BaseResponse<TacSlbLawBook> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  50. TacSlbLawBook tacSlbLawBook = tacSlbLawBookService.get(id);
  51. return buildSuccessResponse(tacSlbLawBook);
  52. }
  53. @ApiOperation(value = "获取水利稽察法规(列表所有)")
  54. @RequestMapping(value = "/list", method = RequestMethod.POST)
  55. public BaseResponse<List<TacSlbLawBook>> list(@ApiParam(name = "tacSlbLawBookParam", value = "tacSlbLawBookParam", required = true) @RequestBody TacSlbLawBookParam tacSlbLawBookParam) {
  56. List<TacSlbLawBook> tacSlbLawBookList = tacSlbLawBookService.findList(tacSlbLawBookParam);
  57. return buildSuccessResponse(tacSlbLawBookList);
  58. }
  59. @ApiOperation(value = "获取水利稽察法规(列表--分页)")
  60. @RequestMapping(value = "/page", method = RequestMethod.POST)
  61. public BaseResponse<PageInfo<TacSlbLawBook>> page(@ApiParam(name = "tacSlbLawBookParam", value = "tacSlbLawBookParam", required = true) @RequestBody TacSlbLawBookParam tacSlbLawBookParam) {
  62. PageInfo<TacSlbLawBook> tacSlbLawBookList = tacSlbLawBookService.findPageInfo(tacSlbLawBookParam);
  63. return buildSuccessResponse(tacSlbLawBookList);
  64. }
  65. }