|
@@ -33,6 +33,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="people" column="people"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap type="com.zhongzheng.modules.exam.vo.ExamUserApplyVo" id="ExamUserApplyVo">
|
|
|
+ <result property="applyId" column="apply_id"/>
|
|
|
+ <result property="applyUrl" column="apply_url"/>
|
|
|
+ <result property="applyName" column="apply_name"/>
|
|
|
+ <result property="applyIntroduce" column="apply_introduce"/>
|
|
|
+ <result property="applyStartTime" column="apply_start_time"/>
|
|
|
+ <result property="applyEndTime" column="apply_end_time"/>
|
|
|
+ <result property="major" column="major"/>
|
|
|
+ <result property="realname" column="realname"/>
|
|
|
+ <result property="idCard" column="id_card"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
|
|
|
<result property="id" column="id"/>
|
|
|
<result property="examNumberId" column="exam_number_id"/>
|
|
@@ -181,4 +193,97 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
order by ea.create_time desc
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="countGradePeriod" parameterType="long" resultType="integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(cg.grade_id)
|
|
|
+ FROM
|
|
|
+ class_grade cg
|
|
|
+ LEFT JOIN class_grade_user cgu ON cg.grade_id = cgu.grade_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND cgu.user_id = #{userId}
|
|
|
+ and cgu.grade_id = #{gradeId}
|
|
|
+ AND cgu.period_status = 1
|
|
|
+ and unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time
|
|
|
+ and cg.`status` =1
|
|
|
+ and cgu.`status` =1
|
|
|
+ </select>
|
|
|
+ <select id="countSubscribe" parameterType="long" resultType="integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(1)
|
|
|
+ FROM
|
|
|
+ user_subscribe us
|
|
|
+ WHERE
|
|
|
+ 1 =1
|
|
|
+ and us.user_id = #{userId}
|
|
|
+ and us.result = 1
|
|
|
+ and us.goods_id = #{goodsId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countHaveSubscribe" parameterType="long" resultType="integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(1)
|
|
|
+ FROM
|
|
|
+ user_subscribe us
|
|
|
+ WHERE
|
|
|
+ 1 =1
|
|
|
+ and us.user_id = #{userId}
|
|
|
+ and us.exam_status = 0
|
|
|
+ and subscribe_status = 1
|
|
|
+ and us.goods_id = #{goodsId}
|
|
|
+ </select>
|
|
|
+ <select id="selectExamUserApplyVo" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultMap="ExamUserApplyVo">
|
|
|
+ SELECT
|
|
|
+ ea.apply_id,
|
|
|
+ ea.apply_url,
|
|
|
+ ea.apply_name,
|
|
|
+ ea.apply_introduce,
|
|
|
+ ea.apply_start_time,
|
|
|
+ ea.apply_end_time,
|
|
|
+ ea.apply_status,
|
|
|
+ (SELECT m.category_name FROM major m where m.id = g.major_id) as major,
|
|
|
+ (SELECT u.realname FROM `user` u wher u.user_id = #{user_id}) as realname,
|
|
|
+(SELECT u.id_card FROM `user` u wher u.user_id = #{user_id}) as id_card
|
|
|
+ FROM
|
|
|
+ exam_apply ea
|
|
|
+ LEFT JOIN exam_apply_goods eag ON ea.apply_id = eag.apply_id
|
|
|
+ LEFT JOIN goods g on eag.goods_id=g.goods_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND eag.goods_id = #{goodsId}
|
|
|
+ AND ea.`status` =1
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="countHaveSubscribeNext" parameterType="long" resultType="integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(1)
|
|
|
+ FROM
|
|
|
+ user_subscribe us
|
|
|
+ where 1=1
|
|
|
+ and us.user_id =#{userId}
|
|
|
+ and us.exam_expend = 1
|
|
|
+ and us.goods_id = #{goodsId}
|
|
|
+ </select>
|
|
|
+ <select id="residueSubscribeNext" parameterType="long" resultType="integer">
|
|
|
+ SELECT
|
|
|
+ ueg.exam_number - ueg.expend_number
|
|
|
+ FROM
|
|
|
+ user_exam_goods ueg
|
|
|
+ WHERE
|
|
|
+ ueg.user_id =#{userId}
|
|
|
+ AND ueg.goods_id = #{goodsId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="beforeSubscribeNext" parameterType="long" resultType="integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(eb.before_id)
|
|
|
+ FROM
|
|
|
+ exam_before eb
|
|
|
+ LEFT JOIN exam_before_goods ebg on eb.before_id=ebg.before_id
|
|
|
+ WHERE
|
|
|
+ ebg.goods_id =3
|
|
|
+ and eb.`status`=1
|
|
|
+ </select>
|
|
|
</mapper>
|