|
@@ -163,6 +163,13 @@
|
|
|
<result property="serviceStartTime" column="service_start_time"/>
|
|
|
<result property="serviceEndTime" column="service_end_time"/>
|
|
|
<result property="orderGoodsId" column="order_goods_id"/>
|
|
|
+ <result property="realName" column="realname"/>
|
|
|
+ <result property="idCard" column="id_card"/>
|
|
|
+ <result property="orderSn" column="order_sn"/>
|
|
|
+
|
|
|
+ <result property="doStartTime" column="do_start_time"/>
|
|
|
+ <result property="doEndTime" column="do_end_time"/>
|
|
|
+ <result property="doExamNum" column="do_exam_num"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="selectList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
|
|
@@ -317,7 +324,7 @@
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="listFreeGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
|
|
|
+ <select id="listUserFreeGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
|
|
|
SELECT
|
|
|
g.*,
|
|
|
ps.supply_name,
|
|
@@ -357,4 +364,118 @@
|
|
|
</if>
|
|
|
ORDER BY og.create_time DESC
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="listFreeGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
|
|
|
+ SELECT
|
|
|
+ g.*,
|
|
|
+ ps.supply_name,
|
|
|
+ cet.education_name,
|
|
|
+ cpt.project_name,
|
|
|
+ cb.business_name,
|
|
|
+ s.school_name,
|
|
|
+ m.category_name,
|
|
|
+ ot.type AS template_type,
|
|
|
+ ( SELECT gs.goods_name FROM goods gs WHERE 1 = 1 AND g.make_goods_id = gs.goods_id ) AS make_goods_name,
|
|
|
+ ( SELECT gs.CODE FROM goods gs WHERE 1 = 1 AND g.make_goods_id = gs.goods_id ) AS make_goods_code,
|
|
|
+ o.user_id,
|
|
|
+ o.order_sn,
|
|
|
+ og.create_time as order_create_time,
|
|
|
+ og.service_start_time,
|
|
|
+ og.service_end_time,
|
|
|
+ og.order_goods_id,
|
|
|
+ u.realname,
|
|
|
+ u.id_card,
|
|
|
+ (SELECT MIN(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_start_time,
|
|
|
+ (SELECT MAX(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_end_time,
|
|
|
+ (SELECT count(DISTINCT uer.exam_id) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_exam_num
|
|
|
+ FROM `order` o
|
|
|
+ LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
+ LEFT JOIN order_goods_free ogf ON og.order_goods_id = ogf.order_goods_id
|
|
|
+ LEFT JOIN goods g ON ogf.free_goods_id = g.goods_id
|
|
|
+ LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
|
|
|
+ LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
|
|
|
+ LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
|
|
|
+ LEFT JOIN course_business cb ON g.business_id = cb.id
|
|
|
+ LEFT JOIN school s ON s.id = g.school_id
|
|
|
+ LEFT JOIN major m ON g.major_id = m.id
|
|
|
+ LEFT JOIN order_input_template ot ON cb.template_status = ot.id
|
|
|
+ LEFT JOIN `user` u ON u.user_id = o.user_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND g.goods_type = 5
|
|
|
+ AND og.`status` = 1
|
|
|
+ AND og.pay_status IN ( 2, 3, 4 )
|
|
|
+ AND og.refund_status IN (0,3,1)
|
|
|
+ <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
+ AND g.education_type_id = #{educationTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ <if test="majorId != null and majorId != ''">
|
|
|
+ AND g.major_id = #{majorId}
|
|
|
+ </if>
|
|
|
+ <if test="searchKey != null and searchKey != ''">
|
|
|
+ and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%') or u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%'))
|
|
|
+ </if>
|
|
|
+ ORDER BY og.create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="listBankGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
|
|
|
+ SELECT
|
|
|
+ g.*,
|
|
|
+ ps.supply_name,
|
|
|
+ cet.education_name,
|
|
|
+ cpt.project_name,
|
|
|
+ cb.business_name,
|
|
|
+ s.school_name,
|
|
|
+ m.category_name,
|
|
|
+ ot.type AS template_type,
|
|
|
+ ( SELECT gs.goods_name FROM goods gs WHERE 1 = 1 AND g.make_goods_id = gs.goods_id ) AS make_goods_name,
|
|
|
+ ( SELECT gs.CODE FROM goods gs WHERE 1 = 1 AND g.make_goods_id = gs.goods_id ) AS make_goods_code,
|
|
|
+ o.user_id,
|
|
|
+ o.order_sn,
|
|
|
+ og.create_time as order_create_time,
|
|
|
+ og.service_start_time,
|
|
|
+ og.service_end_time,
|
|
|
+ og.order_goods_id,
|
|
|
+ u.realname,
|
|
|
+ u.id_card,
|
|
|
+ (SELECT MIN(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_start_time,
|
|
|
+ (SELECT MAX(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_end_time,
|
|
|
+ (SELECT count(DISTINCT uer.exam_id) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_exam_num
|
|
|
+ FROM `order` o
|
|
|
+ LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
+ LEFT JOIN goods g ON og.goods_id = g.goods_id
|
|
|
+ LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
|
|
|
+ LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
|
|
|
+ LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
|
|
|
+ LEFT JOIN course_business cb ON g.business_id = cb.id
|
|
|
+ LEFT JOIN school s ON s.id = g.school_id
|
|
|
+ LEFT JOIN major m ON g.major_id = m.id
|
|
|
+ LEFT JOIN order_input_template ot ON cb.template_status = ot.id
|
|
|
+ LEFT JOIN `user` u ON u.user_id = o.user_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND g.goods_type = 5
|
|
|
+ AND og.`status` = 1
|
|
|
+ AND og.pay_status IN ( 2, 3, 4 )
|
|
|
+ AND og.refund_status IN (0,3,1)
|
|
|
+ <if test="goodsId != null and goodsId != ''">
|
|
|
+ AND og.goods_id = #{goodsId}
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
+ AND g.education_type_id = #{educationTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ <if test="majorId != null and majorId != ''">
|
|
|
+ AND g.major_id = #{majorId}
|
|
|
+ </if>
|
|
|
+ <if test="searchKey != null and searchKey != ''">
|
|
|
+ and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%') or u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%'))
|
|
|
+ </if>
|
|
|
+ ORDER BY og.create_time DESC
|
|
|
+ </select>
|
|
|
</mapper>
|