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.StaffEduBgVo; import com.zhongzheng.modules.staff.bo.StaffEduBgQueryBo; import com.zhongzheng.modules.staff.bo.StaffEduBgAddBo; import com.zhongzheng.modules.staff.bo.StaffEduBgEditBo; import com.zhongzheng.modules.staff.service.IStaffEduBgService; import com.zhongzheng.common.utils.poi.ExcelUtil; import com.zhongzheng.common.core.page.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; /** * 员工教育背景Controller * * @author ruoyi * @date 2024-03-21 */ @Api(value = "员工教育背景控制器", tags = {"员工教育背景管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/bg") public class StaffEduBgController extends BaseController { private final IStaffEduBgService iStaffEduBgService; /** * 查询员工教育背景列表 */ @ApiOperation("查询员工教育背景列表") @PreAuthorize("@ss.hasPermi('system:bg:list')") @GetMapping("/list") public TableDataInfo list(StaffEduBgQueryBo bo) { startPage(); List list = iStaffEduBgService.queryList(bo); return getDataTable(list); } /** * 导出员工教育背景列表 */ @ApiOperation("导出员工教育背景列表") @PreAuthorize("@ss.hasPermi('system:bg:export')") @Log(title = "员工教育背景", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(StaffEduBgQueryBo bo) { List list = iStaffEduBgService.queryList(bo); ExcelUtil util = new ExcelUtil(StaffEduBgVo.class); return util.exportExcel(list, "员工教育背景"); } /** * 获取员工教育背景详细信息 */ @ApiOperation("获取员工教育背景详细信息") @PreAuthorize("@ss.hasPermi('system:bg:query')") @GetMapping("/{eduBgId}") public AjaxResult getInfo(@PathVariable("eduBgId" ) Long eduBgId) { return AjaxResult.success(iStaffEduBgService.queryById(eduBgId)); } /** * 新增员工教育背景 */ @ApiOperation("新增员工教育背景") @PreAuthorize("@ss.hasPermi('system:bg:add')") @Log(title = "员工教育背景", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody StaffEduBgAddBo bo) { return toAjax(iStaffEduBgService.insertByAddBo(bo) ? 1 : 0); } /** * 修改员工教育背景 */ @ApiOperation("修改员工教育背景") @PreAuthorize("@ss.hasPermi('system:bg:edit')") @Log(title = "员工教育背景", businessType = BusinessType.UPDATE) @PutMapping() public AjaxResult edit(@RequestBody StaffEduBgEditBo bo) { return toAjax(iStaffEduBgService.updateByEditBo(bo) ? 1 : 0); } /** * 删除员工教育背景 */ @ApiOperation("删除员工教育背景") @PreAuthorize("@ss.hasPermi('system:bg:remove')") @Log(title = "员工教育背景" , businessType = BusinessType.DELETE) @DeleteMapping("/{eduBgIds}") public AjaxResult remove(@PathVariable Long[] eduBgIds) { return toAjax(iStaffEduBgService.deleteWithValidByIds(Arrays.asList(eduBgIds), true) ? 1 : 0); } }