|
@@ -5,7 +5,7 @@
|
|
不要修改此文件。所有改动将在下次重新自动生成时丢失。
|
|
不要修改此文件。所有改动将在下次重新自动生成时丢失。
|
|
-->
|
|
-->
|
|
<mapper namespace="com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao">
|
|
<mapper namespace="com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao">
|
|
-
|
|
|
|
|
|
+
|
|
<resultMap type="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" id="StudentExtracurricularExercisesSituation">
|
|
<resultMap type="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" id="StudentExtracurricularExercisesSituation">
|
|
<result column="id_" property="id" />
|
|
<result column="id_" property="id" />
|
|
<result column="student_id_" property="studentId" />
|
|
<result column="student_id_" property="studentId" />
|
|
@@ -30,17 +30,17 @@
|
|
<result column="organ_name_" property="organName"/>
|
|
<result column="organ_name_" property="organName"/>
|
|
<result column="exist_vip_course_" property="existVipCourse"/>
|
|
<result column="exist_vip_course_" property="existVipCourse"/>
|
|
</resultMap>
|
|
</resultMap>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 根据主键查询一条记录 -->
|
|
<!-- 根据主键查询一条记录 -->
|
|
<select id="get" resultMap="StudentExtracurricularExercisesSituation" >
|
|
<select id="get" resultMap="StudentExtracurricularExercisesSituation" >
|
|
SELECT * FROM student_extracurricular_exercises_situation_ WHERE id_ = #{id}
|
|
SELECT * FROM student_extracurricular_exercises_situation_ WHERE id_ = #{id}
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 全查询 -->
|
|
<!-- 全查询 -->
|
|
<select id="findAll" resultMap="StudentExtracurricularExercisesSituation">
|
|
<select id="findAll" resultMap="StudentExtracurricularExercisesSituation">
|
|
SELECT * FROM student_extracurricular_exercises_situation_ ORDER BY id_
|
|
SELECT * FROM student_extracurricular_exercises_situation_ ORDER BY id_
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 向数据库增加一条记录 -->
|
|
<!-- 向数据库增加一条记录 -->
|
|
<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
<!--
|
|
<!--
|
|
@@ -52,7 +52,7 @@
|
|
VALUES(#{id},#{studentId},#{weekOfYear},#{monday},#{sunday},#{teacherId},#{expectExercisesNum},#{actualExercisesNum},#{exercisesReplyNum},#{exercisesMessageNum},#{exercisesMessageTimelyNum},NOW(),NOW(),#{lastSubmitTime},#{serveType})
|
|
VALUES(#{id},#{studentId},#{weekOfYear},#{monday},#{sunday},#{teacherId},#{expectExercisesNum},#{actualExercisesNum},#{exercisesReplyNum},#{exercisesMessageNum},#{exercisesMessageTimelyNum},NOW(),NOW(),#{lastSubmitTime},#{serveType})
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
- <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
|
|
|
+ <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
INSERT INTO student_extracurricular_exercises_situation_ (student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,actual_exercises_num_,exercises_reply_num_,exercises_message_num_,exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,serve_type_)
|
|
INSERT INTO student_extracurricular_exercises_situation_ (student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,actual_exercises_num_,exercises_reply_num_,exercises_message_num_,exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,serve_type_)
|
|
VALUES
|
|
VALUES
|
|
<foreach collection="situations" item="situation" separator=",">
|
|
<foreach collection="situations" item="situation" separator=",">
|
|
@@ -60,7 +60,7 @@
|
|
</foreach>
|
|
</foreach>
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation">
|
|
<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation">
|
|
UPDATE student_extracurricular_exercises_situation_
|
|
UPDATE student_extracurricular_exercises_situation_
|
|
<set>
|
|
<set>
|
|
@@ -109,7 +109,7 @@
|
|
update_time_ = #{updateTime}
|
|
update_time_ = #{updateTime}
|
|
</set> WHERE id_ = #{id}
|
|
</set> WHERE id_ = #{id}
|
|
</update>
|
|
</update>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 根据主键删除一条记录 -->
|
|
<!-- 根据主键删除一条记录 -->
|
|
<delete id="delete" >
|
|
<delete id="delete" >
|
|
DELETE FROM student_extracurricular_exercises_situation_ WHERE id_ = #{id}
|
|
DELETE FROM student_extracurricular_exercises_situation_ WHERE id_ = #{id}
|
|
@@ -117,15 +117,15 @@
|
|
<delete id="deleteByMonday">
|
|
<delete id="deleteByMonday">
|
|
DELETE FROM student_extracurricular_exercises_situation_ WHERE monday_ = #{monday}
|
|
DELETE FROM student_extracurricular_exercises_situation_ WHERE monday_ = #{monday}
|
|
</delete>
|
|
</delete>
|
|
- <delete id="deleteByStudent">
|
|
|
|
|
|
+ <delete id="deleteByStudent">
|
|
DELETE FROM student_extracurricular_exercises_situation_ WHERE student_id_ = #{studentId}
|
|
DELETE FROM student_extracurricular_exercises_situation_ WHERE student_id_ = #{studentId}
|
|
</delete>
|
|
</delete>
|
|
|
|
|
|
- <!-- 分页查询 -->
|
|
|
|
|
|
+ <!-- 分页查询 -->
|
|
<select id="queryPage" resultMap="StudentExtracurricularExercisesSituation" parameterType="map">
|
|
<select id="queryPage" resultMap="StudentExtracurricularExercisesSituation" parameterType="map">
|
|
SELECT * FROM student_extracurricular_exercises_situation_ ORDER BY id_ <include refid="global.limit"/>
|
|
SELECT * FROM student_extracurricular_exercises_situation_ ORDER BY id_ <include refid="global.limit"/>
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 查询当前表的总记录数 -->
|
|
<!-- 查询当前表的总记录数 -->
|
|
<select id="queryCount" resultType="int">
|
|
<select id="queryCount" resultType="int">
|
|
SELECT COUNT(*) FROM student_extracurricular_exercises_situation_
|
|
SELECT COUNT(*) FROM student_extracurricular_exercises_situation_
|
|
@@ -133,64 +133,65 @@
|
|
|
|
|
|
<select id="findExercisesSituations" resultMap="StudentExercisesSituationDto">
|
|
<select id="findExercisesSituations" resultMap="StudentExercisesSituationDto">
|
|
SELECT
|
|
SELECT
|
|
- MAX(sees.id_) id_,
|
|
|
|
- student_id_,
|
|
|
|
- stu.username_ student_name_,
|
|
|
|
- GROUP_CONCAT(DISTINCT tea.real_name_ ORDER BY tea.id_) teacher_name_,
|
|
|
|
- o.name_ organ_name_,
|
|
|
|
- SUM( expect_exercises_num_ ) expect_exercises_num_,
|
|
|
|
- SUM( actual_exercises_num_ ) actual_exercises_num_,
|
|
|
|
- <if test="submitStartDate==null or submitEndDate==null">
|
|
|
|
- SUM( exercises_reply_num_ ) exercises_reply_num_,
|
|
|
|
- SUM( exercises_message_num_ ) exercises_message_num_,
|
|
|
|
- SUM( exercises_message_timely_num_ ) exercises_message_timely_num_,
|
|
|
|
- </if>
|
|
|
|
- <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
|
- SUM(IF(last_submit_time_ BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_reply_num_,0)) exercises_reply_num_,
|
|
|
|
- SUM(IF(last_submit_time_ BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0)) exercises_message_num_,
|
|
|
|
- SUM(IF(last_submit_time_ BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_timely_num_,0)) exercises_message_timely_num_,
|
|
|
|
- </if>
|
|
|
|
- MAX(last_submit_time_) last_submit_time_
|
|
|
|
|
|
+ MAX(sees.id_) id_,
|
|
|
|
+ student_id_,
|
|
|
|
+ stu.username_ student_name_,
|
|
|
|
+ GROUP_CONCAT(DISTINCT tea.real_name_ ORDER BY tea.id_) teacher_name_,
|
|
|
|
+ o.name_ organ_name_,
|
|
|
|
+ SUM( expect_exercises_num_ ) expect_exercises_num_,
|
|
|
|
+ SUM( actual_exercises_num_ ) actual_exercises_num_,
|
|
|
|
+ <if test="submitStartDate==null or submitEndDate==null">
|
|
|
|
+ SUM( exercises_reply_num_ ) exercises_reply_num_,
|
|
|
|
+ SUM( exercises_message_num_ ) exercises_message_num_,
|
|
|
|
+ SUM( exercises_message_timely_num_ ) exercises_message_timely_num_,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_reply_num_,0)) exercises_reply_num_,
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0)) exercises_message_num_,
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_timely_num_,0)) exercises_message_timely_num_,
|
|
|
|
+ </if>
|
|
|
|
+ MAX(last_submit_time_) last_submit_time_
|
|
FROM
|
|
FROM
|
|
- student_extracurricular_exercises_situation_ sees
|
|
|
|
- LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
|
|
|
|
- LEFT JOIN teacher t ON t.id_=sees.teacher_id_
|
|
|
|
- LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
|
|
|
|
- LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
|
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
|
+ LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
|
|
|
|
+ LEFT JOIN teacher t ON t.id_=sees.teacher_id_
|
|
|
|
+ LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
|
|
|
|
+ LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
WHERE
|
|
WHERE
|
|
- sees.monday_ >= #{monday}
|
|
|
|
- AND sees.sunday_ <= #{sunday}
|
|
|
|
- <if test="teacherId!=null">
|
|
|
|
- AND sees.teacher_id_ = #{teacherId}
|
|
|
|
- </if>
|
|
|
|
- <if test="search!=null">
|
|
|
|
- AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
|
- </if>
|
|
|
|
- <if test="organIdList != null">
|
|
|
|
- AND FIND_IN_SET(t.organ_id_,#{organIdList})
|
|
|
|
- </if>
|
|
|
|
- <if test="existVipCourse!=null and existVipCourse==1">
|
|
|
|
- AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
- </if>
|
|
|
|
- <if test="existVipCourse!=null and existVipCourse==0">
|
|
|
|
- AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
- </if>
|
|
|
|
- <if test="existPracticeCourse!=null and existPracticeCourse==1">
|
|
|
|
- AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
|
|
+ sees.monday_ >= #{monday}
|
|
|
|
+ AND sees.sunday_ <= #{sunday}
|
|
|
|
+ <if test="teacherId!=null">
|
|
|
|
+ AND sees.teacher_id_ = #{teacherId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="search!=null">
|
|
|
|
+ AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+ <if test="organIdList != null">
|
|
|
|
+ AND FIND_IN_SET(t.organ_id_,#{organIdList})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="existVipCourse!=null and existVipCourse==1">
|
|
|
|
+ AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="existVipCourse!=null and existVipCourse==0">
|
|
|
|
+ AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="existPracticeCourse!=null and existPracticeCourse==1">
|
|
|
|
+ AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="existPracticeCourse!=null and existPracticeCourse==0">
|
|
|
|
+ AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY
|
|
|
|
+ student_id_
|
|
|
|
+ <trim prefix="HAVING" suffixOverrides="and">
|
|
|
|
+ <if test="expectExercisesNum!=null"> SUM( expect_exercises_num_ ) = #{expectExercisesNum}</if>
|
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
|
+ SUM( actual_exercises_num_ )<SUM( expect_exercises_num_ ) and
|
|
</if>
|
|
</if>
|
|
- <if test="existPracticeCourse!=null and existPracticeCourse==0">
|
|
|
|
- AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
|
+ SUM( actual_exercises_num_ )>=SUM( expect_exercises_num_ ) and
|
|
</if>
|
|
</if>
|
|
- GROUP BY
|
|
|
|
- student_id_
|
|
|
|
- <trim prefix="HAVING" suffixOverrides="and">
|
|
|
|
- <if test="expectExercisesNum!=null"> SUM( expect_exercises_num_ ) = #{expectExercisesNum}</if>
|
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
|
- SUM( actual_exercises_num_ )<SUM( expect_exercises_num_ ) and
|
|
|
|
- </if>
|
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
|
- SUM( actual_exercises_num_ )>=SUM( expect_exercises_num_ ) and
|
|
|
|
- </if>
|
|
|
|
|
|
+ <if test="submitStartDate==null or submitEndDate==null">
|
|
<if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
<if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
SUM( exercises_reply_num_ ) < SUM( expect_exercises_num_ ) and
|
|
SUM( exercises_reply_num_ ) < SUM( expect_exercises_num_ ) and
|
|
</if>
|
|
</if>
|
|
@@ -209,55 +210,77 @@
|
|
<if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
<if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
SUM( exercises_message_timely_num_ ) >= SUM( expect_exercises_num_ ) and
|
|
SUM( exercises_message_timely_num_ ) >= SUM( expect_exercises_num_ ) and
|
|
</if>
|
|
</if>
|
|
- </trim>
|
|
|
|
|
|
+ </if>
|
|
|
|
+ <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_reply_num_,0)) < SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_reply_num_,0)) >= SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_message_num_,0)) < SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_message_num_,0)) >= SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_message_timely_num_,0)) < SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_message_timely_num_,0)) >= SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
ORDER BY student_id_
|
|
ORDER BY student_id_
|
|
<include refid="global.limit"/>
|
|
<include refid="global.limit"/>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="countExercisesSituations" resultType="int">
|
|
<select id="countExercisesSituations" resultType="int">
|
|
SELECT COUNT(1) FROM (
|
|
SELECT COUNT(1) FROM (
|
|
- SELECT
|
|
|
|
- 1
|
|
|
|
- FROM
|
|
|
|
- student_extracurricular_exercises_situation_ sees
|
|
|
|
- LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
|
|
|
|
- LEFT JOIN teacher t ON t.id_=sees.teacher_id_
|
|
|
|
- LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
|
|
|
|
- LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
|
|
- WHERE
|
|
|
|
- sees.monday_ >= #{monday}
|
|
|
|
- AND sees.sunday_ <= #{sunday}
|
|
|
|
- <if test="teacherId!=null">
|
|
|
|
- AND sees.teacher_id_ = #{teacherId}
|
|
|
|
- </if>
|
|
|
|
- <if test="search!=null">
|
|
|
|
- AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
|
- </if>
|
|
|
|
- <if test="organIdList != null">
|
|
|
|
- AND FIND_IN_SET(t.organ_id_, #{organIdList})
|
|
|
|
- </if>
|
|
|
|
- <if test="existVipCourse!=null and existVipCourse==1">
|
|
|
|
- AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
- </if>
|
|
|
|
- <if test="existVipCourse!=null and existVipCourse==0">
|
|
|
|
- AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
- </if>
|
|
|
|
- <if test="existPracticeCourse!=null and existPracticeCourse==1">
|
|
|
|
- AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ 1
|
|
|
|
+ FROM
|
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
|
+ LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
|
|
|
|
+ LEFT JOIN teacher t ON t.id_=sees.teacher_id_
|
|
|
|
+ LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
|
|
|
|
+ LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
|
|
+ WHERE
|
|
|
|
+ sees.monday_ >= #{monday}
|
|
|
|
+ AND sees.sunday_ <= #{sunday}
|
|
|
|
+ <if test="teacherId!=null">
|
|
|
|
+ AND sees.teacher_id_ = #{teacherId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="search!=null">
|
|
|
|
+ AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+ <if test="organIdList != null">
|
|
|
|
+ AND FIND_IN_SET(t.organ_id_, #{organIdList})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="existVipCourse!=null and existVipCourse==1">
|
|
|
|
+ AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="existVipCourse!=null and existVipCourse==0">
|
|
|
|
+ AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="existPracticeCourse!=null and existPracticeCourse==1">
|
|
|
|
+ AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="existPracticeCourse!=null and existPracticeCourse==0">
|
|
|
|
+ AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY
|
|
|
|
+ student_id_
|
|
|
|
+ <trim prefix="HAVING" suffixOverrides="and">
|
|
|
|
+ <if test="expectExercisesNum!=null"> SUM( expect_exercises_num_ ) = #{expectExercisesNum}</if>
|
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
|
+ SUM( actual_exercises_num_ )<SUM( expect_exercises_num_ ) and
|
|
</if>
|
|
</if>
|
|
- <if test="existPracticeCourse!=null and existPracticeCourse==0">
|
|
|
|
- AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
|
+ SUM( actual_exercises_num_ )>=SUM( expect_exercises_num_ ) and
|
|
</if>
|
|
</if>
|
|
- GROUP BY
|
|
|
|
- student_id_
|
|
|
|
- <trim prefix="HAVING" suffixOverrides="and">
|
|
|
|
- <if test="expectExercisesNum!=null"> SUM( expect_exercises_num_ ) = #{expectExercisesNum}</if>
|
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
|
- SUM( actual_exercises_num_ )<SUM( expect_exercises_num_ ) and
|
|
|
|
- </if>
|
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
|
- SUM( actual_exercises_num_ )>=SUM( expect_exercises_num_ ) and
|
|
|
|
- </if>
|
|
|
|
|
|
+ <if test="submitStartDate==null or submitEndDate==null">
|
|
<if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
<if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
SUM( exercises_reply_num_ ) < SUM( expect_exercises_num_ ) and
|
|
SUM( exercises_reply_num_ ) < SUM( expect_exercises_num_ ) and
|
|
</if>
|
|
</if>
|
|
@@ -276,7 +299,28 @@
|
|
<if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
<if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
SUM( exercises_message_timely_num_ ) >= SUM( expect_exercises_num_ ) and
|
|
SUM( exercises_message_timely_num_ ) >= SUM( expect_exercises_num_ ) and
|
|
</if>
|
|
</if>
|
|
- </trim>
|
|
|
|
|
|
+ </if>
|
|
|
|
+ <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_reply_num_,0)) < SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_reply_num_,0)) >= SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d')},exercises_message_num_,0)) < SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_message_num_,0)) >= SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_message_timely_num_,0)) < SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
|
+ SUM(IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{submitStartDate}, '%Y-%m-%d') AND DATE_FORMAT(#{submitEndDate}, '%Y-%m-%d'),exercises_message_timely_num_,0)) >= SUM( expect_exercises_num_ ) and
|
|
|
|
+ </if>
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
) tmp
|
|
) tmp
|
|
</select>
|
|
</select>
|
|
<select id="findExercisesSituationsById" resultMap="StudentExtracurricularExercisesSituation">
|
|
<select id="findExercisesSituationsById" resultMap="StudentExtracurricularExercisesSituation">
|
|
@@ -285,28 +329,28 @@
|
|
#{id}
|
|
#{id}
|
|
</foreach>
|
|
</foreach>
|
|
</select>
|
|
</select>
|
|
- <select id="findTeacherExercisesServiceSituations" resultType="com.ym.mec.biz.dal.dto.TeacherExercisesServiceDto">
|
|
|
|
|
|
+ <select id="findTeacherExercisesServiceSituations" resultType="com.ym.mec.biz.dal.dto.TeacherExercisesServiceDto">
|
|
SELECT
|
|
SELECT
|
|
- teacher_id_ teacherId,
|
|
|
|
- COUNT( exercises_reply_num_ ) expectExercisesNum,
|
|
|
|
- COUNT( CASE WHEN actual_exercises_num_ = 1 THEN 1 ELSE NULL END ) actualExercisesNum
|
|
|
|
|
|
+ teacher_id_ teacherId,
|
|
|
|
+ COUNT( exercises_reply_num_ ) expectExercisesNum,
|
|
|
|
+ COUNT( CASE WHEN actual_exercises_num_ = 1 THEN 1 ELSE NULL END ) actualExercisesNum
|
|
FROM
|
|
FROM
|
|
- student_extracurricular_exercises_situation_
|
|
|
|
|
|
+ student_extracurricular_exercises_situation_
|
|
WHERE monday_ = #{monday}
|
|
WHERE monday_ = #{monday}
|
|
- AND teacher_id_ IN
|
|
|
|
- <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
|
|
|
|
- #{teacherId}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND teacher_id_ IN
|
|
|
|
+ <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
|
|
|
|
+ #{teacherId}
|
|
|
|
+ </foreach>
|
|
GROUP BY
|
|
GROUP BY
|
|
- teacher_id_;
|
|
|
|
- </select>
|
|
|
|
- <select id="findLastWeekTodayUpdateNum" resultType="int">
|
|
|
|
|
|
+ teacher_id_;
|
|
|
|
+ </select>
|
|
|
|
+ <select id="findLastWeekTodayUpdateNum" resultType="int">
|
|
SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE sunday_=#{sunday} AND DATE_FORMAT(update_time_,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE sunday_=#{sunday} AND DATE_FORMAT(update_time_,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
</select>
|
|
</select>
|
|
- <select id="findStudentExercisesSituationsWithMonDay" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
|
|
|
+ <select id="findStudentExercisesSituationsWithMonDay" resultMap="StudentExtracurricularExercisesSituation">
|
|
SELECT * FROM student_extracurricular_exercises_situation_ WHERE monday_=#{monday} AND student_id_=#{studentId}
|
|
SELECT * FROM student_extracurricular_exercises_situation_ WHERE monday_=#{monday} AND student_id_=#{studentId}
|
|
</select>
|
|
</select>
|
|
- <select id="getNoFinishedServiceTeacher" resultType="java.util.Map">
|
|
|
|
|
|
+ <select id="getNoFinishedServiceTeacher" resultType="java.util.Map">
|
|
SELECT
|
|
SELECT
|
|
teacher_id_ AS 'key',
|
|
teacher_id_ AS 'key',
|
|
COUNT( student_id_ ) AS 'value'
|
|
COUNT( student_id_ ) AS 'value'
|