|
@@ -92,6 +92,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="recordNum" column="record_num"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap type="com.zhongzheng.modules.user.domain.UserPeriodStatus" id="UserPeriodStatusResult">
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <result property="recordStartTime" column="record_start_time"/>
|
|
|
+ <result property="recordEndTime" column="record_end_time"/>
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="periodId" column="period_id"/>
|
|
|
+ <result property="periodStatus" column="period_status"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo" resultMap="UserStudyRecordResult">
|
|
|
SELECT DISTINCT
|
|
|
temp.course_id,
|
|
@@ -491,4 +502,126 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</choose>
|
|
|
AND usr.user_id = #{userId}
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectPeriod" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultType="Long">
|
|
|
+ SELECT
|
|
|
+ COUNT( 1 )
|
|
|
+ FROM
|
|
|
+ user_period up
|
|
|
+ LEFT JOIN user_period_status ups on up.id = ups.period_id
|
|
|
+ WHERE
|
|
|
+ 1 =1
|
|
|
+ <choose>
|
|
|
+ <when test="chapterId != null and chapterId !=''">
|
|
|
+ AND usr.chapter_id = #{chapterId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.chapter_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="sectionId != null and sectionId !=''">
|
|
|
+ AND usr.section_id = #{sectionId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.section_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="moduleId != null and moduleId !=''">
|
|
|
+ AND usr.module_id = #{moduleId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.module_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="courseId != null and courseId !=''">
|
|
|
+ AND usr.course_id = #{courseId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.course_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="gradeId != null and gradeId !=''">
|
|
|
+ AND usr.grade_id = #{gradeId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.grade_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="goodsId != null and goodsId !=''">
|
|
|
+ AND usr.goods_id = #{gradeId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.goods_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ AND usr.user_id = #{userId}
|
|
|
+ AND ups.period_status = 1
|
|
|
+ AND ups.`status` =2
|
|
|
+ AND ups.record_end_time is NOT NULL
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectPeriodCount" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultMap="">
|
|
|
+ SELECT
|
|
|
+ ups.*
|
|
|
+ FROM
|
|
|
+ user_period up
|
|
|
+ LEFT JOIN user_period_status ups on up.id = ups.period_id
|
|
|
+ WHERE
|
|
|
+ 1 =1
|
|
|
+ <choose>
|
|
|
+ <when test="chapterId != null and chapterId !=''">
|
|
|
+ AND usr.chapter_id = #{chapterId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.chapter_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="sectionId != null and sectionId !=''">
|
|
|
+ AND usr.section_id = #{sectionId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.section_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="moduleId != null and moduleId !=''">
|
|
|
+ AND usr.module_id = #{moduleId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.module_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="courseId != null and courseId !=''">
|
|
|
+ AND usr.course_id = #{courseId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.course_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="gradeId != null and gradeId !=''">
|
|
|
+ AND usr.grade_id = #{gradeId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.grade_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="goodsId != null and goodsId !=''">
|
|
|
+ AND usr.goods_id = #{gradeId}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND usr.goods_id = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ AND usr.user_id = #{userId}
|
|
|
+ AND ups.period_status = 1
|
|
|
+ </select>
|
|
|
</mapper>
|