mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-25 20:35:35 +08:00
完成后台的线上课-学员api接口
This commit is contained in:
@@ -18,9 +18,86 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,course_id,
|
||||
hour_count,finished_count,progress,
|
||||
is_finished,finished_at,created_at,
|
||||
id,user_id,course_id,
|
||||
hour_count,finished_count,progress,
|
||||
is_finished,finished_at,created_at,
|
||||
updated_at
|
||||
</sql>
|
||||
<select id="paginateTotal" resultType="java.lang.Long">
|
||||
SELECT count(1)
|
||||
FROM `user_course_records`
|
||||
INNER JOIN `users` ON `users`.`id` = `user_course_records`.`user_id`
|
||||
<where>
|
||||
<if test="courseId != null">
|
||||
AND `user_course_records`.`course_id` = #{courseId}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND `users`.`name` LIKE concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="email != null and email != ''">
|
||||
AND `users`.`email` = #{email}
|
||||
</if>
|
||||
<if test="idCard != null and idCard != ''">
|
||||
AND `users`.`id_card` = #{idCard}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="paginate" resultType="xyz.playedu.api.domain.UserCourseRecord">
|
||||
SELECT `user_course_records`.*
|
||||
FROM `user_course_records`
|
||||
INNER JOIN `users` ON `users`.`id` = `user_course_records`.`user_id`
|
||||
<where>
|
||||
<if test="courseId != null">
|
||||
AND `user_course_records`.`course_id` = #{courseId}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND `users`.`name` LIKE concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="email != null and email != ''">
|
||||
AND `users`.`email` = #{email}
|
||||
</if>
|
||||
<if test="idCard != null and idCard != ''">
|
||||
AND `users`.`id_card` = #{idCard}
|
||||
</if>
|
||||
</where>
|
||||
<if test="sortAlgo == 'asc'">
|
||||
<choose>
|
||||
<when test="sortField == 'finished_count'">
|
||||
ORDER BY `user_course_records`.`finished_count` ASC
|
||||
</when>
|
||||
<when test="sortField == 'progress'">
|
||||
ORDER BY `user_course_records`.`progress` ASC
|
||||
</when>
|
||||
<when test="sortField == 'finished_at'">
|
||||
ORDER BY `user_course_records`.`finished_at` ASC
|
||||
</when>
|
||||
<when test="sortField == 'created_at'">
|
||||
ORDER BY `user_course_records`.`created_at` ASC
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY `user_course_records`.`id` ASC
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="sortAlgo != 'asc'">
|
||||
<choose>
|
||||
<when test="sortField == 'finished_count'">
|
||||
ORDER BY `user_course_records`.`finished_count` DESC
|
||||
</when>
|
||||
<when test="sortField == 'progress'">
|
||||
ORDER BY `user_course_records`.`progress` DESC
|
||||
</when>
|
||||
<when test="sortField == 'finished_at'">
|
||||
ORDER BY `user_course_records`.`finished_at` DESC
|
||||
</when>
|
||||
<when test="sortField == 'created_at'">
|
||||
ORDER BY `user_course_records`.`created_at` DESC
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY `user_course_records`.`id` DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
LIMIT #{pageStart}, #{pageSize};
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user