QuestionChapterController.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. package com.zhongzheng.controller.bank;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import com.zhongzheng.modules.bank.bo.*;
  5. import com.zhongzheng.modules.bank.domain.QuestionBusiness;
  6. import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
  7. import com.zhongzheng.modules.bank.service.IQuestionChapterService;
  8. import com.zhongzheng.modules.bank.vo.ExamQuestionVo;
  9. import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
  10. import lombok.RequiredArgsConstructor;
  11. import org.springframework.security.access.prepost.PreAuthorize;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.GetMapping;
  14. import org.springframework.web.bind.annotation.PostMapping;
  15. import org.springframework.web.bind.annotation.PutMapping;
  16. import org.springframework.web.bind.annotation.DeleteMapping;
  17. import org.springframework.web.bind.annotation.PathVariable;
  18. import org.springframework.web.bind.annotation.RequestBody;
  19. import org.springframework.web.bind.annotation.RequestMapping;
  20. import org.springframework.web.bind.annotation.RestController;
  21. import com.zhongzheng.common.annotation.Log;
  22. import com.zhongzheng.common.core.controller.BaseController;
  23. import com.zhongzheng.common.core.domain.AjaxResult;
  24. import com.zhongzheng.common.enums.BusinessType;
  25. import com.zhongzheng.common.utils.poi.ExcelUtil;
  26. import com.zhongzheng.common.core.page.TableDataInfo;
  27. import io.swagger.annotations.Api;
  28. import io.swagger.annotations.ApiOperation;
  29. /**
  30. * 章卷Controller
  31. *
  32. * @author hjl
  33. * @date 2021-10-25
  34. */
  35. @Api(value = "章卷控制器", tags = {"章卷管理"})
  36. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  37. @RestController
  38. @RequestMapping("/bank/chapter")
  39. public class QuestionChapterController extends BaseController {
  40. private final IQuestionChapterService iQuestionChapterService;
  41. private final IQuestionBusinessService iQuestionBusinessService;
  42. /**
  43. * 查询章卷列表
  44. */
  45. @ApiOperation("查询章卷列表")
  46. @PreAuthorize("@ss.hasPermi('system:chapter:list')")
  47. @GetMapping("/list")
  48. public TableDataInfo<QuestionChapterVo> list(QuestionChapterQueryBo bo) {
  49. startPage();
  50. List<QuestionChapterVo> list = iQuestionChapterService.queryList(bo);
  51. return getDataTable(list);
  52. }
  53. /**
  54. * 导出章卷列表
  55. */
  56. /* @ApiOperation("导出章卷列表")
  57. @PreAuthorize("@ss.hasPermi('system:chapter:export')")
  58. @Log(title = "章卷", businessType = BusinessType.EXPORT)
  59. @GetMapping("/export")
  60. public AjaxResult<QuestionChapterVo> export(QuestionChapterQueryBo bo) {
  61. List<QuestionChapterVo> list = iQuestionChapterService.queryList(bo);
  62. ExcelUtil<QuestionChapterVo> util = new ExcelUtil<QuestionChapterVo>(QuestionChapterVo.class);
  63. return util.exportExcel(list, "章卷");
  64. }*/
  65. /**
  66. * 获取章卷详细信息
  67. */
  68. @ApiOperation("获取章卷详细信息")
  69. @PreAuthorize("@ss.hasPermi('system:chapter:query')")
  70. @GetMapping("/{chapterExamId}")
  71. public AjaxResult<QuestionChapterVo> getInfo(@PathVariable("chapterExamId" ) Long chapterExamId) {
  72. return AjaxResult.success(iQuestionChapterService.queryById(chapterExamId));
  73. }
  74. /**
  75. * 新增章卷
  76. */
  77. @ApiOperation("新增章卷")
  78. @PreAuthorize("@ss.hasPermi('system:chapter:add')")
  79. @Log(title = "章卷", businessType = BusinessType.INSERT)
  80. @PostMapping()
  81. public AjaxResult<Void> add(@RequestBody QuestionChapterAddBo bo) {
  82. return toAjax(iQuestionChapterService.insertByAddBo(bo) ? 1 : 0);
  83. }
  84. /**
  85. * 修改章卷
  86. */
  87. @ApiOperation("修改章卷")
  88. @PreAuthorize("@ss.hasPermi('system:chapter:edit')")
  89. @Log(title = "章卷", businessType = BusinessType.UPDATE)
  90. @PostMapping("/edit")
  91. public AjaxResult<Void> edit(@RequestBody QuestionChapterEditBo bo) {
  92. return toAjax(iQuestionChapterService.updateByEditBo(bo) ? 1 : 0);
  93. }
  94. /**
  95. * 删除章卷
  96. */
  97. /*@ApiOperation("删除章卷")
  98. @PreAuthorize("@ss.hasPermi('system:chapter:remove')")
  99. @Log(title = "章卷" , businessType = BusinessType.DELETE)
  100. @DeleteMapping("/{chapterExamIds}")
  101. public AjaxResult<Void> remove(@PathVariable Long[] chapterExamIds) {
  102. return toAjax(iQuestionChapterService.deleteWithValidByIds(Arrays.asList(chapterExamIds), true) ? 1 : 0);
  103. }*/
  104. /**
  105. * 查询题目业务层次关系列表
  106. */
  107. @ApiOperation("查询业务层次关系列表")
  108. @PreAuthorize("@ss.hasPermi('system:business:list')")
  109. @GetMapping("/business/list")
  110. public TableDataInfo<QuestionBusiness> businessList(QuestionBusinessQueryBo bo) {
  111. startPage();
  112. bo.setType(QuestionBusiness.TYPE_QUESTION_CHAPTER);
  113. List<QuestionBusiness> list = iQuestionBusinessService.getListById(bo);
  114. return getDataTable(list);
  115. }
  116. }