SchoolController.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package com.zhongzheng.controller.user;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import lombok.RequiredArgsConstructor;
  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.zhongzheng.common.annotation.Log;
  16. import com.zhongzheng.common.core.controller.BaseController;
  17. import com.zhongzheng.common.core.domain.AjaxResult;
  18. import com.zhongzheng.common.enums.BusinessType;
  19. import com.zhongzheng.modules.user.vo.SchoolVo;
  20. import com.zhongzheng.modules.user.bo.SchoolQueryBo;
  21. import com.zhongzheng.modules.user.bo.SchoolAddBo;
  22. import com.zhongzheng.modules.user.bo.SchoolEditBo;
  23. import com.zhongzheng.modules.user.service.ISchoolService;
  24. import com.zhongzheng.common.utils.poi.ExcelUtil;
  25. import com.zhongzheng.common.core.page.TableDataInfo;
  26. import io.swagger.annotations.Api;
  27. import io.swagger.annotations.ApiOperation;
  28. /**
  29. * 高校Controller
  30. *
  31. * @author ruoyi
  32. * @date 2021-10-09
  33. */
  34. @Api(value = "高校控制器", tags = {"高校管理"})
  35. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  36. @RestController
  37. @RequestMapping("/user/school")
  38. public class SchoolController extends BaseController {
  39. private final ISchoolService iSchoolService;
  40. /**
  41. * 查询高校列表
  42. */
  43. @ApiOperation("查询高校列表")
  44. @PreAuthorize("@ss.hasPermi('user:school:list')")
  45. @GetMapping("/list")
  46. public TableDataInfo<SchoolVo> list(SchoolQueryBo bo) {
  47. startPage();
  48. List<SchoolVo> list = iSchoolService.queryList(bo);
  49. return getDataTable(list);
  50. }
  51. /**
  52. * 导出高校列表
  53. */
  54. /* @ApiOperation("导出高校列表")
  55. @PreAuthorize("@ss.hasPermi('modules.user:school:export')")
  56. @Log(title = "高校", businessType = BusinessType.EXPORT)
  57. @GetMapping("/export")
  58. public AjaxResult<SchoolVo> export(SchoolQueryBo bo) {
  59. List<SchoolVo> list = iSchoolService.queryList(bo);
  60. ExcelUtil<SchoolVo> util = new ExcelUtil<SchoolVo>(SchoolVo.class);
  61. return util.exportExcel(list, "高校");
  62. }*/
  63. /**
  64. * 获取高校详细信息
  65. */
  66. @ApiOperation("获取高校详细信息")
  67. @PreAuthorize("@ss.hasPermi('user:school:query')")
  68. @GetMapping("/{id}")
  69. public AjaxResult<SchoolVo> getInfo(@PathVariable("id" ) Long id) {
  70. return AjaxResult.success(iSchoolService.queryById(id));
  71. }
  72. /**
  73. * 新增高校
  74. */
  75. @ApiOperation("新增高校")
  76. @PreAuthorize("@ss.hasPermi('user:school:add')")
  77. @Log(title = "高校", businessType = BusinessType.INSERT)
  78. @PostMapping()
  79. public AjaxResult<Void> add(@RequestBody SchoolAddBo bo) {
  80. return toAjax(iSchoolService.insertByAddBo(bo) ? 1 : 0);
  81. }
  82. /**
  83. * 修改高校
  84. */
  85. @ApiOperation("修改高校")
  86. @PreAuthorize("@ss.hasPermi('user:school:edit')")
  87. @Log(title = "高校", businessType = BusinessType.UPDATE)
  88. @PostMapping("/edit")
  89. public AjaxResult<Void> edit(@RequestBody SchoolEditBo bo) {
  90. return toAjax(iSchoolService.updateByEditBo(bo) ? 1 : 0);
  91. }
  92. /**
  93. * 删除高校
  94. */
  95. /* @ApiOperation("删除高校")
  96. @PreAuthorize("@ss.hasPermi('modules.user:school:remove')")
  97. @Log(title = "高校" , businessType = BusinessType.DELETE)
  98. @DeleteMapping("/{ids}")
  99. public AjaxResult<Void> remove(@PathVariable Long[] ids) {
  100. return toAjax(iSchoolService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
  101. }*/
  102. }