You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.9 KiB
75 lines
2.9 KiB
<?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.hc.business.mapper.UserCourseMapper">
|
|
|
|
<resultMap type="userCourse" id="UserCourseMap">
|
|
<result property="userCourseId" column="user_course_id" jdbcType="INTEGER"/>
|
|
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
|
<result property="courseId" column="course_id" jdbcType="INTEGER"/>
|
|
<result property="coursePercent" column="course_percent" jdbcType="DOUBLE"/>
|
|
<result property="classId" column="class_id" jdbcType="INTEGER"/>
|
|
<result property="statusId" column="status_id" jdbcType="INTEGER"/>
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
user_course_id,
|
|
user_id,
|
|
course_id,
|
|
course_percent,
|
|
class_id,
|
|
status_id
|
|
</sql>
|
|
|
|
<select id="selectUserCourseList" resultType="com.hc.business.dto.UserCourseDto">
|
|
select a.course_percent,
|
|
a.course_id,
|
|
b.course_name,
|
|
b.course_logo,
|
|
c.course_type,
|
|
b.course_teacher,
|
|
b.course_hours,
|
|
a.user_id,
|
|
a.class_id
|
|
from (SELECT *
|
|
FROM user_course
|
|
WHERE user_id = #{userId,jdbcType=INTEGER}
|
|
and class_id = #{classId,jdbcType=INTEGER}) as a
|
|
left join course b on a.course_id = b.course_id
|
|
left join
|
|
(select * from class_course c where class_id = #{classId,jdbcType=INTEGER}) as c
|
|
on a.course_id = c.course_id
|
|
order by c.course_type
|
|
</select>
|
|
|
|
<select id="selectUserCourseCount" resultType="Integer">
|
|
select count(*) from user_status k join `user` m on k.user_id=m.user_id where k.status=1 and k.class_id=#{classId} and m.user_mobile=#{phone}
|
|
|
|
</select>
|
|
|
|
|
|
<select id="selectUserCourseProgress" resultType="com.hc.business.dto.UserCourseDto">
|
|
select a.*, b.course_name, b.course_logo
|
|
from (SELECT *
|
|
FROM user_course
|
|
WHERE user_id = #{userId,jdbcType=INTEGER}
|
|
and class_id = #{classId,jdbcType=INTEGER}
|
|
and course_id = #{courseId,jdbcType=INTEGER})
|
|
as a
|
|
left join course b on a.course_id = b.course_id
|
|
</select>
|
|
|
|
<select id="selectUserCourseListByParam" resultMap="UserCourseMap">
|
|
SELECT
|
|
<include refid="Base_Column_List"/>
|
|
FROM user_course
|
|
WHERE user_id = #{userId} AND class_id = #{classId}
|
|
</select>
|
|
|
|
<select id="selectUserCourse" resultMap="UserCourseMap">
|
|
SELECT
|
|
<include refid="Base_Column_List"/>
|
|
FROM user_course
|
|
WHERE user_id = #{userId} AND class_id = #{classId} AND course_id = #{courseId}
|
|
</select>
|
|
|
|
</mapper> |