| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- 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<StaffVo> list(StaffQueryBo bo) {
- startPage();
- List<StaffVo> list = iStaffService.selectStaffList(bo);
- return getDataTable(list);
- }
- /**
- * 导出企业部门员工列表
- */
- @ApiOperation("导出企业部门员工列表")
- @PreAuthorize("@ss.hasPermi('system:staff:export')")
- @Log(title = "企业部门员工", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult<StaffVo> export(StaffQueryBo bo) {
- List<StaffVo> list = iStaffService.queryList(bo);
- ExcelUtil<StaffVo> util = new ExcelUtil<StaffVo>(StaffVo.class);
- return util.exportExcel(list, "企业部门员工");
- }
- /**
- * 获取企业部门员工详细信息
- */
- @ApiOperation("获取企业部门员工详细信息")
- @PreAuthorize("@ss.hasPermi('system:staff:query')")
- @GetMapping("/{staffId}")
- public AjaxResult<StaffVo> 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<Void> 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<Void> 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<Void> 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<Void> importStaffList( MultipartFile file ) {
- return toAjax(iStaffService.importExcelList(file)?1:0);
- }
- }
|