MockApplyController.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package com.zhongzheng.controller.mock;
  2. import com.zhongzheng.common.annotation.Log;
  3. import com.zhongzheng.common.core.controller.BaseController;
  4. import com.zhongzheng.common.core.domain.AjaxResult;
  5. import com.zhongzheng.common.core.page.TableDataInfo;
  6. import com.zhongzheng.common.enums.BusinessType;
  7. import com.zhongzheng.common.utils.poi.ExcelUtil;
  8. import com.zhongzheng.modules.mock.bo.MockApplyAddBo;
  9. import com.zhongzheng.modules.mock.bo.MockApplyEditBo;
  10. import com.zhongzheng.modules.mock.bo.MockApplyQueryBo;
  11. import com.zhongzheng.modules.mock.service.IMockApplyService;
  12. import com.zhongzheng.modules.mock.vo.MockApplyVo;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiOperation;
  15. import lombok.RequiredArgsConstructor;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.security.access.prepost.PreAuthorize;
  18. import org.springframework.web.bind.annotation.*;
  19. import java.util.Arrays;
  20. import java.util.List;
  21. /**
  22. * 模考安排Controller
  23. *
  24. * @author ruoyi
  25. * @date 2022-05-24
  26. */
  27. @Api(value = "模考安排控制器", tags = {"模考安排管理"})
  28. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  29. @RestController
  30. @RequestMapping("/mock/apply")
  31. public class MockApplyController extends BaseController {
  32. private final IMockApplyService iMockApplyService;
  33. /**
  34. * 查询模考安排列表
  35. */
  36. @ApiOperation("查询模考安排列表")
  37. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  38. @GetMapping("/list")
  39. public TableDataInfo<MockApplyVo> list(MockApplyQueryBo bo) {
  40. startPage();
  41. List<MockApplyVo> list = iMockApplyService.queryList(bo);
  42. return getDataTable(list);
  43. }
  44. /**
  45. * 导出模考安排列表
  46. */
  47. @ApiOperation("导出模考安排列表")
  48. @PreAuthorize("@ss.hasPermi('system:apply:export')")
  49. @Log(title = "模考安排", businessType = BusinessType.EXPORT)
  50. @GetMapping("/export")
  51. public AjaxResult<MockApplyVo> export(MockApplyQueryBo bo) {
  52. List<MockApplyVo> list = iMockApplyService.queryList(bo);
  53. ExcelUtil<MockApplyVo> util = new ExcelUtil<MockApplyVo>(MockApplyVo.class);
  54. return util.exportExcel(list, "模考安排");
  55. }
  56. /**
  57. * 获取模考安排详细信息
  58. */
  59. @ApiOperation("获取模考安排详细信息")
  60. @PreAuthorize("@ss.hasPermi('system:apply:query')")
  61. @GetMapping("/{applyId}")
  62. public AjaxResult<MockApplyVo> getInfo(@PathVariable("applyId" ) Long applyId) {
  63. return AjaxResult.success(iMockApplyService.queryById(applyId));
  64. }
  65. /**
  66. * 新增模考安排
  67. */
  68. @ApiOperation("新增模考安排")
  69. @PreAuthorize("@ss.hasPermi('system:apply:add')")
  70. @Log(title = "模考安排", businessType = BusinessType.INSERT)
  71. @PostMapping()
  72. public AjaxResult<Void> add(@RequestBody MockApplyAddBo bo) {
  73. return toAjax(iMockApplyService.insertByAddBo(bo) ? 1 : 0);
  74. }
  75. /**
  76. * 修改模考安排
  77. */
  78. @ApiOperation("修改模考安排")
  79. @PreAuthorize("@ss.hasPermi('system:apply:edit')")
  80. @Log(title = "模考安排", businessType = BusinessType.UPDATE)
  81. @PutMapping()
  82. public AjaxResult<Void> edit(@RequestBody MockApplyEditBo bo) {
  83. return toAjax(iMockApplyService.updateByEditBo(bo) ? 1 : 0);
  84. }
  85. /**
  86. * 删除模考安排
  87. */
  88. @ApiOperation("删除模考安排")
  89. @PreAuthorize("@ss.hasPermi('system:apply:remove')")
  90. @Log(title = "模考安排" , businessType = BusinessType.DELETE)
  91. @DeleteMapping("/{applyIds}")
  92. public AjaxResult<Void> remove(@PathVariable Long[] applyIds) {
  93. return toAjax(iMockApplyService.deleteWithValidByIds(Arrays.asList(applyIds), true) ? 1 : 0);
  94. }
  95. /**
  96. * 查询模考安排列表
  97. */
  98. @ApiOperation("查询模考安排列表")
  99. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  100. @GetMapping("/listApply")
  101. public TableDataInfo<MockApplyVo> listApply(MockApplyQueryBo bo) {
  102. startPage();
  103. List<MockApplyVo> list = iMockApplyService.listApply(bo);
  104. return getDataTable(list);
  105. }
  106. }