StaffCertificateController.java 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. package com.zhongzheng.controller.staff;
  2. import java.util.List;
  3. import lombok.RequiredArgsConstructor;
  4. import org.springframework.security.access.prepost.PreAuthorize;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.PathVariable;
  9. import org.springframework.web.bind.annotation.RequestBody;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import com.zhongzheng.common.annotation.Log;
  13. import com.zhongzheng.common.core.controller.BaseController;
  14. import com.zhongzheng.common.core.domain.AjaxResult;
  15. import com.zhongzheng.common.enums.BusinessType;
  16. import com.zhongzheng.modules.bs.staff.vo.StaffCertificateVo;
  17. import com.zhongzheng.modules.bs.staff.bo.StaffCertificateQueryBo;
  18. import com.zhongzheng.modules.bs.staff.bo.StaffCertificateAddBo;
  19. import com.zhongzheng.modules.bs.staff.bo.StaffCertificateEditBo;
  20. import com.zhongzheng.modules.bs.staff.service.IStaffCertificateService;
  21. import com.zhongzheng.common.utils.poi.ExcelUtil;
  22. import com.zhongzheng.common.core.page.TableDataInfo;
  23. import io.swagger.annotations.Api;
  24. import io.swagger.annotations.ApiOperation;
  25. import org.springframework.web.multipart.MultipartFile;
  26. /**
  27. * 员工证书Controller
  28. *
  29. * @author ruoyi
  30. * @date 2024-03-18
  31. */
  32. @Api(value = "员工证书控制器", tags = {"员工证书管理"})
  33. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  34. @RestController
  35. @RequestMapping("/staff/certificate")
  36. public class StaffCertificateController extends BaseController {
  37. private final IStaffCertificateService iStaffCertificateService;
  38. /**
  39. * 查询员工证书列表
  40. */
  41. @ApiOperation("查询员工证书列表")
  42. @PreAuthorize("@ss.hasPermi('system:certificate:list')")
  43. @GetMapping("/list")
  44. public TableDataInfo<StaffCertificateVo> list(StaffCertificateQueryBo bo) {
  45. startPage();
  46. List<StaffCertificateVo> list = iStaffCertificateService.queryList(bo);
  47. return getDataTable(list);
  48. }
  49. /**
  50. * 导出员工证书列表
  51. */
  52. @ApiOperation("导出员工证书列表")
  53. @PreAuthorize("@ss.hasPermi('system:certificate:export')")
  54. @Log(title = "员工证书", businessType = BusinessType.EXPORT)
  55. @GetMapping("/export")
  56. public AjaxResult<StaffCertificateVo> export(StaffCertificateQueryBo bo) {
  57. List<StaffCertificateVo> list = iStaffCertificateService.queryList(bo);
  58. ExcelUtil<StaffCertificateVo> util = new ExcelUtil<StaffCertificateVo>(StaffCertificateVo.class);
  59. return util.exportExcel(list, "员工证书");
  60. }
  61. /**
  62. * 获取员工证书详细信息
  63. */
  64. @ApiOperation("获取员工证书详细信息")
  65. @PreAuthorize("@ss.hasPermi('system:certificate:query')")
  66. @GetMapping("/{certificateId}")
  67. public AjaxResult<StaffCertificateVo> getInfo(@PathVariable("certificateId" ) Long certificateId) {
  68. return AjaxResult.success(iStaffCertificateService.queryById(certificateId));
  69. }
  70. /**
  71. * 新增员工证书
  72. */
  73. @ApiOperation("新增员工证书")
  74. @PreAuthorize("@ss.hasPermi('system:certificate:add')")
  75. @Log(title = "员工证书", businessType = BusinessType.INSERT)
  76. @PostMapping("/add")
  77. public AjaxResult<Void> add(@RequestBody StaffCertificateAddBo bo) {
  78. return toAjax(iStaffCertificateService.insertByAddBo(bo) ? 1 : 0);
  79. }
  80. /**
  81. * 修改员工证书
  82. */
  83. @ApiOperation("修改员工证书")
  84. @PreAuthorize("@ss.hasPermi('system:certificate:edit')")
  85. @Log(title = "员工证书", businessType = BusinessType.UPDATE)
  86. @PostMapping("/update")
  87. public AjaxResult<Void> edit(@RequestBody StaffCertificateEditBo bo) {
  88. return toAjax(iStaffCertificateService.updateByEditBo(bo) ? 1 : 0);
  89. }
  90. /**
  91. * 删除员工证书
  92. */
  93. @ApiOperation("删除员工证书")
  94. @PreAuthorize("@ss.hasPermi('system:certificate:remove')")
  95. @Log(title = "员工证书" , businessType = BusinessType.DELETE)
  96. @PostMapping("/delete")
  97. public AjaxResult<Void> remove(@RequestBody StaffCertificateEditBo bo) {
  98. return toAjax(iStaffCertificateService.deleteWithValidByIds(bo) ? 1 : 0);
  99. }
  100. /**
  101. * 导入部门员工证书excel
  102. */
  103. @ApiOperation("导入员工文档列表")
  104. @PreAuthorize("@ss.hasPermi('system:staff:importStaffList')")
  105. @Log(title = "部门员工" , businessType = BusinessType.DELETE)
  106. @PostMapping("/importStaffCertificateList")
  107. public AjaxResult<Void> importStaffCertificateList( MultipartFile file ) {
  108. return toAjax(iStaffCertificateService.importStaffCertificateList(file)?1:0);
  109. }
  110. }