| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- 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<StaffCertificateVo> list(StaffCertificateQueryBo bo) {
- startPage();
- List<StaffCertificateVo> list = iStaffCertificateService.queryList(bo);
- return getDataTable(list);
- }
- /**
- * 导出员工证书列表
- */
- @ApiOperation("导出员工证书列表")
- @PreAuthorize("@ss.hasPermi('system:certificate:export')")
- @Log(title = "员工证书", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult<StaffCertificateVo> export(StaffCertificateQueryBo bo) {
- List<StaffCertificateVo> list = iStaffCertificateService.queryList(bo);
- ExcelUtil<StaffCertificateVo> util = new ExcelUtil<StaffCertificateVo>(StaffCertificateVo.class);
- return util.exportExcel(list, "员工证书");
- }
- /**
- * 获取员工证书详细信息
- */
- @ApiOperation("获取员工证书详细信息")
- @PreAuthorize("@ss.hasPermi('system:certificate:query')")
- @GetMapping("/{certificateId}")
- public AjaxResult<StaffCertificateVo> 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<Void> 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<Void> 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<Void> 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<Void> importStaffCertificateList( MultipartFile file ) {
- return toAjax(iStaffCertificateService.importStaffCertificateList(file)?1:0);
- }
- }
|