package com.zhongzheng.controller.staff; import java.util.List; import java.util.Arrays; 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.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; 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.staff.vo.StaffVo; import com.zhongzheng.modules.staff.bo.StaffQueryBo; import com.zhongzheng.modules.staff.bo.StaffAddBo; import com.zhongzheng.modules.staff.bo.StaffEditBo; import com.zhongzheng.modules.staff.service.IStaffService; 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-21 */ @Api(value = "企业部门员工控制器", tags = {"企业部门员工管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/staff") public class StaffController extends BaseController { private final IStaffService iStaffService; /** * 查询企业部门员工列表 */ @ApiOperation("查询企业部门员工列表") @PreAuthorize("@ss.hasPermi('system:staff:list')") @GetMapping("/staffList") public TableDataInfo list(StaffQueryBo bo) { startPage(); List list = iStaffService.selectStaffList(bo); return getDataTable(list); } /** * 导出企业部门员工列表 */ @ApiOperation("导出企业部门员工列表") @PreAuthorize("@ss.hasPermi('system:staff:export')") @Log(title = "企业部门员工", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(StaffQueryBo bo) { List list = iStaffService.queryList(bo); ExcelUtil util = new ExcelUtil(StaffVo.class); return util.exportExcel(list, "企业部门员工"); } /** * 获取企业部门员工详细信息 */ @ApiOperation("获取企业部门员工详细信息") @PreAuthorize("@ss.hasPermi('system:staff:query')") @GetMapping("/{staffId}") public AjaxResult getInfo(@PathVariable("staffId" ) Long staffId) { return AjaxResult.success(iStaffService.queryById(staffId)); } /** * 新增企业部门员工 */ @ApiOperation("新增企业部门员工") @PreAuthorize("@ss.hasPermi('system:staff:add')") @Log(title = "企业部门员工", businessType = BusinessType.INSERT) @PostMapping("/insertOrUpdateStaff") public AjaxResult add(@RequestBody StaffAddBo bo) { return toAjax(iStaffService.insertByAddBo(bo) ? 1 : 0); } /** * 修改企业部门员工 */ @ApiOperation("修改企业部门员工") @PreAuthorize("@ss.hasPermi('system:staff:edit')") @Log(title = "企业部门员工", businessType = BusinessType.UPDATE) @PostMapping("/updateStaffRemarks") public AjaxResult edit(@RequestBody StaffEditBo bo) { return toAjax(iStaffService.updateByEditBo(bo) ? 1 : 0); } /** * 删除企业部门员工 */ @ApiOperation("删除企业部门员工") @PreAuthorize("@ss.hasPermi('system:staff:remove')") @Log(title = "企业部门员工" , businessType = BusinessType.DELETE) @PostMapping("/deleteStaff") public AjaxResult remove(@RequestBody StaffEditBo bo ) { return toAjax(iStaffService.deleteWithValidByIds(bo)?1:0); } /** * 导入部门员工excel */ @ApiOperation("导入员工文档列表") @PreAuthorize("@ss.hasPermi('system:staff:importStaffList')") @Log(title = "部门员工" , businessType = BusinessType.DELETE) @PostMapping("/importStaffList") public AjaxResult importStaffList( MultipartFile file ) { return toAjax(iStaffService.importExcelList(file)?1:0); } }