dc93ca595b5fe12e3c8a9265d4a0738d0565539e.svn-base 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.TacSlbLawContent;
  5. import cn.com.goldenwater.dcproj.param.TacSlbLawContentParam;
  6. import cn.com.goldenwater.dcproj.service.TacSlbLawContentService;
  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/content")
  25. public class TacSlbLawContentController extends BaseController {
  26. private Logger logger = LoggerFactory.getLogger(getClass());
  27. @Autowired
  28. private TacSlbLawContentService tacSlbLawContentService;
  29. @ApiOperation(value = "添加/修改")
  30. @RequestMapping(value = "", method = RequestMethod.POST)
  31. public BaseResponse<TacSlbLawContent> insert(@ApiParam(name = "tacSlbLawContent", value = "TacSlbLawContent", required = true) @RequestBody TacSlbLawContent tacSlbLawContent) {
  32. if (StringUtils.isBlank(tacSlbLawContent.getId())) {
  33. String uuid = UuidUtil.uuid(); // 生成uuid
  34. tacSlbLawContent.setId(uuid);
  35. tacSlbLawContentService.insert(tacSlbLawContent);
  36. } else {
  37. tacSlbLawContentService.update(tacSlbLawContent);
  38. }
  39. return buildSuccessResponse(tacSlbLawContent);
  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 = tacSlbLawContentService.delete(id);
  45. return buildSuccessResponse();
  46. }
  47. @ApiOperation(value = "根据ID获取(单表)")
  48. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  49. public BaseResponse<TacSlbLawContent> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  50. TacSlbLawContent tacSlbLawContent = tacSlbLawContentService.get(id);
  51. return buildSuccessResponse(tacSlbLawContent);
  52. }
  53. @ApiOperation(value = "获取(列表所有)")
  54. @RequestMapping(value = "/list", method = RequestMethod.POST)
  55. public BaseResponse<List<TacSlbLawContent>> list(@ApiParam(name = "tacSlbLawContentParam", value = "tacSlbLawContentParam", required = true) @RequestBody TacSlbLawContentParam tacSlbLawContentParam) {
  56. List<TacSlbLawContent> tacSlbLawContentList = tacSlbLawContentService.findList(tacSlbLawContentParam);
  57. return buildSuccessResponse(tacSlbLawContentList);
  58. }
  59. @ApiOperation(value = "获取(列表--分页)")
  60. @RequestMapping(value = "/page", method = RequestMethod.POST)
  61. public BaseResponse<PageInfo<TacSlbLawContent>> page(@ApiParam(name = "tacSlbLawContentParam", value = "tacSlbLawContentParam", required = true) @RequestBody TacSlbLawContentParam tacSlbLawContentParam) {
  62. PageInfo<TacSlbLawContent> tacSlbLawContentList = tacSlbLawContentService.findPageInfo(tacSlbLawContentParam);
  63. return buildSuccessResponse(tacSlbLawContentList);
  64. }
  65. @ApiOperation(value = "获取(根据目录id获取章节)")
  66. @RequestMapping(value = "/list/{indexId}", method = RequestMethod.GET)
  67. public BaseResponse<List<TacSlbLawContent>> findChapters(@PathVariable(required = true) int indexId) {
  68. List<TacSlbLawContent> tacSlbLawIndexList = tacSlbLawContentService.findChapters(indexId);
  69. return buildSuccessResponse(tacSlbLawIndexList);
  70. }
  71. @ApiOperation(value = "获取(根据目录id,章节id(sort)获取条目)")
  72. @RequestMapping(value = "/list/{indexId}/{sort}", method = RequestMethod.GET)
  73. public BaseResponse<List<TacSlbLawContent>> findLine(@PathVariable(required = true) int indexId, @PathVariable(required = true) int sort) {
  74. TacSlbLawContentParam contentParam = new TacSlbLawContentParam();
  75. contentParam.setSort(sort);
  76. contentParam.setIndexId(indexId);
  77. List<TacSlbLawContent> tacSlbLawIndexList = tacSlbLawContentService.findList(contentParam);
  78. return buildSuccessResponse(tacSlbLawIndexList);
  79. }
  80. }