|
|
@@ -88,7 +88,8 @@
|
|
|
ti.rider_user_id as riderUserId, tcu.money as couponMoney,
|
|
|
apr.discount_amount as activityDiscountAmount, ai.title activityTitle,tiu.rider_station_id as riderStationId,
|
|
|
(select rs.station_name from rider_station rs where rs.id =tiu.rider_station_id ) as stationName,
|
|
|
- (select st.shop_type_name from shop_type st where st.id =gs.shop_type_id ) as shopTypeName
|
|
|
+ (select st.shop_type_name from shop_type st where st.id =gs.shop_type_id ) as shopTypeName,
|
|
|
+ (case when tcu.shop_id =0 then '平台' else gs2.shop_name end) as couponTypeRemark
|
|
|
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
|
|
|
@@ -97,6 +98,7 @@
|
|
|
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}
|
|
|
@@ -149,6 +151,12 @@
|
|
|
<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>
|
|
|
|
|
|
@@ -158,7 +166,9 @@
|
|
|
tiu.nick_name as riderNickName,tiu.phone as riderPhone,ti.indent_id as indentId,ti.is_rider as isRider,
|
|
|
ti.rider_user_id as riderUserId, tcu.money as couponMoney,
|
|
|
apr.discount_amount as activityDiscountAmount, ai.title activityTitle,ogg.detail,ogg.sumPrice,
|
|
|
- (select rs.station_name from rider_station rs where rs.id =tiu.rider_station_id ) as stationName
|
|
|
+ (select rs.station_name from rider_station rs where rs.id =tiu.rider_station_id ) as stationName,
|
|
|
+ (select st.shop_type_name from shop_type st where st.id =gs.shop_type_id ) as shopTypeName,
|
|
|
+ (case when tcu.shop_id =0 then '平台' else gs2.shop_name end) as couponTypeRemark
|
|
|
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
|
|
|
@@ -169,48 +179,64 @@
|
|
|
left join activity ai on ai.id = apr.activity_id
|
|
|
left join ( select @a:=0,order_id ,group_concat(@a:=@a+1,".商品名:",goods_name,",数量:",goods_num,",规格:",sku_message) detail,sum(goods_num*goods_price) sumPrice from order_goods og group by order_id
|
|
|
) ogg on ogg.order_id =tor.order_id
|
|
|
+ left join goods_shop gs2 on gs2.shop_id=tcu.shop_id
|
|
|
where 1 = 1
|
|
|
- <if test="riderPhone!=null and riderPhone!=''">
|
|
|
- and tiu.phone =#{riderPhone}
|
|
|
+ <if test="query.riderPhone!=null and query.riderPhone!=''">
|
|
|
+ and tiu.phone =#{query.riderPhone}
|
|
|
</if>
|
|
|
- <if test="shopName!=null and shopName!=''">
|
|
|
- and gs.shop_name like concat('%',#{shopName},'%')
|
|
|
+ <if test="query.shopName!=null and query.shopName!=''">
|
|
|
+ and gs.shop_name like concat('%',#{query.shopName},'%')
|
|
|
</if>
|
|
|
- <if test="userName!=null and userName!=''">
|
|
|
- and tor.user_name like concat('%',#{userName},'%')
|
|
|
+ <if test="query.userName!=null and query.userName!=''">
|
|
|
+ and tor.user_name like concat('%',#{query.userName},'%')
|
|
|
</if>
|
|
|
- <if test="phone!=null and phone!=''">
|
|
|
- and tor.phone like concat('%',#{phone},'%')
|
|
|
+ <if test="query.phone!=null and query.phone!=''">
|
|
|
+ and tor.phone like concat('%',#{query.phone},'%')
|
|
|
</if>
|
|
|
- <if test="orderNumber!=null and orderNumber!=''">
|
|
|
- and tor.order_number = #{orderNumber}
|
|
|
+ <if test="query.orderNumber!=null and query.orderNumber!=''">
|
|
|
+ and tor.order_number = #{query.orderNumber}
|
|
|
</if>
|
|
|
- <if test="status!=null and status!=-1 and status!=1">
|
|
|
- and tor.status = #{status}
|
|
|
+ <if test="query.status!=null and query.status!=-1 and query.status!=1">
|
|
|
+ and tor.status = #{query.status}
|
|
|
</if>
|
|
|
- <if test="status!=null and status==1">
|
|
|
+ <if test="query.status!=null and query.status==1">
|
|
|
and tor.status in (1,2)
|
|
|
</if>
|
|
|
- <if test="shopId!=null">
|
|
|
- and tor.shop_id = #{shopId}
|
|
|
+ <if test="query.shopId!=null">
|
|
|
+ and tor.shop_id = #{query.shopId}
|
|
|
</if>
|
|
|
- <if test="orderType!=null">
|
|
|
- and tor.order_type_extra = #{orderType}
|
|
|
+ <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="startTime!=null and startTime!=''">
|
|
|
- and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
|
+ <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="endTime!=null and endTime!='' ">
|
|
|
- and date_format(tor.create_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
|
+ <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="payStartTime != null and payStartTime != ''">
|
|
|
- and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{payStartTime},'%Y-%m-%d')
|
|
|
+ <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="payEndTime != null and payEndTime != '' ">
|
|
|
- and date_format(tor.pay_time,'%Y-%m-%d') <= date_format(#{payEndTime},'%Y-%m-%d')
|
|
|
+ <if test='query.couponType== "0" '>
|
|
|
+ and tcu.shop_id =0
|
|
|
</if>
|
|
|
- <if test="riderStationId!=null and riderStationId!=''">
|
|
|
- and tiu.rider_station_id=#{riderStationId}
|
|
|
+ <if test='query.couponType== "1"'>
|
|
|
+ and tcu.shop_id !=0
|
|
|
</if>
|
|
|
order by tor.pay_time desc, tor.create_time desc
|
|
|
</select>
|
|
|
@@ -221,48 +247,64 @@
|
|
|
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
|
|
|
where 1 = 1
|
|
|
- <if test="riderPhone!=null and riderPhone!=''">
|
|
|
- and tiu.phone =#{riderPhone}
|
|
|
+ <if test="query.riderPhone!=null and query.riderPhone!=''">
|
|
|
+ and tiu.phone =#{query.riderPhone}
|
|
|
</if>
|
|
|
- <if test="shopName!=null and shopName!=''">
|
|
|
- and gs.shop_name like concat('%',#{shopName},'%')
|
|
|
+ <if test="query.shopName!=null and query.shopName!=''">
|
|
|
+ and gs.shop_name like concat('%',#{query.shopName},'%')
|
|
|
</if>
|
|
|
- <if test="userName!=null and userName!=''">
|
|
|
- and tor.user_name like concat('%',#{userName},'%')
|
|
|
+ <if test="query.userName!=null and query.userName!=''">
|
|
|
+ and tor.user_name like concat('%',#{query.userName},'%')
|
|
|
</if>
|
|
|
- <if test="phone!=null and phone!=''">
|
|
|
- and tor.phone like concat('%',#{phone},'%')
|
|
|
+ <if test="query.phone!=null and query.phone!=''">
|
|
|
+ and tor.phone like concat('%',#{query.phone},'%')
|
|
|
</if>
|
|
|
- <if test="orderNumber!=null and orderNumber!=''">
|
|
|
- and tor.order_number = #{orderNumber}
|
|
|
+ <if test="query.orderNumber!=null and query.orderNumber!=''">
|
|
|
+ and tor.order_number = #{query.orderNumber}
|
|
|
</if>
|
|
|
- <if test="status!=null and status!=-1 and status!=1">
|
|
|
- and tor.status = #{status}
|
|
|
+ <if test="query.status!=null and query.status!=-1 and query.status!=1">
|
|
|
+ and tor.status = #{query.status}
|
|
|
</if>
|
|
|
- <if test="status!=null and status==1">
|
|
|
+ <if test="query.status!=null and query.status==1">
|
|
|
and tor.status in (1,2)
|
|
|
</if>
|
|
|
- <if test="shopId!=null">
|
|
|
- and tor.shop_id = #{shopId}
|
|
|
+ <if test="query.shopId!=null">
|
|
|
+ and tor.shop_id = #{query.shopId}
|
|
|
</if>
|
|
|
- <if test="orderType!=null">
|
|
|
- and tor.order_type_extra = #{orderType}
|
|
|
+ <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="startTime!=null and startTime!=''">
|
|
|
- and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
|
+ <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="endTime!=null and endTime!='' ">
|
|
|
- and date_format(tor.create_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
|
+ <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="payStartTime != null and payStartTime != ''">
|
|
|
- and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{payStartTime},'%Y-%m-%d')
|
|
|
+ <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="payEndTime != null and payEndTime != '' ">
|
|
|
- and date_format(tor.pay_time,'%Y-%m-%d') <= date_format(#{payEndTime},'%Y-%m-%d')
|
|
|
+ <if test='query.couponType== "0" '>
|
|
|
+ and tcu.shop_id =0
|
|
|
</if>
|
|
|
- <if test="riderStationId!=null and riderStationId!=''">
|
|
|
- and tiu.rider_station_id=#{riderStationId}
|
|
|
+ <if test='query.couponType== "1"'>
|
|
|
+ and tcu.shop_id !=0
|
|
|
</if>
|
|
|
order by tor.pay_time desc, tor.create_time desc
|
|
|
</select>
|