|
@@ -8,12 +8,25 @@
|
|
|
|
|
|
<resultMap type="com.ym.mec.web.dal.entity.StudentCourseHomework" id="StudentCourseHomework">
|
|
|
<result column="id_" property="id" />
|
|
|
+ <result column="user_id_" property="userId"/>
|
|
|
<result column="course_homework_id_" property="courseHomeworkId" />
|
|
|
<result column="attachments_" property="attachments" />
|
|
|
<result column="score_" property="score" />
|
|
|
<result column="create_time_" property="createTime" />
|
|
|
<result column="update_time_" property="updateTime" />
|
|
|
</resultMap>
|
|
|
+
|
|
|
+ <resultMap type="com.ym.mec.web.dal.dto.CourseHomeworkStudentDetailDto" id="CourseHomeworkStudentDetailDto">
|
|
|
+ <result column="musicGroupName" property="musicGroupName" />
|
|
|
+ <result column="classGroupName" property="classGroupName"/>
|
|
|
+ <result column="id_" property="courseHomeworkId" />
|
|
|
+ <result column="content_" property="content" />
|
|
|
+ <result column="expiry_date_" property="expiryDate" />
|
|
|
+ <result column="completed_num_" property="completedNum" />
|
|
|
+ <result column="expect_num_" property="expectNum" />
|
|
|
+ <result column="attachments_" property="attachments" />
|
|
|
+ <result column="score_" property="score" />
|
|
|
+ </resultMap>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<select id="get" resultMap="StudentCourseHomework" >
|
|
@@ -32,31 +45,31 @@
|
|
|
SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
</selectKey>
|
|
|
-->
|
|
|
- INSERT INTO student_course_homework (id_,course_homework_id_,attachments_,score_,create_time_,update_time_) VALUES(#{id},#{courseHomeworkId},#{attachments},#{score},#{createTime},#{updateTime})
|
|
|
+ INSERT INTO student_course_homework (id_,user_id_,course_homework_id_,attachments_,score_,create_time_,update_time_) VALUES(#{id},#{userId},#{courseHomeworkId},#{attachments},#{score},now(),now())
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<update id="update" parameterType="com.ym.mec.web.dal.entity.StudentCourseHomework">
|
|
|
UPDATE student_course_homework <set>
|
|
|
-<if test="id != null">
|
|
|
-id_ = #{id},
|
|
|
-</if>
|
|
|
-<if test="courseHomeworkId != null">
|
|
|
-course_homework_id_ = #{courseHomeworkId},
|
|
|
-</if>
|
|
|
-<if test="updateTime != null">
|
|
|
-update_time_ = #{updateTime},
|
|
|
-</if>
|
|
|
-<if test="score != null">
|
|
|
-score_ = #{score},
|
|
|
-</if>
|
|
|
-<if test="attachments != null">
|
|
|
-attachments_ = #{attachments},
|
|
|
-</if>
|
|
|
-<if test="createTime != null">
|
|
|
-create_time_ = #{createTime},
|
|
|
-</if>
|
|
|
-</set> WHERE id_ = #{id}
|
|
|
+ <if test="id != null">
|
|
|
+ id_ = #{id},
|
|
|
+ </if>
|
|
|
+ <if test="courseHomeworkId != null">
|
|
|
+ course_homework_id_ = #{courseHomeworkId},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="score != null">
|
|
|
+ score_ = #{score},
|
|
|
+ </if>
|
|
|
+ <if test="attachments != null">
|
|
|
+ attachments_ = #{attachments},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ </set> WHERE id_ = #{id}
|
|
|
</update>
|
|
|
|
|
|
<!-- 根据主键删除一条记录 -->
|
|
@@ -73,4 +86,22 @@ create_time_ = #{createTime},
|
|
|
<select id="queryCount" resultType="int">
|
|
|
SELECT COUNT(*) FROM student_course_homework
|
|
|
</select>
|
|
|
+ <select id="findCourseHomeworkStudentDetail" resultMap="CourseHomeworkStudentDetailDto">
|
|
|
+ SELECT
|
|
|
+ mg.name_ musicGroupName,
|
|
|
+ cg.name_ classGroupName,
|
|
|
+ ch.id_ courseHomeworkId,
|
|
|
+ ch.content_,
|
|
|
+ ch.expiry_date_,
|
|
|
+ ch.completed_num_,
|
|
|
+ ch.expect_num_,
|
|
|
+ sch.attachments_,
|
|
|
+ sch.score_
|
|
|
+ FROM
|
|
|
+ course_homework ch
|
|
|
+ LEFT JOIN student_course_homework sch ON ch.id_=sch.course_homework_id_
|
|
|
+ LEFT JOIN music_group mg ON ch.music_group_id_=mg.id_
|
|
|
+ LEFT JOIN class_group cg ON ch.class_group_id_=cg.id_
|
|
|
+ WHERE ch.course_schedule_id_=#{courseScheduleID} AND sch.user_id_=#{userID}
|
|
|
+ </select>
|
|
|
</mapper>
|