Преглед на файлове

修改导入打卡项目人员,处理人员过多sql不支持

anderx преди 1 година
родител
ревизия
4d70b8924f

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/project/mapper/ProjectTaskMapper.java

@@ -22,7 +22,7 @@ public interface ProjectTaskMapper {
 
     int updateByPrimaryKey(ProjectTask record);
 
-    void updateStaffName(Long pid);
+    String updateStaffName(Long pid);
 
     List<ProjectTaskListOut> selectList(ProjectListInput in);
 

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectTaskServiceImpl.java

@@ -165,7 +165,6 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
                     p.setId(projectTask.getId());
                     if(StringUtils.isNotBlank(p.getStaffName())) {
                         addStaffAndDelete( p);
-                        projectTaskMapper.updateStaffName(p.getId());
                     }
                     if (p.getAdminName()!=null&&!projectTask.getAdminName().equals(p.getAdminName())){
                         SysUser sysUser = userMapper.selectByNikeName(p.getAdminName(),company);
@@ -267,6 +266,8 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
         List<ProjectStaff> projectStaffs = projectStaffMapper.selectByPid(p.getId());
         deleteStaff(  split, projectStaffs);
         addStaff( p, split, projectStaffs);
+        //再从新获取统计名字
+        p.setStaffName(projectTaskMapper.updateStaffName(p.getId()));
     }
 
     private void deleteStaff(  String[] split, List<ProjectStaff> projectStaffs) {

+ 2 - 3
ruoyi-system/src/main/resources/mapper/project/ProjectTaskMapper.xml

@@ -216,9 +216,8 @@
   </update>
 
   <update id="updateStaffName">
-    update project_task a left join (select pid ,group_concat(name)name from project_staff
-      where pid = #{pid} group by  pid) b on a.id=b.pid set a.staff_name =b.name
-    where a.id = #{pid}
+    select pid ,group_concat(name)name from project_staff
+      where pid = #{pid} group by  pid
   </update>
   <update id="updateDuration">
     update project_task