|
@@ -13,8 +13,8 @@
|
|
|
<result column="completed_num_" property="completedNum" />
|
|
|
<result column="create_time_" property="createTime" />
|
|
|
<result column="update_time_" property="updateTime" />
|
|
|
- </resultMap>
|
|
|
-
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<!-- 表字段 -->
|
|
|
<sql id="baseColumns">
|
|
|
t.id_
|
|
@@ -28,18 +28,277 @@
|
|
|
, t.completed_num_
|
|
|
, t.create_time_
|
|
|
, t.update_time_
|
|
|
- </sql>
|
|
|
-
|
|
|
+ </sql>
|
|
|
+
|
|
|
<select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo">
|
|
|
SELECT
|
|
|
<include refid="baseColumns"/>
|
|
|
FROM course_homework t
|
|
|
where t.id_ = #{id}
|
|
|
</select>
|
|
|
-
|
|
|
- <select id="selectPage" resultMap="BaseResultMap">
|
|
|
- SELECT
|
|
|
- <include refid="baseColumns" />
|
|
|
- FROM course_homework t
|
|
|
+
|
|
|
+ <select id="selectAdminPage" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo">
|
|
|
+ select
|
|
|
+ cs.id_ AS courseId,
|
|
|
+ cs.course_group_id_ AS courseGroupId,
|
|
|
+ cs.class_date_ AS classDate,
|
|
|
+ cs.start_time_ AS startTime,
|
|
|
+ cs.end_time_ AS endTime,
|
|
|
+ ch.create_time_ as decorateTime,
|
|
|
+ su2.username_ as studentName,
|
|
|
+ su2.avatar_ as studentAvatar,
|
|
|
+ su.username_ as teacherName,
|
|
|
+ su.avatar_ as teacherAvatar,
|
|
|
+ ch.create_time_ as decorateTime
|
|
|
+ from course_homework ch
|
|
|
+ left join course_schedule cs on ch.course_schedule_id_ = cs.id_
|
|
|
+ left join course_schedule_student_payment cssp on cssp.course_id_ = cs.id_
|
|
|
+ left join sys_user su on cs.teacher_id_ = su.id_
|
|
|
+ left join sys_user su2 on cssp.user_id_ = su2.id_
|
|
|
+ <where>
|
|
|
+ <if test="param.courseStatus != null">
|
|
|
+ and cs.type_ = #{param.courseType}
|
|
|
+ </if>
|
|
|
+ <if test="param.courseType != null">
|
|
|
+ and cs.status_ = #{param.courseStatus}
|
|
|
+ </if>
|
|
|
+ <if test="param.teacherId != null">
|
|
|
+ and cs.teacher_id_ = #{param.teacherId}
|
|
|
+ </if>
|
|
|
+ <if test="param.studentId != null">
|
|
|
+ and cssp.user_id_ = #{param.studentId}
|
|
|
+ </if>
|
|
|
+ <if test="param.courseScheduleId != null ">
|
|
|
+ and cs.id_ = #{param.courseScheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="param.date != null and param.date != ''">
|
|
|
+ and date_format(cs.class_date_,'%Y-%m') = #{param.date}
|
|
|
+ </if>
|
|
|
+ <if test="param.startTime != null">
|
|
|
+ and #{param.startTime} < ch.create_time_
|
|
|
+ </if>
|
|
|
+ <if test="param.endTime != null">
|
|
|
+ and #{param.endTime} > ch.create_time_
|
|
|
+ </if>
|
|
|
+ <if test="param.search != null and param.search != ''">
|
|
|
+ and (su.id_ like concat('%',#{param.search},'%')
|
|
|
+ or su.username_ like concat('%',#{param.search},'%')
|
|
|
+ or su.phone_ like concat('%',#{param.search},'%')
|
|
|
+ or su2.id_ like concat('%',#{param.search},'%')
|
|
|
+ or su2.username_ like concat('%',#{param.search},'%')
|
|
|
+ or su2.phone_ like concat('%',#{param.search},'%') )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by cs.start_time_ desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo">
|
|
|
+ select
|
|
|
+ cs.id_ AS courseId,
|
|
|
+ cs.course_group_id_ AS courseGroupId,
|
|
|
+ cs.class_date_ AS classDate,
|
|
|
+ cs.start_time_ AS startTime,
|
|
|
+ cs.end_time_ AS endTime,
|
|
|
+ ch.create_time_ as decorateTime,
|
|
|
+ sch.submit_time_ as submitTime
|
|
|
+ from course_schedule cs
|
|
|
+ left join course_homework ch on ch.course_schedule_id_ = cs.id_
|
|
|
+ left join student_course_homework sch on ch.id_ = sch.course_homework_id_
|
|
|
+ left join course_schedule_student_payment cssp on cssp.course_id_ = cs.id_
|
|
|
+ <where>
|
|
|
+ <if test="param.decorate != null">
|
|
|
+ <if test="param.decorate.code == 0">
|
|
|
+ and ch.id_ is null
|
|
|
+ </if>
|
|
|
+ <if test="param.decorate.code == 1">
|
|
|
+ and ch.id_ is not null
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="param.submit != null">
|
|
|
+ <if test="param.submit.code == 0">
|
|
|
+ and sch.id_ is null
|
|
|
+ </if>
|
|
|
+ <if test="param.submit.code == 1">
|
|
|
+ and sch.id_ is not null
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="param.courseStatus != null">
|
|
|
+ and cs.type_ = #{param.courseType}
|
|
|
+ </if>
|
|
|
+ <if test="param.courseType != null">
|
|
|
+ and cs.status_ = #{param.courseStatus}
|
|
|
+ </if>
|
|
|
+ <if test="param.teacherId != null">
|
|
|
+ and cs.teacher_id_ = #{param.teacherId}
|
|
|
+ </if>
|
|
|
+ <if test="param.studentId != null">
|
|
|
+ and cssp.user_id_ = #{param.studentId}
|
|
|
+ </if>
|
|
|
+ <if test="param.courseScheduleId != null ">
|
|
|
+ and cs.id_ = #{param.courseScheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="param.date != null and param.date != ''">
|
|
|
+ and date_format(cs.class_date_,'%Y-%m') = #{param.date}
|
|
|
+ </if>
|
|
|
+ <if test="param.startTime != null">
|
|
|
+ and #{param.startTime} < ch.create_time_
|
|
|
+ </if>
|
|
|
+ <if test="param.endTime != null">
|
|
|
+ and #{param.endTime} > ch.create_time_
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by cs.start_time_ desc
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectCourseHomeworkDetailByCourseId"
|
|
|
+ resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkDetailVo">
|
|
|
+ select ch.id_ as id
|
|
|
+ ,cs.id_ as courseScheduleId
|
|
|
+ ,ch.title_ as title
|
|
|
+ ,ch.content_ as content
|
|
|
+ ,ch.attachments_ as attachments
|
|
|
+ ,ch.create_time_ as decorateTime
|
|
|
+ ,sch.attachments_ as studentAttachments
|
|
|
+ ,sch.teacher_replied_ as teacherReplied
|
|
|
+ ,sch.submit_time_ as submitTime
|
|
|
+ ,sch.id_ as studentHomeworkId
|
|
|
+ ,cs.type_ as courseType
|
|
|
+ ,cs.class_date_ as classDate
|
|
|
+ ,cs.start_time_ as startTime
|
|
|
+ ,cs.end_time_ as endTime
|
|
|
+ ,cs.status_ as courseStatus
|
|
|
+ ,cs.course_group_id_ as courseGroupId
|
|
|
+ ,if(ch.id_ is null,0,1) as decorateHomework
|
|
|
+ ,if(sch.attachments_ is null or sch.attachments_ = '',0,1) as submitHomework
|
|
|
+ ,if(sch.teacher_replied_ is null or sch.attachments_ = '',0,1) as reviewHomework
|
|
|
+ from course_schedule cs
|
|
|
+ left join course_homework ch on ch.course_schedule_id_ = cs.id_
|
|
|
+ left join student_course_homework sch on ch.id_ = sch.course_homework_id_
|
|
|
+ <where>
|
|
|
+ <if test="courseId != null">
|
|
|
+ cs.id_ = #{courseId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectPaymentStudentInfo" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkDetailVo">
|
|
|
+ select su.username_ as studentName
|
|
|
+ ,su.avatar_ as stduentAvatar
|
|
|
+ from course_schedule cs
|
|
|
+ left join course_schedule_student_payment cssp on cs.id_ = cssp.course_id_
|
|
|
+ left join sys_user su on su.id_ = cssp.user_id_
|
|
|
+ <where>
|
|
|
+ <if test="courseScheduleId != null">
|
|
|
+ and cs.id_ = #{courseScheduleId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectSubjectAndTeacherInfo" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkDetailVo">
|
|
|
+ select s.name_ as subjectName
|
|
|
+ ,su.username_ as teacherName
|
|
|
+ ,su.avatar_ as teacherAvatar
|
|
|
+ from course_group cg
|
|
|
+ left join subject s on cg.subject_id_ = s.id_
|
|
|
+ left join sys_user su on cg.teacher_id_ = su.id_
|
|
|
+ <where>
|
|
|
+ <if test="courseGroupId != null">
|
|
|
+ and cg.id_ = #{courseGroupId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStudentInfo" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo">
|
|
|
+ select
|
|
|
+ s.name_ as subjectName
|
|
|
+ ,su.username_ as studentName
|
|
|
+ ,su.avatar_ as studentAvatar
|
|
|
+ from course_schedule_student_payment cssp
|
|
|
+ left join course_group cg on cssp.course_group_id_ = cg.id_
|
|
|
+ left join subject s on s.id_ = cg.subject_id_
|
|
|
+ left join sys_user su on cssp.user_id_ = su.id_
|
|
|
+ <where>
|
|
|
+ <if test="records != null and records.size() != 0">
|
|
|
+ and cssp.course_id_ in
|
|
|
+ <foreach collection="records" separator="," close=")" open="(" item="item" >
|
|
|
+ #{item.courseId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="records != null and records.size() != 0">
|
|
|
+ order by field(cssp.course_id_,
|
|
|
+ <foreach collection="records" separator="," close=")" open="" item="item" >
|
|
|
+ #{item.courseId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectSubjectInfoList" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo">
|
|
|
+ select
|
|
|
+ s.name_ as subjectName
|
|
|
+ from course_schedule cs
|
|
|
+ left join course_group cg on cs.course_group_id_ = cg.id_
|
|
|
+ left join subject s on s.id_ = cg.subject_id_
|
|
|
+ <where>
|
|
|
+ <if test="records != null and records.size() != 0">
|
|
|
+ and cs.id_ in
|
|
|
+ <foreach collection="records" separator="," close=")" open="(" item="item" >
|
|
|
+ #{item.courseId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="records != null and records.size() != 0">
|
|
|
+ order by field(cs.id_,
|
|
|
+ <foreach collection="records" separator="," close=")" open="" item="item" >
|
|
|
+ #{item.courseId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTeacherInfo" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo">
|
|
|
+ select
|
|
|
+ su.username_ as teacherName
|
|
|
+ ,su.avatar_ as teacherAvatar
|
|
|
+ ,if(sa.id_ is null,1,0) as absenteeism
|
|
|
+ from course_schedule cs
|
|
|
+ left join sys_user su on cs.teacher_id_ = su.id_
|
|
|
+ left join student_attendance sa on sa.course_schedule_id_ = cs.id_
|
|
|
+ <where>
|
|
|
+ <if test="records != null and records.size() != 0">
|
|
|
+ and cs.id_ in
|
|
|
+ <foreach collection="records" separator="," close=")" open="(" item="item" >
|
|
|
+ #{item.courseId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="records != null and records.size() != 0">
|
|
|
+ order by field(cs.id_,
|
|
|
+ <foreach collection="records" separator="," close=")" open="" item="item" >
|
|
|
+ #{item.courseId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectSubmitTime" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo">
|
|
|
+ select
|
|
|
+ cs.id_ as courseId,
|
|
|
+ sch.submit_time_ as submitTime
|
|
|
+ from course_schedule cs
|
|
|
+ left join student_course_homework sch on sch.course_schedule_id_ = cs.id_
|
|
|
+ <where>
|
|
|
+ <if test="courseIdList != null and courseIdList.size() != 0">
|
|
|
+ and cs.id_ in
|
|
|
+ <foreach collection="courseIdList" separator="," close=")" open="(" item="item">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="courseIdList != null and courseIdList.size() != 0">
|
|
|
+ order by field(cs.id_,
|
|
|
+ <foreach collection="courseIdList" separator="," close=")" open="" item="item" >
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|