|
|
@@ -395,13 +395,12 @@
|
|
|
and tor.status = #{status}
|
|
|
</if>
|
|
|
<if test="status!=null and status==5">
|
|
|
- and tor.status in (5, 8)
|
|
|
+ and tor.status =8
|
|
|
</if>
|
|
|
<if test="status==null">
|
|
|
- and tor.status in (0, 7, 6, 3, 4, 5, 8)
|
|
|
+ and tor.status in (0, 7, 6, 3, 4, 8)
|
|
|
</if>
|
|
|
order by tor.pay_time desc, tor.create_time desc
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@@ -603,5 +602,86 @@
|
|
|
and shop_id = #{shopId}
|
|
|
and date(pay_time) = date(#{payTime})
|
|
|
</select>
|
|
|
+ <select id="selectOrderPage" resultType="com.sqx.modules.order.entity.TbOrder">
|
|
|
+ select tor.*, gs.shop_name as shopName, gs.detailed_address as detailedAddress, gs.shop_lng as shopLng,
|
|
|
+ gs.shop_lat as shopLat, gs.phone as shopPhone,
|
|
|
+ gs.errand_money as errandMoney, gs.exempt_min_money as exemptMinMoney, gs.minimum_delivery as minimumDelivery,
|
|
|
+ gs.distribution_distance as distributionDistance
|
|
|
+ from tb_order tor left join goods_shop gs on tor.shop_id = gs.shop_id
|
|
|
+ where tor.user_id = #{userId}
|
|
|
+ and tor.order_id = #{orderId}
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="selectAllOrderTotalPrice" resultType="java.math.BigDecimal">
|
|
|
+ select SUM(tor.pay_money) as totalPrice
|
|
|
+ from tb_order tor
|
|
|
+ left join tb_user tu on tor.user_id = tu.user_id
|
|
|
+ left join goods_shop gs on tor.shop_id = gs.shop_id
|
|
|
+ left join tb_indent ti on tor.order_id = ti.order_id
|
|
|
+ left join tb_user tiu on tiu.user_id = ti.rider_user_id
|
|
|
+ left join tb_coupon_user tcu on tor.coupon_id = tcu.id
|
|
|
+ left join activity_part_record apr on apr.order_id = tor.order_id
|
|
|
+ left join activity ai on ai.id = apr.activity_id
|
|
|
+ left join goods_shop gs2 on gs2.shop_id=tcu.shop_id
|
|
|
+ where 1 = 1
|
|
|
+ <if test="query.riderPhone!=null and query.riderPhone!=''">
|
|
|
+ and tiu.phone =#{query.riderPhone}
|
|
|
+ </if>
|
|
|
+ <if test="query.shopName!=null and query.shopName!=''">
|
|
|
+ and gs.shop_name like concat('%',#{query.shopName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="query.userName!=null and query.userName!=''">
|
|
|
+ and tor.user_name like concat('%',#{query.userName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="query.phone!=null and query.phone!=''">
|
|
|
+ and tor.phone like concat('%',#{query.phone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="query.orderNumber!=null and query.orderNumber!=''">
|
|
|
+ and tor.order_number = #{query.orderNumber}
|
|
|
+ </if>
|
|
|
+ <if test="query.status!=null and query.status!=-1 and query.status!=1">
|
|
|
+ and tor.status = #{query.status}
|
|
|
+ </if>
|
|
|
+ <if test="query.status!=null and query.status==1">
|
|
|
+ and tor.status in (1,2)
|
|
|
+ </if>
|
|
|
+ <if test="query.shopId!=null">
|
|
|
+ and tor.shop_id = #{query.shopId}
|
|
|
+ </if>
|
|
|
+ <if test="query.orderType!=null">
|
|
|
+ and tor.order_type_extra = #{query.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="query.indentStatus != null and query.indentStatus != ''">
|
|
|
+ and ti.indent_state = #{query.indentStatus}
|
|
|
+ </if>
|
|
|
+ <if test="query.reservationFlag != null and query.reservationFlag !=''">
|
|
|
+ and tor.reservation_flag = #{query.reservationFlag}
|
|
|
+ </if>
|
|
|
+ <if test="query.startTime!=null and query.startTime!=''">
|
|
|
+ and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{query.startTime},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="query.endTime!=null and query.endTime!='' ">
|
|
|
+ and date_format(tor.create_time,'%Y-%m-%d') <= date_format(#{query.endTime},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="query.payStartTime != null and query.payStartTime != ''">
|
|
|
+ and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{query.payStartTime},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="query.payEndTime != null and query.payEndTime != '' ">
|
|
|
+ and date_format(tor.pay_time,'%Y-%m-%d') <= date_format(#{query.payEndTime},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="query.riderStationId!=null and query.riderStationId!=''">
|
|
|
+ and tiu.rider_station_id=#{query.riderStationId}
|
|
|
+ </if>
|
|
|
+ <if test="query.shopTypeId!=null and query.shopTypeId!=''">
|
|
|
+ and gs.shop_type_id=#{query.shopTypeId}
|
|
|
+ </if>
|
|
|
+ <if test='query.couponType== "0" '>
|
|
|
+ and tcu.shop_id =0
|
|
|
+ </if>
|
|
|
+ <if test='query.couponType== "1"'>
|
|
|
+ and tcu.shop_id !=0
|
|
|
+ </if>
|
|
|
+ order by tor.pay_time desc, tor.create_time desc
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|