9 天以前 8c14b50773a1e582b652c03f5a63bb2233d069b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package cn.iocoder.yudao.module.hrm.controller.admin.employee;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeWorkHistoryRespVO;
import cn.iocoder.yudao.module.hrm.dal.dataobject.employee.HrmEmployeeWorkHistoryDO;
import cn.iocoder.yudao.module.hrm.service.employee.HrmEmployeeWorkHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
@Tag(name = "管理后台 - HRM 员工工作经历")
@RestController
@RequestMapping("/hrm/employee/work-history")
@Validated
public class HrmEmployeeWorkHistoryController {
 
    @Resource
    private HrmEmployeeWorkHistoryService workHistoryService;
 
    @GetMapping("/list")
    @Operation(summary = "获取工作经历列表")
    @Parameter(name = "employeeId", description = "员工ID", required = true)
    @PreAuthorize("@ss.hasPermission('hrm:employee:query')")
    public CommonResult<List<HrmEmployeeWorkHistoryRespVO>> getWorkHistoryList(
            @RequestParam("employeeId") Long employeeId) {
        List<HrmEmployeeWorkHistoryDO> list = workHistoryService.getWorkHistoryListByEmployeeId(employeeId);
        return success(BeanUtils.toBean(list, HrmEmployeeWorkHistoryRespVO.class));
    }
 
    @DeleteMapping("/delete")
    @Operation(summary = "删除工作经历")
    @Parameter(name = "id", description = "工作经历ID", required = true)
    @PreAuthorize("@ss.hasPermission('hrm:employee:delete')")
    public CommonResult<Boolean> deleteWorkHistory(@RequestParam("id") Long id) {
        workHistoryService.deleteWorkHistory(id);
        return success(true);
    }
 
}