package com.zhongzheng.controller.staff; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.zhongzheng.common.annotation.Log; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.modules.bs.staff.vo.StaffCertificateVo; import com.zhongzheng.modules.bs.staff.bo.StaffCertificateQueryBo; import com.zhongzheng.modules.bs.staff.bo.StaffCertificateAddBo; import com.zhongzheng.modules.bs.staff.bo.StaffCertificateEditBo; import com.zhongzheng.modules.bs.staff.service.IStaffCertificateService; import com.zhongzheng.common.utils.poi.ExcelUtil; import com.zhongzheng.common.core.page.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.multipart.MultipartFile; /** * 员工证书Controller * * @author ruoyi * @date 2024-03-18 */ @Api(value = "员工证书控制器", tags = {"员工证书管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/staff/certificate") public class StaffCertificateController extends BaseController { private final IStaffCertificateService iStaffCertificateService; /** * 查询员工证书列表 */ @ApiOperation("查询员工证书列表") @PreAuthorize("@ss.hasPermi('system:certificate:list')") @GetMapping("/list") public TableDataInfo list(StaffCertificateQueryBo bo) { startPage(); List list = iStaffCertificateService.queryList(bo); return getDataTable(list); } /** * 导出员工证书列表 */ @ApiOperation("导出员工证书列表") @PreAuthorize("@ss.hasPermi('system:certificate:export')") @Log(title = "员工证书", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(StaffCertificateQueryBo bo) { List list = iStaffCertificateService.queryList(bo); ExcelUtil util = new ExcelUtil(StaffCertificateVo.class); return util.exportExcel(list, "员工证书"); } /** * 获取员工证书详细信息 */ @ApiOperation("获取员工证书详细信息") @PreAuthorize("@ss.hasPermi('system:certificate:query')") @GetMapping("/{certificateId}") public AjaxResult getInfo(@PathVariable("certificateId" ) Long certificateId) { return AjaxResult.success(iStaffCertificateService.queryById(certificateId)); } /** * 新增员工证书 */ @ApiOperation("新增员工证书") @PreAuthorize("@ss.hasPermi('system:certificate:add')") @Log(title = "员工证书", businessType = BusinessType.INSERT) @PostMapping("/add") public AjaxResult add(@RequestBody StaffCertificateAddBo bo) { return toAjax(iStaffCertificateService.insertByAddBo(bo) ? 1 : 0); } /** * 修改员工证书 */ @ApiOperation("修改员工证书") @PreAuthorize("@ss.hasPermi('system:certificate:edit')") @Log(title = "员工证书", businessType = BusinessType.UPDATE) @PostMapping("/update") public AjaxResult edit(@RequestBody StaffCertificateEditBo bo) { return toAjax(iStaffCertificateService.updateByEditBo(bo) ? 1 : 0); } /** * 删除员工证书 */ @ApiOperation("删除员工证书") @PreAuthorize("@ss.hasPermi('system:certificate:remove')") @Log(title = "员工证书" , businessType = BusinessType.DELETE) @PostMapping("/delete") public AjaxResult remove(@RequestBody StaffCertificateEditBo bo) { return toAjax(iStaffCertificateService.deleteWithValidByIds(bo) ? 1 : 0); } /** * 导入部门员工证书excel */ @ApiOperation("导入员工文档列表") @PreAuthorize("@ss.hasPermi('system:staff:importStaffList')") @Log(title = "部门员工" , businessType = BusinessType.DELETE) @PostMapping("/importStaffCertificateList") public AjaxResult importStaffCertificateList( MultipartFile file ) { return toAjax(iStaffCertificateService.importStaffCertificateList(file)?1:0); } }