|
@@ -1,7 +1,7 @@
|
|
|
<?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">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.zhongzheng.modules.order.mapper.OrderGoodsMapper">
|
|
|
|
|
|
<resultMap type="com.zhongzheng.modules.order.domain.OrderGoods" id="OrderGoodsResult">
|
|
@@ -91,56 +91,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="recordNum" column="record_num"/>
|
|
|
</resultMap>
|
|
|
|
|
|
- <select id="selectList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
+ <select id="selectList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
SELECT
|
|
|
- og.*,
|
|
|
- g.`code`,
|
|
|
- g.goods_name,
|
|
|
- g.goods_type,
|
|
|
- g.cover_url,
|
|
|
- cet.education_name,
|
|
|
- cpt.project_name,
|
|
|
- cb.business_name
|
|
|
+ og.*,
|
|
|
+ g.`code`,
|
|
|
+ g.goods_name,
|
|
|
+ g.goods_type,
|
|
|
+ g.cover_url,
|
|
|
+ cet.education_name,
|
|
|
+ cpt.project_name,
|
|
|
+ cb.business_name
|
|
|
FROM
|
|
|
- order_goods og
|
|
|
- LEFT JOIN goods g ON og.goods_id = g.goods_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 `order` o ON o.order_sn = og.order_sn
|
|
|
+ order_goods og
|
|
|
+ LEFT JOIN goods g ON og.goods_id = g.goods_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 `order` o ON o.order_sn = og.order_sn
|
|
|
WHERE
|
|
|
- 1 = 1
|
|
|
- and og.status = 1
|
|
|
- <if test="refundStatusList != null and refundStatusList.size()!=0 ">
|
|
|
- AND og.refund_status in
|
|
|
- <foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="goodsId != null and goodsId != ''">
|
|
|
- AND og.goods_id = #{goodsId}
|
|
|
- </if>
|
|
|
- <if test="userId != null">
|
|
|
- AND o.user_id = #{userId}
|
|
|
- </if>
|
|
|
- <if test="orderSn != null and orderSn != ''">
|
|
|
- AND og.order_sn = #{orderSn}
|
|
|
- </if>
|
|
|
- <if test="payStatusList != null and payStatusList.size()!=0 ">
|
|
|
- AND og.pay_status in
|
|
|
- <foreach collection="payStatusList" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="orderGoodsIds != null and orderGoodsIds.size()!=0 ">
|
|
|
- AND og.order_goods_id in
|
|
|
- <foreach collection="orderGoodsIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
+ 1 = 1
|
|
|
+ and og.status = 1
|
|
|
+ <if test="refundStatusList != null and refundStatusList.size()!=0 ">
|
|
|
+ AND og.refund_status in
|
|
|
+ <foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="goodsId != null and goodsId != ''">
|
|
|
+ AND og.goods_id = #{goodsId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ AND o.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="orderSn != null and orderSn != ''">
|
|
|
+ AND og.order_sn = #{orderSn}
|
|
|
+ </if>
|
|
|
+ <if test="payStatusList != null and payStatusList.size()!=0 ">
|
|
|
+ AND og.pay_status in
|
|
|
+ <foreach collection="payStatusList" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="orderGoodsIds != null and orderGoodsIds.size()!=0 ">
|
|
|
+ AND og.order_goods_id in
|
|
|
+ <foreach collection="orderGoodsIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectDetail" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
+ <select id="selectDetail" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
SELECT
|
|
|
og.*,
|
|
|
o.order_status,
|
|
@@ -175,111 +177,117 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
LEFT JOIN `order` o ON og.order_sn = o.order_sn
|
|
|
LEFT JOIN class_grade_user cgu on cgu.user_id = o.user_id and cgu.grade_id = cg.grade_id
|
|
|
WHERE
|
|
|
- 1=1
|
|
|
+ 1=1
|
|
|
<if test="orderSn != null and orderSn != ''">
|
|
|
- AND og.order_sn = #{orderSn} AND og.goods_id = #{goodsId}
|
|
|
+ AND og.order_sn = #{orderSn} AND og.goods_id = #{goodsId}
|
|
|
</if>
|
|
|
<if test="orderGoodsId != null and orderGoodsId != ''">
|
|
|
- AND og.order_goods_id= #{orderGoodsId}
|
|
|
+ AND og.order_goods_id= #{orderGoodsId}
|
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectOrderGoods" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
- SELECT
|
|
|
- og.*,
|
|
|
- o.user_id
|
|
|
- FROM
|
|
|
- `order` o
|
|
|
- LEFT JOIN order_goods og on o.order_sn = og.order_sn
|
|
|
- where 1=1
|
|
|
- and og.`status` = 1
|
|
|
- and og.refund_status in (0,1,3)
|
|
|
- and og.pay_status in (2,3,4)
|
|
|
- AND (SELECT COUNT(1) FROM inform_user iu where iu.user_id = o.user_id and iu.goods_id = og.goods_id and system_status = 1) < 1
|
|
|
+ <select id="selectOrderGoods" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
+ SELECT og.*,
|
|
|
+ o.user_id
|
|
|
+ FROM `order` o
|
|
|
+ LEFT JOIN order_goods og on o.order_sn = og.order_sn
|
|
|
+ where 1 = 1
|
|
|
+ and og.`status` = 1
|
|
|
+ and og.refund_status in (0, 1, 3)
|
|
|
+ and og.pay_status in (2, 3, 4)
|
|
|
+ AND (SELECT COUNT(1)
|
|
|
+ FROM inform_user iu
|
|
|
+ where iu.user_id = o.user_id and iu.goods_id = og.goods_id and system_status = 1) < 1
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectOrderTwoGoods" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
- SELECT
|
|
|
- og.*,
|
|
|
- o.user_id
|
|
|
- FROM
|
|
|
- `order` o
|
|
|
- LEFT JOIN order_goods og on o.order_sn = og.order_sn
|
|
|
- where 1=1
|
|
|
- and og.`status` = 1
|
|
|
- and og.refund_status in (0,1,3)
|
|
|
- and og.pay_status in (2,3,4)
|
|
|
- AND (SELECT COUNT(1) FROM inform_user iu where iu.user_id = o.user_id and iu.goods_id = og.goods_id and system_status = 3) < 1
|
|
|
+ <select id="selectOrderTwoGoods" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
+ SELECT og.*,
|
|
|
+ o.user_id
|
|
|
+ FROM `order` o
|
|
|
+ LEFT JOIN order_goods og on o.order_sn = og.order_sn
|
|
|
+ where 1 = 1
|
|
|
+ and og.`status` = 1
|
|
|
+ and og.refund_status in (0, 1, 3)
|
|
|
+ and og.pay_status in (2, 3, 4)
|
|
|
+ AND (SELECT COUNT(1)
|
|
|
+ FROM inform_user iu
|
|
|
+ where iu.user_id = o.user_id and iu.goods_id = og.goods_id and system_status = 3) < 1
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="sendGoods" resultMap="OrderGoodsResultVo">
|
|
|
- SELECT
|
|
|
- og.*,
|
|
|
- o.user_id
|
|
|
- FROM
|
|
|
- `order` o
|
|
|
- LEFT JOIN order_goods og on o.order_sn = og.order_sn
|
|
|
- where 1=1
|
|
|
- and og.`status` = 1
|
|
|
- and og.refund_status in (0,1,3)
|
|
|
- and og.pay_status in (2,3,4)
|
|
|
- and (SELECT COUNT(1) FROM user_exam_goods ueg where ueg.user_id = o.user_id and og.goods_id = ueg.goods_id) < 1
|
|
|
- and (SELECT COUNT(1) FROM exam_number en LEFT JOIN exam_number_goods eng on en.exam_number_id = eng.exam_number_id where eng.goods_id = og.goods_id and en.`status` = 1) > 0
|
|
|
+ <select id="sendGoods" resultMap="OrderGoodsResultVo">
|
|
|
+ SELECT og.*,
|
|
|
+ o.user_id
|
|
|
+ FROM `order` o
|
|
|
+ LEFT JOIN order_goods og on o.order_sn = og.order_sn
|
|
|
+ where 1 = 1
|
|
|
+ and og.`status` = 1
|
|
|
+ and og.refund_status in (0, 1, 3)
|
|
|
+ and og.pay_status in (2, 3, 4)
|
|
|
+ and (SELECT COUNT(1)
|
|
|
+ FROM user_exam_goods ueg
|
|
|
+ where ueg.user_id = o.user_id and og.goods_id = ueg.goods_id) < 1
|
|
|
+ and (SELECT COUNT(1)
|
|
|
+ FROM exam_number en
|
|
|
+ LEFT JOIN exam_number_goods eng on en.exam_number_id = eng.exam_number_id
|
|
|
+ where eng.goods_id = og.goods_id
|
|
|
+ and en.`status` = 1) > 0
|
|
|
</select>
|
|
|
|
|
|
<select id="getBuyGoodsHistory" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultType="Long">
|
|
|
- SELECT
|
|
|
- ifnull(count(*),0) num
|
|
|
- FROM
|
|
|
- `order` o
|
|
|
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
- WHERE
|
|
|
- o.user_id = #{userId}
|
|
|
+ SELECT ifnull(count(*), 0) num
|
|
|
+ FROM `order` o
|
|
|
+ LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
+ WHERE o.user_id = #{userId}
|
|
|
AND og.goods_id = #{goodsId}
|
|
|
AND og.`status` = 1
|
|
|
- AND og.pay_status > 1 AND og.refund_status != 2
|
|
|
+ AND og.pay_status > 1
|
|
|
+ AND og.refund_status != 2
|
|
|
</select>
|
|
|
- <select id="getBuyGoodsReadyPay" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultType="Long">
|
|
|
- SELECT
|
|
|
- ifnull(count(*),0) num
|
|
|
- FROM
|
|
|
- `order` o
|
|
|
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
- WHERE
|
|
|
- o.user_id = #{userId}
|
|
|
+ <select id="getBuyGoodsReadyPay" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultType="Long">
|
|
|
+ SELECT ifnull(count(*), 0) num
|
|
|
+ FROM `order` o
|
|
|
+ LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
+ WHERE o.user_id = #{userId}
|
|
|
AND og.goods_id = #{goodsId}
|
|
|
AND o.order_status = 0
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="rebuyInfo" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
- SELECT
|
|
|
- og.order_sn,
|
|
|
- g.goods_name,
|
|
|
- cg.class_name
|
|
|
- FROM
|
|
|
- order_goods og
|
|
|
- LEFT JOIN goods g ON og.goods_id = g.goods_id
|
|
|
- LEFT JOIN class_grade cg ON og.grade_id = cg.grade_id
|
|
|
- LEFT JOIN `order` o on og.order_sn = o.order_sn
|
|
|
- LEFT JOIN class_grade_user cgu ON cgu.grade_id = cg.grade_id and cgu.user_id = #{userId}
|
|
|
- WHERE
|
|
|
- o.user_id = #{userId} and og.goods_id = #{goodsId} and og.pay_status in (2,3,4) and og.order_goods_id != #{orderGoodsId} and cgu.period_plush = 1
|
|
|
+ <select id="rebuyInfo" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
+ SELECT og.order_sn,
|
|
|
+ g.goods_name,
|
|
|
+ cg.class_name
|
|
|
+ FROM order_goods og
|
|
|
+ LEFT JOIN goods g ON og.goods_id = g.goods_id
|
|
|
+ LEFT JOIN class_grade cg ON og.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN `order` o on og.order_sn = o.order_sn
|
|
|
+ LEFT JOIN class_grade_user cgu ON cgu.grade_id = cg.grade_id and cgu.user_id = #{userId}
|
|
|
+ WHERE o.user_id = #{userId}
|
|
|
+ and og.goods_id = #{goodsId}
|
|
|
+ and og.pay_status in (2, 3, 4)
|
|
|
+ and og.order_goods_id != #{orderGoodsId}
|
|
|
+ and cgu.period_plush = 1
|
|
|
</select>
|
|
|
|
|
|
- <select id="gradeGoods" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
- SELECT
|
|
|
- og.*
|
|
|
- FROM
|
|
|
- order_goods og
|
|
|
- LEFT JOIN `order` o on og.order_sn = o.order_sn
|
|
|
- WHERE
|
|
|
- o.user_id = #{userId} and og.grade_id = #{gradeId} and og.pay_status in (2,3,4) and og.refund_status !=2
|
|
|
+ <select id="gradeGoods" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
+ SELECT og.*
|
|
|
+ FROM order_goods og
|
|
|
+ LEFT JOIN `order` o on og.order_sn = o.order_sn
|
|
|
+ WHERE o.user_id = #{userId}
|
|
|
+ and og.grade_id = #{gradeId}
|
|
|
+ and og.pay_status in (2, 3, 4)
|
|
|
+ and og.refund_status !=2
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectCanInvoiceList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
+ <select id="selectCanInvoiceList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
SELECT
|
|
|
og.*,
|
|
|
g.`code`,
|
|
@@ -299,7 +307,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
order_invoice oi
|
|
|
LEFT JOIN order_invoice_order oio ON oi.invoice_id = oio.invoice_id
|
|
|
WHERE
|
|
|
- oi.period_status IN ( 1, 3 ) and oi.user_id = #{userId} and oi.status != -1 and oio.order_goods_id is not NULL)
|
|
|
+ oi.period_status IN ( 1, 3 ) and oi.user_id = #{userId} and oi.status != -1 and oio.order_goods_id is not NULL)
|
|
|
<if test="refundStatusList != null and refundStatusList.size()!=0 ">
|
|
|
AND og.refund_status in
|
|
|
<foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">
|
|
@@ -313,7 +321,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
AND o.user_id = #{userId}
|
|
|
</if>
|
|
|
<if test="orderSn != null and orderSn != ''">
|
|
|
- AND og.order_sn = #{orderSn}
|
|
|
+ AND og.order_sn = #{orderSn}
|
|
|
</if>
|
|
|
<if test="payStatusList != null and payStatusList.size()!=0 ">
|
|
|
AND og.pay_status in
|
|
@@ -329,22 +337,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectBuyGoodsUserList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
- SELECT
|
|
|
- DISTINCT u.user_id,
|
|
|
- u.realname
|
|
|
- FROM
|
|
|
- order_goods og
|
|
|
- LEFT JOIN `order` o ON og.order_sn = o.order_sn
|
|
|
- LEFT JOIN `user` u ON o.user_id = u.user_id
|
|
|
- WHERE
|
|
|
- og.`status` = 1
|
|
|
- AND og.refund_status IN ( 0, 1, 3 )
|
|
|
- AND og.pay_status IN ( 2, 3, 4 )
|
|
|
+ <select id="selectBuyGoodsUserList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
+ SELECT DISTINCT u.user_id,
|
|
|
+ u.realname
|
|
|
+ FROM order_goods og
|
|
|
+ LEFT JOIN `order` o ON og.order_sn = o.order_sn
|
|
|
+ LEFT JOIN `user` u ON o.user_id = u.user_id
|
|
|
+ WHERE og.`status` = 1
|
|
|
+ AND og.refund_status IN (0, 1, 3)
|
|
|
+ AND og.pay_status IN (2, 3, 4)
|
|
|
AND og.goods_id = #{goodsId}
|
|
|
</select>
|
|
|
|
|
|
- <select id="listLiveGoodsList" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
+ <select id="listLiveGoodsList" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
SELECT
|
|
|
g.*,
|
|
|
o.user_id,
|
|
@@ -381,36 +388,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
AND og.goods_id = #{goodsId}
|
|
|
</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}, '%'))
|
|
|
+ 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="listGoodsUserLive" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
+ <select id="listGoodsUserLive" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
SELECT
|
|
|
- g.*,
|
|
|
- cet.education_name,
|
|
|
- cpt.project_name,
|
|
|
- cb.business_name,
|
|
|
- o.user_id,
|
|
|
- og.create_time as order_create_time,
|
|
|
- og.service_start_time,
|
|
|
- og.service_end_time,
|
|
|
- og.order_goods_id
|
|
|
+ g.*,
|
|
|
+ cet.education_name,
|
|
|
+ cpt.project_name,
|
|
|
+ cb.business_name,
|
|
|
+ o.user_id,
|
|
|
+ og.create_time as order_create_time,
|
|
|
+ og.service_start_time,
|
|
|
+ og.service_end_time,
|
|
|
+ og.order_goods_id
|
|
|
FROM
|
|
|
- order_goods og
|
|
|
- LEFT JOIN goods g on g.goods_id =og.goods_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 `order` o on o.order_sn = og.order_sn
|
|
|
+ order_goods og
|
|
|
+ LEFT JOIN goods g on g.goods_id =og.goods_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 `order` o on o.order_sn = og.order_sn
|
|
|
WHERE
|
|
|
- 1 = 1
|
|
|
- AND g.goods_type = 6
|
|
|
- AND o.user_id=#{userId}
|
|
|
- AND og.`status` =1
|
|
|
- and og.pay_status in (2,3,4)
|
|
|
- AND og.refund_status in (0,3,1)
|
|
|
+ 1 = 1
|
|
|
+ AND g.goods_type = 6
|
|
|
+ AND o.user_id=#{userId}
|
|
|
+ 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>
|
|
@@ -420,7 +429,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
ORDER BY og.create_time DESC
|
|
|
</select>
|
|
|
|
|
|
- <select id="listUserVideoLive" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
+ <select id="listUserVideoLive" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
SELECT
|
|
|
g.*,
|
|
|
cet.education_name,
|
|
@@ -435,12 +445,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
(SELECT
|
|
|
COUNT( m.id )
|
|
|
FROM
|
|
|
- goods_course c LEFT JOIN course_menu_exam m ON m.course_id = c.course_id
|
|
|
+ goods_course c LEFT JOIN course_menu_exam m ON m.course_id = c.course_id
|
|
|
where
|
|
|
m.type = 1
|
|
|
and c.goods_id = g.goods_id) as exam_num,
|
|
|
- (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
|
|
|
- = ubr.goods_id where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = og.grade_id and ubr.user_id = o.user_id and ubr.current_status = 1) as record_num
|
|
|
+ (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr LEFT JOIN
|
|
|
+ class_grade_goods cgg on cgg.goods_id
|
|
|
+ = ubr.goods_id where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = og.grade_id and ubr.user_id =
|
|
|
+ o.user_id and ubr.current_status = 1) as record_num
|
|
|
FROM
|
|
|
order_goods og
|
|
|
LEFT JOIN goods g on g.goods_id =og.goods_id
|
|
@@ -465,136 +477,138 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="listUserSubjectGoods" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo" resultMap="OrderGoodsResultVo">
|
|
|
+ <select id="listUserSubjectGoods" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo"
|
|
|
+ resultMap="OrderGoodsResultVo">
|
|
|
SELECT
|
|
|
- og.goods_id,
|
|
|
- og.grade_id,
|
|
|
- og.order_sn,
|
|
|
- g.business_id,
|
|
|
- g.subject_ids,
|
|
|
- cg.class_status,
|
|
|
- cg.class_start_time,
|
|
|
- cg.class_end_time,
|
|
|
- cg.class_name,
|
|
|
- g.goods_name,
|
|
|
- og.goods_price,
|
|
|
- og.goods_real_price
|
|
|
+ og.goods_id,
|
|
|
+ og.grade_id,
|
|
|
+ og.order_sn,
|
|
|
+ g.business_id,
|
|
|
+ g.subject_ids,
|
|
|
+ cg.class_status,
|
|
|
+ cg.class_start_time,
|
|
|
+ cg.class_end_time,
|
|
|
+ cg.class_name,
|
|
|
+ g.goods_name,
|
|
|
+ og.goods_price,
|
|
|
+ og.goods_real_price
|
|
|
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 class_grade cg ON og.grade_id = cg.grade_id
|
|
|
+ `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 class_grade cg ON og.grade_id = cg.grade_id
|
|
|
WHERE
|
|
|
- o.user_id = #{userId}
|
|
|
+ o.user_id = #{userId}
|
|
|
AND og.`status` =1
|
|
|
and og.pay_status in (2,3,4)
|
|
|
AND og.refund_status in (0,3,1)
|
|
|
- <if test="businessId != null and businessId != ''">
|
|
|
- AND g.business_id = #{businessId}
|
|
|
- </if>
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
<if test="subjectId != null and subjectId != ''">
|
|
|
- AND FIND_IN_SET(#{subjectId},g.subject_ids)
|
|
|
+ AND FIND_IN_SET(#{subjectId},g.subject_ids)
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="selectBuyUserList" parameterType="java.lang.Long" resultMap="OrderGoodsResultVo">
|
|
|
- SELECT
|
|
|
- og.*,
|
|
|
- o.user_id
|
|
|
- FROM
|
|
|
- order_goods og
|
|
|
- LEFT JOIN `order` o ON og.order_sn = o.order_sn
|
|
|
- LEFT JOIN mock_major_subject_goods mmsg ON og.goods_id = mmsg.goods_id
|
|
|
- WHERE
|
|
|
- og.refund_status != 2
|
|
|
+ SELECT og.*,
|
|
|
+ o.user_id
|
|
|
+ FROM order_goods og
|
|
|
+ LEFT JOIN `order` o ON og.order_sn = o.order_sn
|
|
|
+ LEFT JOIN mock_major_subject_goods mmsg ON og.goods_id = mmsg.goods_id
|
|
|
+ WHERE og.refund_status != 2
|
|
|
and og.pay_status in (2,3,4)
|
|
|
and og.`status` = 1
|
|
|
and mmsg.mock_major_subject_id = #{mockMajorSubjectId}
|
|
|
</select>
|
|
|
<select id="getLiveList" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.course.vo.CourseLiveVo">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- gc.course_id AS courseId,
|
|
|
- og.order_goods_id AS orderGoodId,
|
|
|
- g.goods_id AS goodId,
|
|
|
- cm.menu_id AS chapterId,
|
|
|
- '' AS moduleId,
|
|
|
- ct.*
|
|
|
- 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
|
|
|
- INNER JOIN goods_course gc ON g.goods_id = gc.goods_id
|
|
|
- LEFT JOIN course_menu cm ON gc.course_id = cm.course_id
|
|
|
- LEFT JOIN course_chapter_section cs ON cm.menu_id = cs.chapter_id
|
|
|
- LEFT JOIN course_section ct ON cs.section_id = ct.section_id
|
|
|
- WHERE
|
|
|
- o.user_id = #{userId}
|
|
|
- AND o.order_status = 1
|
|
|
- AND og.pay_status IN ( 2, 3, 4 )
|
|
|
- AND og.refund_status != 2
|
|
|
- AND og.STATUS = 1
|
|
|
- AND o.`status` = 1
|
|
|
- AND g.`status` = 1
|
|
|
- AND g.goods_type = 6
|
|
|
- AND cm.type = 2
|
|
|
- AND ct.section_type = 2 UNION ALL
|
|
|
- SELECT
|
|
|
- gc.course_id AS courseId,
|
|
|
- og.order_goods_id AS orderGoodId,
|
|
|
- g.goods_id AS goodId,
|
|
|
- '' AS chapterId,
|
|
|
- '' AS moduleId,
|
|
|
- ct.*
|
|
|
- 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
|
|
|
- INNER JOIN goods_course gc ON g.goods_id = gc.goods_id
|
|
|
- LEFT JOIN course_menu cm ON gc.course_id = cm.course_id
|
|
|
- LEFT JOIN course_section ct ON cm.menu_id = ct.section_id
|
|
|
- WHERE
|
|
|
- o.user_id = #{userId}
|
|
|
- AND o.order_status = 1
|
|
|
- AND og.pay_status IN ( 2, 3, 4 )
|
|
|
- AND og.refund_status != 2
|
|
|
- AND og.STATUS = 1
|
|
|
- AND o.`status` = 1
|
|
|
- AND g.`status` = 1
|
|
|
- AND g.goods_type = 6
|
|
|
- AND cm.type = 3
|
|
|
- AND ct.section_type = 2 UNION ALL
|
|
|
- SELECT
|
|
|
- gc.course_id AS courseId,
|
|
|
- og.order_goods_id AS orderGoodId,
|
|
|
- g.goods_id AS goodId,
|
|
|
- cmc.chapter_id AS chapterId,
|
|
|
- cmc.module_id AS moduleId,
|
|
|
- ct.*
|
|
|
- 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
|
|
|
- INNER JOIN goods_course gc ON g.goods_id = gc.goods_id
|
|
|
- LEFT JOIN course_menu cm ON gc.course_id = cm.course_id
|
|
|
- LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
|
|
|
- LEFT JOIN course_chapter_section ccs ON cmc.chapter_id = ccs.chapter_id
|
|
|
- LEFT JOIN course_section ct ON ccs.section_id = ct.section_id
|
|
|
- WHERE
|
|
|
- o.user_id = #{userId}
|
|
|
- AND o.order_status = 1
|
|
|
- AND og.pay_status IN ( 2, 3, 4 )
|
|
|
- AND og.refund_status != 2
|
|
|
- AND og.STATUS = 1
|
|
|
- AND o.`status` = 1
|
|
|
- AND g.`status` = 1
|
|
|
- AND g.goods_type = 6
|
|
|
- AND cm.type = 1
|
|
|
- AND ct.section_type = 2
|
|
|
- ) a
|
|
|
- ORDER BY
|
|
|
- a.live_start_time ASC
|
|
|
+ SELECT *
|
|
|
+ FROM course_section
|
|
|
+ WHERE section_id IN (
|
|
|
+ SELECT a.section_id
|
|
|
+ FROM (
|
|
|
+ SELECT gc.course_id AS courseId,
|
|
|
+ og.order_goods_id AS orderGoodId,
|
|
|
+ g.goods_id AS goodsId,
|
|
|
+ cm.menu_id AS chapterId,
|
|
|
+ '' AS moduleId,
|
|
|
+ ct.*
|
|
|
+ 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
|
|
|
+ INNER JOIN goods_course gc ON g.goods_id = gc.goods_id
|
|
|
+ LEFT JOIN course_menu cm ON gc.course_id = cm.course_id
|
|
|
+ LEFT JOIN course_chapter_section cs ON cm.menu_id = cs.chapter_id
|
|
|
+ LEFT JOIN course_section ct ON cs.section_id = ct.section_id
|
|
|
+ WHERE o.user_id = #{userId}
|
|
|
+ AND o.order_status = 1
|
|
|
+ AND og.pay_status IN (2, 3, 4)
|
|
|
+ AND og.refund_status != 2
|
|
|
+ AND og.STATUS = 1
|
|
|
+ AND o.`status` = 1
|
|
|
+ AND g.`status` = 1
|
|
|
+ AND cm.type = 2
|
|
|
+ AND ct.section_type = 2
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ gc.course_id AS courseId,
|
|
|
+ og.order_goods_id AS orderGoodId,
|
|
|
+ g.goods_id AS goodsId,
|
|
|
+ '' AS chapterId,
|
|
|
+ '' AS moduleId,
|
|
|
+ ct.*
|
|
|
+ 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
|
|
|
+ INNER JOIN goods_course gc ON g.goods_id = gc.goods_id
|
|
|
+ LEFT JOIN course_menu cm ON gc.course_id = cm.course_id
|
|
|
+ LEFT JOIN course_section ct ON cm.menu_id = ct.section_id
|
|
|
+ WHERE
|
|
|
+ o.user_id = #{userId}
|
|
|
+ AND o.order_status = 1
|
|
|
+ AND og.pay_status IN ( 2
|
|
|
+ , 3
|
|
|
+ , 4 )
|
|
|
+ AND og.refund_status != 2
|
|
|
+ AND og.STATUS = 1
|
|
|
+ AND o.`status` = 1
|
|
|
+ AND g.`status` = 1
|
|
|
+ AND cm.type = 3
|
|
|
+ AND ct.section_type = 2
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ gc.course_id AS courseId,
|
|
|
+ og.order_goods_id AS orderGoodId,
|
|
|
+ g.goods_id AS goodsId,
|
|
|
+ cmc.chapter_id AS chapterId,
|
|
|
+ cmc.module_id AS moduleId,
|
|
|
+ ct.*
|
|
|
+ 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
|
|
|
+ INNER JOIN goods_course gc ON g.goods_id = gc.goods_id
|
|
|
+ LEFT JOIN course_menu cm ON gc.course_id = cm.course_id
|
|
|
+ LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
|
|
|
+ LEFT JOIN course_chapter_section ccs ON cmc.chapter_id = ccs.chapter_id
|
|
|
+ LEFT JOIN course_section ct ON ccs.section_id = ct.section_id
|
|
|
+ WHERE
|
|
|
+ o.user_id = #{userId}
|
|
|
+ AND o.order_status = 1
|
|
|
+ AND og.pay_status IN ( 2
|
|
|
+ , 3
|
|
|
+ , 4 )
|
|
|
+ AND og.refund_status != 2
|
|
|
+ AND og.STATUS = 1
|
|
|
+ AND o.`status` = 1
|
|
|
+ AND g.`status` = 1
|
|
|
+ AND cm.type = 1
|
|
|
+ AND ct.section_type = 2
|
|
|
+ ) a
|
|
|
+ GROUP BY a.section_id
|
|
|
+ )
|
|
|
+ ORDER BY live_start_time ASC
|
|
|
</select>
|
|
|
</mapper>
|