|
@@ -1,11 +1,6 @@
|
|
|
package cn.iocoder.yudao.module.employee.controller.admin.info;
|
|
|
|
|
|
|
|
|
-import java.util.*;
|
|
|
-import java.io.IOException;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
@@ -14,7 +9,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
-import cn.iocoder.yudao.module.employee.controller.admin.info.vo.*;
|
|
|
+import cn.iocoder.yudao.module.employee.controller.admin.info.vo.EmployeeInfoPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.employee.controller.admin.info.vo.EmployeeInfoRespVO;
|
|
|
+import cn.iocoder.yudao.module.employee.controller.admin.info.vo.EmployeeInfoSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.employee.convert.info.EmployeeConvert;
|
|
|
import cn.iocoder.yudao.module.employee.dal.dataobject.info.EmployeeInfoDO;
|
|
|
import cn.iocoder.yudao.module.employee.service.info.EmployeeInfoService;
|
|
@@ -32,6 +29,11 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
@@ -84,6 +86,37 @@ public class EmployeeInfoController {
|
|
|
return success(BeanUtils.toBean(info, EmployeeInfoRespVO.class));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/getLoginEmployee")
|
|
|
+ @Operation(summary = "获得当前登录的员工信息")
|
|
|
+ // @PreAuthorize("@ss.hasPermission('employee:info:query')")
|
|
|
+ public CommonResult<EmployeeInfoRespVO> getLoginEmployee() {
|
|
|
+ // 获取当前登录员工的信息
|
|
|
+ EmployeeInfoDO info = infoService.getLoginEmployee();
|
|
|
+
|
|
|
+ // 如果部门ID不为空,则尝试获取部门详细信息
|
|
|
+ Long deptId = info.getDeptId();
|
|
|
+ if (deptId != null) {
|
|
|
+ DeptDO dept = deptService.getDept(deptId);
|
|
|
+ // 如果成功获取到部门信息,则设置部门名称到员工信息中
|
|
|
+ if (dept != null) {
|
|
|
+ info.setDeptName(dept.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果职位ID不为空,则尝试获取职位详细信息
|
|
|
+ Long postId = info.getPostId();
|
|
|
+ if (postId != null) {
|
|
|
+ PostDO post = postService.getPost(postId);
|
|
|
+ // 如果成功获取到职位信息,则设置职位名称到员工信息中
|
|
|
+ if (post != null) {
|
|
|
+ info.setPosition(post.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 将员工信息对象转换为响应视图对象,并返回成功响应
|
|
|
+ return success(BeanUtils.toBean(info, EmployeeInfoRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获得员工信息分页")
|
|
|
@PreAuthorize("@ss.hasPermission('employee:info:query')")
|