| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <?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.order.mapper.OrderMapper">
- <resultMap type="com.zhongzheng.modules.order.domain.Order" id="OrderResult">
- <result property="orderId" column="order_id"/>
- <result property="orderSn" column="order_sn"/>
- <result property="userId" column="user_id"/>
- <result property="orderPrice" column="order_price"/>
- <result property="orderGeneral" column="order_general"/>
- <result property="orderStatus" column="order_status"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="payTime" column="pay_time"/>
- <result property="payType" column="pay_type"/>
- <result property="transid" column="transid"/>
- <result property="cancelTime" column="cancel_time"/>
- <result property="finishTime" column="finish_time"/>
- <result property="orderType" column="order_type"/>
- <result property="payPrice" column="pay_price"/>
- <result property="chargingType" column="charging_type"/>
- <result property="orderFrom" column="order_from"/>
- <result property="createUsername" column="create_username"/>
- <result property="createSysUserId" column="create_sys_user_id"/>
- <result property="inputOrderSn" column="input_order_sn"/>
- <result property="payStatus" column="pay_status"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.order.vo.OrderListVo" id="OrderResultVo">
- <result property="orderId" column="order_id"/>
- <result property="orderSn" column="order_sn"/>
- <result property="userId" column="user_id"/>
- <result property="orderPrice" column="order_price"/>
- <result property="orderGeneral" column="order_general"/>
- <result property="orderStatus" column="order_status"/>
- <result property="createTime" column="create_time"/>
- <result property="payTime" column="pay_time"/>
- <result property="payType" column="pay_type"/>
- <result property="transid" column="transid"/>
- <result property="cancelTime" column="cancel_time"/>
- <result property="finishTime" column="finish_time"/>
- <result property="orderType" column="order_type"/>
- <result property="payPrice" column="pay_price"/>
- <result property="chargingType" column="charging_type"/>
- <result property="orderFrom" column="order_from"/>
- <result property="status" column="status"/>
- <result property="goodsName" column="goods_name"/>
- <result property="goodsId" column="goods_id"/>
- <result property="year" column="year"/>
- <result property="coverUrl" column="cover_url"/>
- <result property="code" column="code"/>
- <result property="rebuyOrderGoodsId" column="rebuy_order_goods_id"/>
- <result property="educationName" column="education_name"/>
- <result property="projectName" column="project_name"/>
- <result property="businessName" column="business_name"/>
- <result property="schoolName" column="school_name"/>
- <result property="categoryName" column="category_name"/>
- <result property="goodsPrice" column="goods_price"/>
- <result property="goodsRealPrice" column="goods_real_price"/>
- <result property="idCard" column="id_card"/>
- <result property="telphone" column="telphone"/>
- <result property="realname" column="realname"/>
- <result property="goodsReceived" column="goods_received"/>
- <result property="refundStatus" column="refund_status"/>
- <result property="payStatus" column="pay_status"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="periodPlush" column="period_plush"/>
- <result property="goodsPayStatus" column="goods_pay_status"/>
- <result property="goodsType" column="goods_type"/>
- <result property="invoiceStatus" column="invoice_status"/>
- </resultMap>
- <select id="getGradePeriod" parameterType="Map" resultType="integer">
- SELECT
- cgu.period_plush
- FROM
- order_goods og
- LEFT JOIN class_grade_user cgu ON og.grade_id = cgu.grade_id
- AND cgu.user_id = #{userId} where og.order_goods_id = #{orderGoodsId}
- </select>
- <select id="selectList" 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,
- u.telphone,
- u.realname,
- u.id_card,
- 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.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) 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
- <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="startTime != null">
- AND o.create_time >= #{startTime}
- </if>
- <if test="endTime != null">
- AND #{endTime} >= o.create_time
- </if>
- <if test="payStatus != null">
- AND og.pay_status = #{payStatus}
- </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)
- </if>
- <if test="inputOrderSn != null">
- AND o.input_order_sn = #{inputOrderSn}
- </if>
- <if test="searchKey != null and searchKey != ''">
- AND (u.realname like concat('%', #{searchKey}, '%') or o.order_sn = #{searchKey} or u.id_card = #{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 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="selectUserClass" parameterType="map" resultType="integer">
- SELECT
- COUNT(cg.grade_id)
- FROM
- class_grade_goods cgg
- LEFT JOIN class_grade_user cgu ON cgu.grade_id = cgg.grade_id
- LEFT JOIN class_grade cg ON cg.grade_id = cgg.grade_id
- WHERE cgg.goods_id =#{goodsId}
- and cgu.user_id=#{userId}
- and cg.`status` =1
- </select>
- <select id="selectListApp" parameterType="com.zhongzheng.modules.order.bo.OrderQueryBo" resultMap="OrderResultVo">
- SELECT
- o.*
- FROM
- `order` o where 1=1
- <if test="userId != null">
- AND o.user_id = #{userId}
- </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="startTime != null">
- AND o.create_time >= #{startTime}
- </if>
- ORDER BY o.order_id DESC
- </select>
- <select id="queryByOrderSn" parameterType="String" resultType="Integer">
- SELECT order_status from `order` where order_sn = #{orderSn}
- </select>
- </mapper>
|