Преглед изворни кода

[bug-8491] 新版培训修复用户有多个部门,查询数据异常问题

xiexh пре 16 часа
родитељ
комит
138080d612

+ 9 - 4
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/business/service/impl/TrainingStatisticsServiceImpl.java

@@ -65,15 +65,20 @@ public class TrainingStatisticsServiceImpl implements TrainingStatisticsService
             String employee = map.get("id_").toString();
             String sumSql = "";
             String signSql = "";
+            //当userList中某些用户有多个部门的时候,本来查的A部门,但是会实际上把其他部门的数据也统计进来,所以做这个修改
+            String deptCondition = "";
+            if (BeanUtils.isNotEmpty(deptId)){
+                deptCondition = " and bian_zhi_bu_men_='" + deptId + "'";
+            }
             if(BeanUtils.isNotEmpty(version) && "1".equals(version)){
                 //新版培训
-                sumSql = "select count(*)as planedjoin from t_lhrypxjlb where pei_xun_zhuang_ta='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'";
+                sumSql = "select count(*)as planedjoin from t_lhrypxjlb where pei_xun_zhuang_ta='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'" + deptCondition;
                 signSql = "select count(distinct guan_lian_id_) as truejoin from t_qdxxb where ren_yuan_id_ ='"+employee+"' and guan_lian_id_ " +
-                        " in(select id_ from t_lhrypxjlb where pei_xun_zhuang_ta='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'";
+                        " in(select id_ from t_lhrypxjlb where pei_xun_zhuang_ta='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'" + deptCondition;
             }else{
-                sumSql = "select count(*)as planedjoin from t_rypxcjb where shi_fou_guo_shen_='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'";
+                sumSql = "select count(*)as planedjoin from t_rypxcjb where shi_fou_guo_shen_='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'" + deptCondition;
                 signSql = "select count(distinct guan_lian_id_) as truejoin from t_qdxxb where ren_yuan_id_ ='"+employee+"' and guan_lian_id_ " +
-                        " in(select id_ from t_rypxcjb where shi_fou_guo_shen_='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'";
+                        " in(select id_ from t_rypxcjb where shi_fou_guo_shen_='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'" + deptCondition;
             }
             if (BeanUtils.isNotEmpty(startTime)){
                 sumSql = sumSql + " and date_format(pei_xun_shi_jian_,'%Y-%m-%d')>='"+startTime+"' ";