Browse Source

教师考勤查询

dzx 4 months ago
parent
commit
9d3b3457b5

+ 11 - 0
src/main/resources/mapper/attendance/TeacherAttendanceRecordMapper.xml

@@ -7,6 +7,11 @@
         SELECT t2.name AS teacher_name,t2.mobile,t1.attendance_status AS STATUS,t1.record_time,
         replace(replace(t1.attendance_mode,1, '人脸'),2,'车辆') as attendance_mode,t1.car_number,t1.user_id FROM teacher_attendance_record t1
         INNER JOIN xjr_user t2 ON t1.user_id = t2.id
+        <if test="dto.deptId != null">
+            inner join xjr_user_dept_relation t3 on t2.id = t3.user_id
+            and t3.dept_id = #{dto.deptId}
+        </if>
+
         WHERE t1.delete_mark = 0
         AND DATE_FORMAT(t1.attendance_date,'%Y-%m-%d') = #{dto.date}
         AND t1.time_interval = #{dto.timePeriod}
@@ -27,6 +32,11 @@
         SELECT t2.name AS teacher_name,t2.mobile,t1.attendance_status AS STATUS,t1.record_time,
         replace(replace(t1.attendance_mode,1, '人脸'),2,'车辆') as attendance_mode,t1.car_number,t1.user_id FROM teacher_attendance_record t1
         INNER JOIN xjr_user t2 ON t1.user_id = t2.id
+        <if test="dto.deptId != null">
+            inner join xjr_user_dept_relation t3 on t2.id = t3.user_id
+            and t3.dept_id = #{dto.deptId}
+        </if>
+
         WHERE t1.delete_mark = 0
         AND DATE_FORMAT(t1.attendance_date,'%Y-%m-%d') = #{dto.date}
         AND t1.time_interval = #{dto.timePeriod}
@@ -42,5 +52,6 @@
         <if test="dto.attendanceMode != null and dto.attendanceMode != ''">
             and t1.attendance_mode like concat('%', #{dto.attendanceMode},'%')
         </if>
+
     </select>
 </mapper>