|
@@ -1041,4 +1041,193 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectWithoutListByBo" parameterType="com.zhongzheng.modules.order.bo.OrderQueryBo" resultMap="OrderResultVo">
|
|
|
+ SELECT
|
|
|
+ o.*,
|
|
|
+ g.goods_id,
|
|
|
+ g.goods_name,
|
|
|
+ g.year,
|
|
|
+ g.cover_url,
|
|
|
+ g.code,
|
|
|
+ g.goods_type,
|
|
|
+ og.goods_price,
|
|
|
+ og.rebuy_order_goods_id,
|
|
|
+ og.order_goods_id,
|
|
|
+ og.goods_real_price,
|
|
|
+ og.offline_refund_sign,
|
|
|
+ u.telphone,
|
|
|
+ u.realname,
|
|
|
+ u.id_card,
|
|
|
+ u.company_name,
|
|
|
+ cet.education_name,
|
|
|
+ cpt.project_name,
|
|
|
+ cb.business_name,
|
|
|
+ s.school_name,
|
|
|
+ m.category_name,
|
|
|
+ og.goods_received,
|
|
|
+ og.refund_status,
|
|
|
+ og.pay_status as goods_pay_status,
|
|
|
+ (select cgu.period_plush from class_grade_user cgu where cgu.grade_id = og.grade_id and cgu.order_goods_id = og.order_goods_id and cgu.user_id = o.user_id limit 1 ) period_plush,
|
|
|
+ (SELECT oi.invoice_status FROM order_invoice oi LEFT JOIN order_invoice_order oio ON oio.invoice_id = oi.invoice_id WHERE
|
|
|
+ oio.order_goods_id = og.order_goods_id AND oi.period_status != 2 limit 1) invoice_status
|
|
|
+ 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 `user` u ON o.user_id = u.user_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
|
|
|
+ WHERE 1=1
|
|
|
+ AND o.order_type = 3
|
|
|
+ <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="schoolId != null and schoolId != ''">
|
|
|
+ AND g.school_id = #{schoolId}
|
|
|
+ </if>
|
|
|
+ <if test="majorId != null and majorId != ''">
|
|
|
+ AND g.major_id = #{majorId}
|
|
|
+ </if>
|
|
|
+ <if test="orderSn != null and orderSn != ''">
|
|
|
+ AND o.order_sn = #{orderSn}
|
|
|
+ </if>
|
|
|
+ <if test="orderStatus != null ">
|
|
|
+ AND o.order_status in
|
|
|
+ <foreach collection="orderStatus" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="status != null ">
|
|
|
+ AND o.status in
|
|
|
+ <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="orderGoodsStatus == 1">
|
|
|
+ AND og.pay_status in (2,3,4) AND og.refund_status != 2
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ AND o.create_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ AND #{endTime} >= o.create_time
|
|
|
+ </if>
|
|
|
+ <if test="payStatus != null">
|
|
|
+ AND o.pay_status = #{payStatus}
|
|
|
+ </if>
|
|
|
+ <if test="goodsPayStatus != null">
|
|
|
+ AND og.pay_status = #{goodsPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="refundStatus != null">
|
|
|
+ AND og.refund_status = #{refundStatus}
|
|
|
+ </if>
|
|
|
+ <if test="goodsType != null">
|
|
|
+ AND g.goods_type = #{goodsType}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ AND u.user_id = #{userId}
|
|
|
+ AND og.pay_status in (2,3,4)
|
|
|
+ </if>
|
|
|
+ <if test="inputOrderSn != null">
|
|
|
+ AND o.input_order_sn = #{inputOrderSn}
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
+ AND u.company_name like concat('%', #{companyName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="searchKey != null and searchKey != ''">
|
|
|
+ AND (u.realname like concat('%', #{searchKey}, '%') or o.order_sn = #{searchKey} or AES_DECRYPT(UNHEX(u.id_card),'base20230213zzkj') = #{searchKey} or g.goods_name like concat('%', #{searchKey}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="orderGoodsIds != null ">
|
|
|
+ AND og.order_goods_id in
|
|
|
+ <foreach collection="orderGoodsIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="orderFroms != null and orderFroms.size()!=0">
|
|
|
+ AND o.order_from in
|
|
|
+ <foreach collection="orderFroms" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ORDER BY o.order_id DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getUserStudyCondition" parameterType="com.zhongzheng.modules.order.bo.UserStudyConditionBo" resultType="com.zhongzheng.modules.order.vo.UserStudyConditionVo">
|
|
|
+ SELECT
|
|
|
+ o.order_sn,
|
|
|
+ FROM_UNIXTIME( og.create_time, '%Y-%m-%d %H:%i:%s' ) AS orderTime,
|
|
|
+ u.realname AS userName,
|
|
|
+ AES_DECRYPT(UNHEX(u.id_card),'base20230213zzkj') AS userCard,
|
|
|
+ AES_DECRYPT(UNHEX(u.telphone),'base20230213zzkj') AS userPhone,
|
|
|
+ u.company_name AS companyName,
|
|
|
+ g.goods_name AS goodsName,
|
|
|
+ g.seven_year AS sevenYear,
|
|
|
+ CONCAT(cet.education_name,cb.business_name,cpt.project_name) AS businessName,
|
|
|
+ m.category_name AS majorName,
|
|
|
+ cg.class_name AS className,
|
|
|
+ CASE
|
|
|
+ WHEN cg.class_status = 1 THEN '已开班'
|
|
|
+ WHEN cg.class_status = 0 THEN '未开班'
|
|
|
+ ELSE '其他' END AS classStatus,
|
|
|
+ FROM_UNIXTIME( cg.class_end_time, '%Y-%m-%d %H:%i:%s' ) AS classEndTime,
|
|
|
+ CONCAT((
|
|
|
+ ((SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = og.grade_id and ubr.order_goods_id = og.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) +
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ COUNT( DISTINCT course_id, module_id, chapter_id, section_id )
|
|
|
+ FROM
|
|
|
+ user_study_record
|
|
|
+ WHERE
|
|
|
+ current_status = 1
|
|
|
+ AND grade_id = og.grade_id
|
|
|
+ AND order_goods_id = og.order_goods_id
|
|
|
+ AND user_id = o.user_id
|
|
|
+ AND status = 1
|
|
|
+ AND goods_id = og.goods_id
|
|
|
+ ))
|
|
|
+ ),"/",og.course_num + og.exam_num) AS studySchedule
|
|
|
+ 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 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 major m ON g.major_id = m.id
|
|
|
+ LEFT JOIN `user` u ON o.user_id = u.user_id
|
|
|
+ LEFT JOIN class_grade_user cgu ON og.order_goods_id = cgu.order_goods_id
|
|
|
+ LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
|
|
|
+ WHERE
|
|
|
+ 1=1
|
|
|
+ AND og.pay_status != 1
|
|
|
+ AND og.refund_status != 2
|
|
|
+ AND o.`status` = 1
|
|
|
+ AND og.`status` = 1
|
|
|
+ AND cgu.`status` = 1
|
|
|
+ <if test="tenantId != null and tenantId != ''">
|
|
|
+ AND o.tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="userCard != null and userCard != ''">
|
|
|
+ AND AES_DECRYPT(UNHEX(u.id_card),'base20230213zzkj') = #{userCard}
|
|
|
+ </if>
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
+ AND u.realname = #{userName}
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
+ AND u.company_name = #{companyName}
|
|
|
+ </if>
|
|
|
+ <if test="businessName != null and businessName != ''">
|
|
|
+ AND INSTR(CONCAT(cet.education_name,cb.business_name,cpt.project_name),#{businessName})
|
|
|
+ </if>
|
|
|
+ <if test="majorName != null and majorName != ''">
|
|
|
+ AND m.category_name = #{majorName}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|