Sfoglia il codice sorgente

首页请假异常调整

zouxuan 4 anni fa
parent
commit
62ff4dbd28

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

@@ -10,6 +10,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.poi.ss.formula.functions.Index;
 import org.apache.poi.ss.formula.functions.Index;
 
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.*;
 
 
 public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData> {
 public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData> {
@@ -297,4 +298,6 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
     int countStudentLeaveCourseList(Map<String, Object> params);
     int countStudentLeaveCourseList(Map<String, Object> params);
 
 
     List<StudentLeaveCourseDto> queryStudentLeaveCourseList(Map<String, Object> params);
     List<StudentLeaveCourseDto> queryStudentLeaveCourseList(Map<String, Object> params);
+
+    List<Map<Integer, BigDecimal>> getStudentErrorLeaveNumMap(Map<String, Object> params);
 }
 }

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -876,9 +876,12 @@ public class StudentManageServiceImpl implements StudentManageService {
         List<StudentErrorLeaveDto> dataList = new ArrayList<>();
         List<StudentErrorLeaveDto> dataList = new ArrayList<>();
         if (count > 0) {
         if (count > 0) {
             //获取近两个月异常请假次数
             //获取近两个月异常请假次数
-//            indexBaseMonthDataDao.getStudentErrorLeaveNumMap(params);
+            Map<Integer,BigDecimal> leaveNumMap = MapUtil.convertIntegerMap(indexBaseMonthDataDao.getStudentErrorLeaveNumMap(params));
             pageInfo.setTotal(count);
             pageInfo.setTotal(count);
             dataList = indexBaseMonthDataDao.queryStudentErrorLeave(params);
             dataList = indexBaseMonthDataDao.queryStudentErrorLeave(params);
+            for (StudentErrorLeaveDto studentErrorLeaveDto : dataList) {
+                studentErrorLeaveDto.setTotalNum(leaveNumMap.get(studentErrorLeaveDto.getUserId()).intValue());
+            }
         }
         }
         pageInfo.setRows(dataList);
         pageInfo.setRows(dataList);
         return pageInfo;
         return pageInfo;

+ 22 - 0
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -1507,4 +1507,26 @@
 		ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
 		ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
 		<include refid="global.limit"/>
 		<include refid="global.limit"/>
 	</select>
 	</select>
+	<select id="getStudentErrorLeaveNumMap" resultType="java.util.Map">
+		SELECT user_id_ 'key',SUM(total_num_) 'value'
+		FROM (SELECT sa.user_id_,COUNT(sa.id_) total_num_
+		FROM student_attendance sa
+		LEFT JOIN course_schedule cs ON cs.id_ = sa.course_schedule_id_
+		LEFT JOIN sys_user su ON su.id_ = sa.user_id_
+		WHERE DATE_FORMAT(cs.class_date_,'%Y-%m') >= #{totalMonth} AND sa.status_ = 'LEAVE'
+		<if test="organId != null">
+			AND FIND_IN_SET(cs.organ_id_,#{organId})
+		</if>
+		<if test="classGroupIds != null and classGroupIds.size() > 0">
+			AND cs.class_group_id_ IN
+			<foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
+				#{classGroupId}
+			</foreach>
+		</if>
+		<if test="search != null and search != ''">
+			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
+		</if>
+		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) > 1 AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_) ORDER BY cs.class_date_ DESC)c
+		GROUP BY c.user_id_
+	</select>
 </mapper>
 </mapper>