GradTableController.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package com.ruoyi.system.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import com.ruoyi.system.domain.dto.QueryEntity;
  5. import org.springframework.security.access.prepost.PreAuthorize;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.PutMapping;
  10. import org.springframework.web.bind.annotation.DeleteMapping;
  11. import org.springframework.web.bind.annotation.PathVariable;
  12. import org.springframework.web.bind.annotation.RequestBody;
  13. import org.springframework.web.bind.annotation.RequestMapping;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import com.ruoyi.common.annotation.Log;
  16. import com.ruoyi.common.core.controller.BaseController;
  17. import com.ruoyi.common.core.domain.AjaxResult;
  18. import com.ruoyi.common.enums.BusinessType;
  19. import com.ruoyi.system.domain.GradTable;
  20. import com.ruoyi.system.service.IGradTableService;
  21. import com.ruoyi.common.utils.poi.ExcelUtil;
  22. import com.ruoyi.common.core.page.TableDataInfo;
  23. /**
  24. * A类证书Controller
  25. *
  26. * @author ruoyi
  27. * @date 2022-12-05
  28. */
  29. @RestController
  30. @RequestMapping("/system/grad")
  31. public class GradTableController extends BaseController
  32. {
  33. @Autowired
  34. private IGradTableService gradTableService;
  35. /**
  36. * 查询A类证书列表
  37. */
  38. @PreAuthorize("@ss.hasPermi('system:grad:list')")
  39. @GetMapping("/list")
  40. public TableDataInfo list(GradTable gradTable)
  41. {
  42. startPage();
  43. List<GradTable> list = gradTableService.selectGradTableList(gradTable);
  44. return getDataTable(list);
  45. }
  46. /**
  47. * 导出A类证书列表
  48. */
  49. @PreAuthorize("@ss.hasPermi('system:grad:export')")
  50. @Log(title = "A类证书", businessType = BusinessType.EXPORT)
  51. @PostMapping("/export")
  52. public void export(HttpServletResponse response, GradTable gradTable)
  53. {
  54. List<GradTable> list = gradTableService.selectGradTableList(gradTable);
  55. ExcelUtil<GradTable> util = new ExcelUtil<GradTable>(GradTable.class);
  56. util.exportExcel(response, list, "A类证书数据");
  57. }
  58. /**
  59. * 获取A类证书详细信息
  60. */
  61. @PreAuthorize("@ss.hasPermi('system:grad:query')")
  62. @GetMapping(value = "/{id}")
  63. public AjaxResult getInfo(@PathVariable("id") Integer id)
  64. {
  65. return success(gradTableService.selectGradTableById(id));
  66. }
  67. @PostMapping("/getInfoByCode")
  68. public AjaxResult getInfoByCode(@RequestBody QueryEntity queryEntity)
  69. {
  70. return success(gradTableService.selectContractTableByQuery(queryEntity));
  71. }
  72. /**
  73. * 新增A类证书
  74. */
  75. @PreAuthorize("@ss.hasPermi('system:grad:add')")
  76. @Log(title = "A类证书", businessType = BusinessType.INSERT)
  77. @PostMapping
  78. public AjaxResult add(@RequestBody GradTable gradTable)
  79. {
  80. return toAjax(gradTableService.insertGradTable(gradTable));
  81. }
  82. /**
  83. * 修改A类证书
  84. */
  85. @PreAuthorize("@ss.hasPermi('system:grad:edit')")
  86. @Log(title = "A类证书", businessType = BusinessType.UPDATE)
  87. @PutMapping
  88. public AjaxResult edit(@RequestBody GradTable gradTable)
  89. {
  90. return toAjax(gradTableService.updateGradTable(gradTable));
  91. }
  92. /**
  93. * 删除A类证书
  94. */
  95. @PreAuthorize("@ss.hasPermi('system:grad:remove')")
  96. @Log(title = "A类证书", businessType = BusinessType.DELETE)
  97. @DeleteMapping("/{ids}")
  98. public AjaxResult remove(@PathVariable Integer[] ids)
  99. {
  100. return toAjax(gradTableService.deleteGradTableByIds(ids));
  101. }
  102. }