StaffManageController.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package com.ruoyi.web.controller.staffManage;
  2. import com.ruoyi.common.annotation.Log;
  3. import com.ruoyi.common.core.controller.BaseController;
  4. import com.ruoyi.common.core.domain.AjaxResult;
  5. import com.ruoyi.common.core.page.TableDataInfo;
  6. import com.ruoyi.common.enums.BusinessType;
  7. import com.ruoyi.common.utils.poi.ExcelUtil;
  8. import com.ruoyi.common.core.domain.entity.StaffManage;
  9. import com.ruoyi.system.service.IStaffManageService;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.security.access.prepost.PreAuthorize;
  12. import org.springframework.web.bind.annotation.*;
  13. import javax.servlet.http.HttpServletResponse;
  14. import java.util.List;
  15. /**
  16. * 员工管理Controller
  17. *
  18. * @author boman
  19. * @date 2025-02-18
  20. */
  21. @RestController
  22. @RequestMapping("/wuYe/staffManage")
  23. public class StaffManageController extends BaseController {
  24. @Autowired
  25. private IStaffManageService staffManageService;
  26. /**
  27. * 查询员工管理列表
  28. */
  29. @PreAuthorize("@ss.hasPermi('wuYe:staffManage:list')")
  30. @GetMapping("/list")
  31. public TableDataInfo list(StaffManage staffManage) {
  32. startPage();
  33. List<StaffManage> list = staffManageService.selectStaffManageList(staffManage);
  34. return getDataTable(list);
  35. }
  36. /**
  37. * 查询员工管理列表不分页
  38. */
  39. @PreAuthorize("@ss.hasPermi('wuYe:staffManage:listNoPage')")
  40. @GetMapping("/listNoPage")
  41. public TableDataInfo listNoPage(StaffManage staffManage) {
  42. List<StaffManage> list = staffManageService.selectStaffManageList(staffManage);
  43. return getDataTable(list);
  44. }
  45. /**
  46. * 导出员工管理列表
  47. */
  48. @PreAuthorize("@ss.hasPermi('wuYe:staffManage:export')")
  49. @Log(title = "员工管理", businessType = BusinessType.EXPORT)
  50. @PostMapping("/export")
  51. public void export(HttpServletResponse response, StaffManage staffManage) {
  52. List<StaffManage> list = staffManageService.selectStaffManageList(staffManage);
  53. ExcelUtil<StaffManage> util = new ExcelUtil<StaffManage>(StaffManage.class);
  54. util.exportExcel(response, list, "员工管理数据");
  55. }
  56. /**
  57. * 获取员工管理详细信息
  58. */
  59. @PreAuthorize("@ss.hasPermi('wuYe:staffManage:query')")
  60. @GetMapping(value = "/{staffId}")
  61. public AjaxResult getInfo(@PathVariable("staffId") Long staffId) {
  62. return success(staffManageService.selectStaffManageByStaffId(staffId));
  63. }
  64. /**
  65. * 新增员工管理
  66. */
  67. @PreAuthorize("@ss.hasPermi('wuYe:staffManage:add')")
  68. @Log(title = "员工管理", businessType = BusinessType.INSERT)
  69. @PostMapping
  70. public AjaxResult add(@RequestBody StaffManage staffManage) {
  71. return toAjax(staffManageService.insertStaffManage(staffManage));
  72. }
  73. /**
  74. * 修改员工管理
  75. */
  76. @PreAuthorize("@ss.hasPermi('wuYe:staffManage:edit')")
  77. @Log(title = "员工管理", businessType = BusinessType.UPDATE)
  78. @PostMapping("/put")
  79. public AjaxResult edit(@RequestBody StaffManage staffManage) {
  80. return toAjax(staffManageService.updateStaffManage(staffManage));
  81. }
  82. /**
  83. * 删除员工管理
  84. */
  85. @PreAuthorize("@ss.hasPermi('wuYe:staffManage:remove')")
  86. @Log(title = "员工管理", businessType = BusinessType.DELETE)
  87. @GetMapping("/delete/{staffIds}")
  88. public AjaxResult remove(@PathVariable Long[] staffIds) {
  89. getUsername();
  90. return toAjax(staffManageService.deleteStaffManageByStaffIds(staffIds));
  91. }
  92. }