123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?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="cn.newfeifan.mall.module.trade.dal.mysql.order.TradeOrderMapper">
- <resultMap id="BaseResultMap" type="cn.newfeifan.mall.module.distri.mq.message.order.DistriOrderMessage">
- <id column="totalPrice" property="totalPrice"/>
- <result column="price" property="price"/>
- <result column="productCount" property="productCount"/>
- <result column="costPrice" property="costPrice"/>
- <result column="no" property="no"/>
- <result column="userId" property="userId"/>
- <result column="shopId" property="shopId"/>
- <result column="merchantId" property="merchantId"/>
- <result column="orderId" property="orderId"/>
- <result column="name" property="name"/>
- <result column="nickName" property="nickName"/>
- <result column="count" property="count"/>
- </resultMap>
- <!-- 参与 冻结转可用的订单计算-->
- <select id="queryAllOrder" resultMap="BaseResultMap">
- select tor.total_price as totalPrice,
- ps.cost_price as costPrice,
- ps.price as price,
- tor.product_count as productCount,
- tor.`no` as `no`,
- tor.id as orderId,
- tor.user_id as userId,
- ps.merchant_id as merchantId,
- ps.shop_id as shopId,
- mu.`name` as name,
- mu.nickname as nickname,
- toi.count as `count`,
- toi.id as orderItemId,
- toi.increase_integral AS increaseIntegral,
- toi.ancestor_increase_integral AS ancestorIncreaseIntegral
- from trade_order tor
- LEFT JOIN member_user mu
- ON tor.user_id = mu.id
- LEFT JOIN trade_order_item toi
- on tor.id = toi.order_id
- LEFT JOIN product_sku ps
- on toi.sku_id = ps.id
- where tor.pay_status = 1
- and toi.distribute_benefit = 0
- and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
- and tor.pay_time < DATE_SUB(NOW(), INTERVAL 7 DAY)
- -- and tor.receiving_time < DATE_SUB(NOW(), INTERVAL 7 DAY)
- </select>
- <!-- 参与合赢奖的订单-->
- <select id="queryDailyOrder" resultMap="BaseResultMap">
- select tor.total_price as totalPrice,
- ps.cost_price as costPrice,
- ps.price as price,
- tor.product_count as productCount,
- tor.`no` as `no`,
- tor.id as orderId,
- tor.user_id as userId,
- ps.merchant_id as merchantId,
- ps.shop_id as shopId,
- mu.`name` as name,
- mu.nickname as nickname,
- toi.count as `count`,
- toi.id as orderItemId,
- toi.increase_integral AS increaseIntegral,
- toi.ancestor_increase_integral AS ancestorIncreaseIntegral
- from trade_order tor
- LEFT JOIN member_user mu
- ON tor.user_id = mu.id
- LEFT JOIN trade_order_item toi
- on tor.id = toi.order_id
- LEFT JOIN product_sku ps
- on toi.sku_id = ps.id
- where tor.pay_status = 1
- and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
- and toi.transition_time is null
- and DATE(tor.create_time) < CURDATE()
- </select>
- <select id="queryAllOrderByOrderIds"
- resultMap="BaseResultMap">
- select tor.total_price as totalPrice,
- ps.cost_price as costPrice,
- ps.price as price,
- tor.product_count as productCount,
- tor.`no` as `no`,
- tor.id as orderId,
- tor.user_id as userId,
- ps.merchant_id as merchantId,
- ps.shop_id as shopId,
- mu.`name` as name,
- mu.nickname as nickname,
- toi.count as `count`,
- toi.id as orderItemId,
- toi.increase_integral AS increaseIntegral,
- toi.ancestor_increase_integral AS ancestorIncreaseIntegral
- from trade_order tor
- LEFT JOIN member_user mu
- ON tor.user_id = mu.id
- LEFT JOIN trade_order_item toi
- on tor.id = toi.order_id
- LEFT JOIN product_sku ps
- on toi.sku_id = ps.id
- <where>
- tor.pay_status = 1
- and toi.distribute_benefit = 0
- and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
- and tor.receiving_time < DATE_SUB(NOW(), INTERVAL 7 DAY)
- <if test="orderIds!=null">
- and tor.id in (
- <foreach collection="orderIds" item="orderId" separator=",">
- #{orderId}
- </foreach>
- )
- </if>
- </where>
- </select>
- </mapper>
|