liyong
2026-07-10 80ddf4c9c0bcb0f6c31524e0d9f5599c8001e904
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.HrmEmployeeEmergencyContactRespVO;
import cn.iocoder.yudao.module.hrm.dal.dataobject.employee.HrmEmployeeEmergencyContactDO;
import cn.iocoder.yudao.module.hrm.service.employee.HrmEmployeeEmergencyContactService;
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/emergency-contact")
@Validated
public class HrmEmployeeEmergencyContactController {
 
    @Resource
    private HrmEmployeeEmergencyContactService emergencyContactService;
 
    @GetMapping("/list")
    @Operation(summary = "获取紧急联系人列表")
    @Parameter(name = "employeeId", description = "员工ID", required = true)
    @PreAuthorize("@ss.hasPermission('hrm:employee:query')")
    public CommonResult<List<HrmEmployeeEmergencyContactRespVO>> getEmergencyContactList(
            @RequestParam("employeeId") Long employeeId) {
        List<HrmEmployeeEmergencyContactDO> list = emergencyContactService.getEmergencyContactListByEmployeeId(employeeId);
        return success(BeanUtils.toBean(list, HrmEmployeeEmergencyContactRespVO.class));
    }
 
    @DeleteMapping("/delete")
    @Operation(summary = "删除紧急联系人")
    @Parameter(name = "id", description = "紧急联系人ID", required = true)
    @PreAuthorize("@ss.hasPermission('hrm:employee:delete')")
    public CommonResult<Boolean> deleteEmergencyContact(@RequestParam("id") Long id) {
        emergencyContactService.deleteEmergencyContact(id);
        return success(true);
    }
 
}