| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobExcelDto; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffOnJob") |
| | | @Tag(name = "员工台账") |
| | | public class StaffOnJobController { |
| | | public class StaffOnJobController extends BaseController { |
| | | |
| | | @Resource |
| | | private IStaffOnJobService staffOnJobService; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult staffOnJobListPage(Page page, StaffOnJob staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobListPage(page, staffOnJob)); |
| | | public R<?> staffOnJobListPage(Page page, StaffOnJob staffOnJob) { |
| | | return R.ok(staffOnJobService.staffOnJobListPage(page, staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult staffOnJobList(StaffOnJob staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobList(staffOnJob)); |
| | | public R<?> staffOnJobList(StaffOnJob staffOnJob) { |
| | | return R.ok(staffOnJobService.staffOnJobList(staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("") |
| | | public AjaxResult add(@RequestBody StaffOnJobDto staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.add(staffOnJob)); |
| | | public R<?> add(@RequestBody StaffOnJobDto staffOnJob) { |
| | | return R.ok(staffOnJobService.add(staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PutMapping("/{id}") |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody StaffOnJobDto staffOnJobDto) { |
| | | return AjaxResult.success(staffOnJobService.update(id, staffOnJobDto)); |
| | | public R<?> update(@PathVariable("id") Long id, @RequestBody StaffOnJobDto staffOnJobDto) { |
| | | return R.ok(staffOnJobService.update(id, staffOnJobDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delStaffOnJobs(@RequestBody List<Integer> ids) { |
| | | public R<?> delStaffOnJobs(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(staffOnJobService.delStaffOnJobs(ids)); |
| | | return R.ok(staffOnJobService.delStaffOnJobs(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult staffOnJobDetail(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobDetail(id)); |
| | | public R<?> staffOnJobDetail(@PathVariable("id") Long id) { |
| | | return R.ok(staffOnJobService.staffOnJobDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/renewContract/{id}") |
| | | public AjaxResult renewContract(@PathVariable Long id, @RequestBody StaffContract staffContract) { |
| | | return AjaxResult.success(staffOnJobService.renewContract(id, staffContract)); |
| | | public R<?> renewContract(@PathVariable Long id, @RequestBody StaffContract staffContract) { |
| | | return R.ok(staffOnJobService.renewContract(id, staffContract)); |
| | | } |
| | | |
| | | @Operation(summary = "下载模板") |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "在职员工导入", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importData(@RequestPart("file") MultipartFile file) { |
| | | public R<?> importData(@RequestPart("file") MultipartFile file) { |
| | | Boolean b = staffOnJobService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导入成功"); |
| | | return R.ok(null, "导入成功"); |
| | | } |
| | | return AjaxResult.error("导入失败"); |
| | | return R.fail("导入失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/exportCopy") |
| | | @Operation(summary = "word模板合同在职员工导出") |
| | | public AjaxResult exportCopy(HttpServletResponse response,@RequestBody StaffOnJob staffOnJob) throws Exception{ |
| | | return AjaxResult.success(staffOnJobService.exportCopy(response, staffOnJob)); |
| | | public R<?> exportCopy(HttpServletResponse response,@RequestBody StaffOnJob staffOnJob) throws Exception{ |
| | | return R.ok(staffOnJobService.exportCopy(response, staffOnJob)); |
| | | } |
| | | |
| | | |