|
@@ -0,0 +1,82 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<!--
|
|
|
+这个文件是自动生成的。
|
|
|
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
|
|
|
+-->
|
|
|
+<mapper namespace="com.ym.mec.biz.dal.dao.TeacherCloudCourseReportDao">
|
|
|
+
|
|
|
+ <resultMap type="com.ym.mec.biz.dal.entity.TeacherCloudCourseReport" id="TeacherCloudCourseReport">
|
|
|
+ <result column="id_" property="id" />
|
|
|
+ <result column="organ_id_" property="organId" />
|
|
|
+ <result column="teacher_id_" property="teacherId" />
|
|
|
+ <result column="course_time_" property="courseTime" />
|
|
|
+ <result column="play_time_" property="playTime" />
|
|
|
+ <result column="class_date_" property="classDate" />
|
|
|
+ <result column="tenant_id_" property="tenantId" />
|
|
|
+ </resultMap>
|
|
|
+ <insert id="batchSaveBySelect">
|
|
|
+ insert into teacher_cloud_course_report (teacher_id_, organ_id_, course_time_, play_time_, class_date_, tenant_id_)
|
|
|
+ select cs.actual_teacher_id_,cs.organ_id_,cs.courseTime,CASE WHEN SUM(mcr.play_time_) IS NULL THEN 0 ELSE SUM(mcr.play_time_)/60 END playTime,cs.class_date_,cs.tenant_id_ from (
|
|
|
+ select cs.actual_teacher_id_,cs.organ_id_,SUM(TIMESTAMPDIFF(MINUTE,cs.startTime,cs.endTime)) courseTime,cs.class_date_,cs.tenant_id_,cs.startTime,cs.endTime
|
|
|
+ FROM (select cs.actual_teacher_id_,concat(cs.class_date_,' ',cs.start_class_time_) startTime,
|
|
|
+ concat(cs.class_date_,' ',cs.end_class_time_) endTime,cs.organ_id_,cs.class_date_,cs.tenant_id_,cs.id_ FROM course_schedule cs
|
|
|
+ where cs.class_date_ = #{classDate} AND cs.teach_mode_ = 'OFFLINE' AND cs.group_type_ = 'MUSIC') cs
|
|
|
+ group by cs.actual_teacher_id_,cs.class_date_) cs
|
|
|
+ left join sys_music_compare_record mcr ON mcr.client_id_ = 'teacher' AND mcr.create_time_ BETWEEN cs.startTime AND cs.endTime AND cs.actual_teacher_id_ = mcr.user_id_
|
|
|
+ group by cs.actual_teacher_id_
|
|
|
+ </insert>
|
|
|
+ <delete id="deleteByClassDate">
|
|
|
+ delete from teacher_cloud_course_report where class_date_ = #{classDate}
|
|
|
+ </delete>
|
|
|
+ <resultMap id="TeacherCloudCourseReportDto" type="com.ym.mec.biz.dal.vo.TeacherCloudCourseReportDto" extends="TeacherCloudCourseReport">
|
|
|
+ <result property="organName" column="organName"/>
|
|
|
+ <result property="teacherName" column="teacherName"/>
|
|
|
+ <result property="subjectName" column="subjectName"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="queryReport" resultMap="TeacherCloudCourseReportDto">
|
|
|
+ select tccr.teacher_id_,tccr.organ_id_,SUM(tccr.course_time_) course_time_,sum(tccr.play_time_) play_time_,tccr.class_date_,
|
|
|
+ su.real_name_ teacherName,o.name_ organName,GROUP_CONCAT(distinct sb.name_) subjectName from teacher_cloud_course_report tccr
|
|
|
+ left join sys_user su ON su.id_ = tccr.teacher_id_
|
|
|
+ left join organization o ON o.id_ = tccr.organ_id_
|
|
|
+ left join teacher t ON t.id_ = tccr.teacher_id_
|
|
|
+ left join subject sb ON FIND_IN_SET(sb.id_,t.subject_id_)
|
|
|
+ <where>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ AND tccr.class_date_ BETWEEN #{startTime} AND #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="organId != null and organId != ''">
|
|
|
+ AND FIND_IN_SET(tccr.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ AND (tccr.teacher_id_ = #{search} OR su.real_name_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ AND tccr.tenant_id_ = #{tenantId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by tccr.teacher_id_
|
|
|
+ <if test="sort != null and sort != ''">
|
|
|
+ order by ${sort} ${order}
|
|
|
+ </if>
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+ <select id="countReport" resultType="java.lang.Integer">
|
|
|
+ select COUNT(DISTINCT tccr.teacher_id_) from teacher_cloud_course_report tccr
|
|
|
+ left join sys_user su ON su.id_ = tccr.teacher_id_
|
|
|
+ <where>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ AND tccr.class_date_ BETWEEN #{startTime} AND #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="organId != null and organId != ''">
|
|
|
+ AND FIND_IN_SET(tccr.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ AND tccr.tenant_id_ = #{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ AND (tccr.teacher_id_ = #{search} OR su.real_name_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+</mapper>
|