Browse Source

员工相关修改

zhangxin 1 week ago
parent
commit
9c7c5db52f

+ 4 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppInstructorController.java

@@ -293,12 +293,12 @@ public class AppInstructorController extends JeecgController<AppInstructor, IApp
 	//@AutoLog(value = "教练表-通过id查询")
 	@Operation(summary="员工信息-通过id查询")
 	@GetMapping(value = "/queryById")
-	public Result<AppInstructor> queryById(@RequestParam(name="id",required=true) String id) {
-		AppInstructor appInstructor = appInstructorService.getById(id);
-		if(appInstructor==null) {
+	public Result<StaffVO> queryById(@RequestParam(name="id",required=true) String id) {
+		StaffVO staffVO = appInstructorService.findById(id);
+		if(staffVO==null) {
 			return Result.error("未找到对应数据");
 		}
-		return Result.OK(appInstructor);
+		return Result.OK(staffVO);
 	}
 
     /**

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppInstructorMapper.java

@@ -11,6 +11,7 @@ import org.jeecg.modules.app.vo.coach.AppCoachVO;
 import org.jeecg.modules.system.app.entity.AppInstructor;
 import org.jeecg.modules.system.app.vo.staff.StaffRequestVO;
 import org.jeecg.modules.system.app.vo.staff.StaffResponseVO;
+import org.jeecg.modules.system.app.vo.staff.StaffVO;
 
 import java.util.List;
 
@@ -40,4 +41,6 @@ public interface AppInstructorMapper extends BaseMapper<AppInstructor> {
     AppCoachDetailsVO findById(@Param("id")String id);
 
     IPage<StaffResponseVO> findPage(@Param("page") Page<AppInstructor> page,@Param("staffRequestVO") StaffRequestVO staffRequestVO,@Param("orgCode") String orgCode);
+
+    StaffVO findByStaffId(String id);
 }

+ 7 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppInstructorMapper.xml

@@ -62,7 +62,7 @@
     </select>
     <select id="findById" resultType="org.jeecg.modules.app.vo.coach.AppCoachDetailsVO">
         select a.user_id as id,b.realname,a.training_programs,a.good_rate,a.teaching_philosophy,a.excel_msg,b.avatar,
-               a.certificate_innocence,a.healthy,a.honor  from nm_instructor a left join  sys_user b on a.user_id = b.id where a.user_id = #{id}
+               b.certificate_innocence,b.healthy,b.honor  from nm_instructor a left join  sys_user b on a.user_id = b.id where a.user_id = #{id}
 
     </select>
     <select id="findPage" resultType="org.jeecg.modules.system.app.vo.staff.StaffResponseVO">
@@ -92,4 +92,10 @@
             </if>
         </if>
     </select>
+    <select id="findByStaffId" resultType="org.jeecg.modules.system.app.vo.staff.StaffVO">
+        select a.id as staffId,b.id as instructorId,a.username,b.realname,a.status,a.password,b.training_programs,b.teaching_philosophy,b.excel_msg,a.certificate_innocence,a.healthy,a.honor from from sys_user a
+        left join nm_instructor b on a.id =b.user_id and b.del_flag=0
+        where a.id=#{id} and a.del_flag=0
+    </select>
+
 </mapper>

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppInstructorService.java

@@ -6,6 +6,7 @@ import org.jeecg.modules.system.app.entity.AppInstructor;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.system.app.vo.staff.StaffRequestVO;
 import org.jeecg.modules.system.app.vo.staff.StaffResponseVO;
+import org.jeecg.modules.system.app.vo.staff.StaffVO;
 
 /**
  * @Description: 教练表
@@ -16,4 +17,6 @@ import org.jeecg.modules.system.app.vo.staff.StaffResponseVO;
 public interface IAppInstructorService extends IService<AppInstructor> {
 
     IPage<StaffResponseVO> findPage(Page<AppInstructor> page, StaffRequestVO staffRequestVO,String orgCode);
+
+    StaffVO findById(String id);
 }

+ 43 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppInstructorServiceImpl.java

@@ -2,16 +2,22 @@ package org.jeecg.modules.system.app.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
 import org.jeecg.modules.system.app.entity.AppInstructor;
 import org.jeecg.modules.system.app.mapper.AppInstructorMapper;
 import org.jeecg.modules.system.app.service.IAppInstructorService;
 import org.jeecg.modules.system.app.vo.staff.StaffRequestVO;
 import org.jeecg.modules.system.app.vo.staff.StaffResponseVO;
+import org.jeecg.modules.system.app.vo.staff.StaffVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * @Description: 教练表
  * @Author: jeecg-boot
@@ -30,4 +36,41 @@ public class AppInstructorServiceImpl extends ServiceImpl<AppInstructorMapper, A
     public IPage<StaffResponseVO> findPage(Page<AppInstructor> page, StaffRequestVO staffRequestVO,String orgCode) {
         return appInstructorMapper.findPage(page,staffRequestVO,orgCode);
     }
+
+    @Override
+    public StaffVO findById(String id) {
+        StaffVO staffVO = appInstructorMapper.findByStaffId(id);
+        //处理部门
+        List<String> selecteddeparts = new ArrayList<>();
+        List<String> trainingPrograms = new ArrayList<>();
+        List<String> honor = new ArrayList<>();
+        if (staffVO!=null){
+            if (StringUtils.isNotEmpty(staffVO.getSelecteddeparts())){
+                if (staffVO.getSelecteddeparts().contains(",")){
+                    selecteddeparts = Arrays.asList(staffVO.getSelecteddeparts().split(","));
+                }else {
+                    selecteddeparts.add(staffVO.getSelecteddeparts());
+                }
+            }
+            if (StringUtils.isNotEmpty(staffVO.getTrainingPrograms())){
+                if (staffVO.getTrainingPrograms().contains(",")){
+                    trainingPrograms = Arrays.asList(staffVO.getTrainingPrograms().split(","));
+                }else {
+                    trainingPrograms.add(staffVO.getTrainingPrograms());
+                }
+            }
+            if (StringUtils.isNotEmpty(staffVO.getHonor())){
+                if (staffVO.getHonor().contains(",")){
+                    honor = Arrays.asList(staffVO.getHonor().split(","));
+                }else {
+                    honor.add(staffVO.getHonor());
+                }
+            }
+            staffVO.setSelecteddepartsList(selecteddeparts);
+            staffVO.setTrainingProgramsList(trainingPrograms);
+            staffVO.setHonorList(honor);
+        }
+
+        return staffVO;
+    }
 }

+ 13 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/vo/staff/StaffVO.java

@@ -8,6 +8,8 @@ import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.util.List;
+
 /**
  * @author DM
  * @date 2025/7/7 17:37
@@ -41,7 +43,6 @@ public class StaffVO {
     @Schema(description = "密码")
     private String password;
 
-
     @Schema(description = "所属角色")
     private String  selectedroles;
 
@@ -75,4 +76,15 @@ public class StaffVO {
     @Excel(name = "荣誉证书多个逗号分隔", width = 15)
     @Schema(description = "荣誉证书多个逗号分隔")
     private String honor;
+
+    @Schema(description = "所属部门")
+    private List<String> selecteddepartsList;
+    /**培训项目*/
+    @Excel(name = "培训项目", width = 15)
+    @Schema(description = "培训项目,使用,分割")
+    private List<String> trainingProgramsList;
+    /**荣誉证书多个逗号分隔*/
+    @Excel(name = "荣誉证书多个逗号分隔", width = 15)
+    @Schema(description = "荣誉证书多个逗号分隔")
+    private List<String> honorList;
 }