| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <?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.zhongzheng.modules.grade.mapper.UserPeriodMapper">
- <resultMap type="com.zhongzheng.modules.grade.domain.UserPeriod" id="UserPeriodResult">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="courseId" column="course_id"/>
- <result property="sectionId" column="section_id"/>
- <result property="goodsId" column="goods_id"/>
- <result property="type" column="type"/>
- <result property="examId" column="exam_id"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="moduleId" column="module_id"/>
- <result property="chapterId" column="chapter_id"/>
- </resultMap>
- <select id="checkGoodsChange" parameterType="com.zhongzheng.modules.grade.bo.UserPeriodQueryBo" resultType="Long">
- SELECT
- IFNULL(count(*),0)
- FROM
- user_period up
- LEFT JOIN class_grade_user cgu ON up.grade_id = cgu.grade_id
- WHERE
- cgu.period_status = 1
- <if test="goodsId != null and goodsId != ''">
- and up.goods_id = #{goodsId}
- </if>
- <if test="gradeId != null and gradeId != ''">
- and up.grade_id = #{gradeId}
- </if>
- <if test="userId != null and userId != ''">
- and up.user_id = #{userId}
- </if>
- <if test="sectionId != null ">
- and up.section_id = #{sectionId}
- </if>
- <if test="moduleId != null ">
- and up.module_id = #{moduleId}
- </if>
- <if test="chapterId != null">
- and up.chapter_id = #{chapterId}
- </if>
- <if test="courseId != null ">
- and up.course_id = #{courseId}
- </if>
- <if test="examId != null ">
- and up.exam_id = #{examId}
- </if>
- </select>
- <select id="checkGoodsStudy" parameterType="com.zhongzheng.modules.grade.bo.UserPeriodQueryBo" resultType="Long">
- SELECT
- IFNULL(count(*),0)
- FROM
- user_period up
- WHERE
- 1=1
- <if test="goodsId != null and goodsId != ''">
- and up.goods_id = #{goodsId}
- </if>
- <if test="gradeId != null and gradeId != ''">
- and up.grade_id = #{gradeId}
- </if>
- <if test="userId != null and userId != ''">
- and up.user_id = #{userId}
- </if>
- <if test="sectionId != null ">
- and up.section_id = #{sectionId}
- </if>
- <if test="moduleId != null ">
- and up.module_id = #{moduleId}
- </if>
- <if test="chapterId != null">
- and up.chapter_id = #{chapterId}
- </if>
- <if test="courseId != null ">
- and up.course_id = #{courseId}
- </if>
- <if test="examId != null ">
- and up.exam_id = #{examId}
- </if>
- </select>
- <select id="selectCountPeriod" parameterType="map" resultType="Long">
- SELECT
- COUNT(1)
- FROM
- user_period_status ups JOIN user_period up on ups.period_id = up.id JOIN goods g on g.goods_id = up.goods_id JOIN course_business b on g.business_id = b.id
- WHERE
- 1 = 1
- AND ups.id = #{id}
- and FIND_IN_SET(#{userId},b.period_user_ids)
- </select>
- <select id="selectCountConfirmPeriod" parameterType="map" resultType="Long">
- SELECT
- COUNT(1)
- FROM
- goods g LEFT JOIN course_business b on g.business_id = b.id
- WHERE
- 1 = 1
- AND g.goods_id = #{goodsId}
- and FIND_IN_SET(#{userId},b.period_confirm_user_ids)
- </select>
- <select id="todayStudySectionNum" parameterType="com.zhongzheng.modules.grade.bo.UserPeriodQueryBo" resultType="Long">
- SELECT
- IFNULL(count(*),0)
- FROM
- user_period up
- WHERE
- 1=1
- <if test="goodsId != null and goodsId != ''">
- and up.goods_id = #{goodsId}
- </if>
- <if test="gradeId != null and gradeId != ''">
- and up.grade_id = #{gradeId}
- </if>
- <if test="userId != null and userId != ''">
- and up.user_id = #{userId}
- </if>
- <if test="sectionId != null ">
- and up.section_id = #{sectionId}
- </if>
- <if test="moduleId != null ">
- and up.module_id = #{moduleId}
- </if>
- <if test="chapterId != null">
- and up.chapter_id = #{chapterId}
- </if>
- <if test="courseId != null ">
- and up.course_id = #{courseId}
- </if>
- <if test="examId != null ">
- and up.exam_id = #{examId}
- </if>
- <if test="todayStartTime != null ">
- and up.create_time >= #{todayStartTime}
- </if>
- <if test="todayEndTime != null ">
- and #{todayEndTime} >= up.create_time
- </if>
- </select>
- </mapper>
|