浏览代码

优化首页查询

zouxuan 4 年之前
父节点
当前提交
f6f6299128

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java

@@ -158,14 +158,14 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @param organIds
      * @return
      */
-    int getAttendanceError(@Param("organIds") String organIds,@Param("startTime") String startTime);
+    int getAttendanceError(@Param("organIds") Set<Integer> organIds,@Param("startTime") String startTime);
 
     /**
      * 获取旷课考勤
      * @param organIds
      * @return
      */
-    int getNoAttendance(@Param("organIds") String organIds, @Param("startTime") String startTime);
+    int getNoAttendance(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime);
 
     /**
      * 获取老师离职申请数

+ 4 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -313,10 +313,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			three.setDesc(IndexErrorType.TEACHER_INFO.getMsg());
 			List<IndexErrInfoDto> threeChild = new ArrayList<>();
 
-			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIdsStr,startTime);
+			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE, IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE.getMsg(), attendanceError, null));
 
-			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIdsStr,startTime);
+			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, IndexErrorType.TEACHER_NOT_A_CLASS.getMsg(), noAttendance, null));
 
 //			int teacherLeave = indexBaseMonthDataDao.queryTeacherLeave(organIdsStr,startTime);
@@ -411,28 +411,16 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 				flag2 = true;
 			}
 		}
-		/*if(!flag2){
-			int attendanceInfo = indexBaseMonthDataDao.queryStudentAttendanceInfo(organIds, StudentAttendanceStatusEnum.TRUANT.getCode(),startTime);
-			if(attendanceInfo > 0){
-				flag2 = true;
-			}
-		}
-		if(!flag2){
-			int attendanceInfo1 = indexBaseMonthDataDao.queryStudentAttendanceInfo(organIds, StudentAttendanceStatusEnum.LEAVE.getCode(),startTime);
-			if(attendanceInfo1 > 0){
-				flag2 = true;
-			}
-		}*/
 		resultMap.put("studentInfo",flag2);
 		boolean flag3 = false;
 		if(!flag3){
-			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIdsStr,startTime);
+			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
 			if(attendanceError > 0){
 				flag3 = true;
 			}
 		}
 		if(!flag3){
-			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIdsStr,startTime);
+			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);
 			if(noAttendance > 0){
 				flag3 = true;
 			}

+ 10 - 4
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -716,8 +716,11 @@
 		AND cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND cs.class_date_>='2021-02-01'
 		AND (ta.sign_in_status_ != 1 OR ta.sign_out_status_ != 1 OR sa.status_ != 'NORMAL') AND ta.dispose_content_ IS NULL
 		AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
-		<if test="organIds != null and organIds != ''">
-			AND FIND_IN_SET(cs.organ_id_,#{organIds})
+		<if test="organIds!=null and organIds.size() > 0">
+			AND cs.organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
 		</if>
 		GROUP BY cs.id_) c
 	</select>
@@ -728,8 +731,11 @@
 		AND cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND cs.class_date_>='2021-02-01'
 		AND ta.sign_in_time_ IS NULL AND ta.sign_out_time_ IS NULL AND ta.dispose_content_ IS NULL
 		AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
-		<if test="organIds != null and organIds != ''">
-			AND FIND_IN_SET(cs.organ_id_,#{organIds})
+		<if test="organIds!=null and organIds.size() > 0">
+			AND cs.organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
 		</if>
 	</select>
 	<select id="queryTeacherLeave" resultType="int">