|
@@ -87,7 +87,8 @@
|
|
|
tiu.user_name as riderNickName,tiu.phone as riderPhone,ti.indent_id as indentId,ti.is_rider as isRider,
|
|
tiu.user_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,
|
|
ti.rider_user_id as riderUserId, tcu.money as couponMoney,
|
|
|
apr.discount_amount as activityDiscountAmount, ai.title activityTitle,tiu.rider_station_id as riderStationId,
|
|
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 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
|
|
|
from tb_order tor
|
|
from tb_order tor
|
|
|
left join tb_user tu on tor.user_id = tu.user_id
|
|
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 goods_shop gs on tor.shop_id = gs.shop_id
|
|
@@ -97,53 +98,56 @@
|
|
|
left join activity_part_record apr on apr.order_id = tor.order_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 activity ai on ai.id = apr.activity_id
|
|
|
where 1 = 1
|
|
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>
|
|
|
- <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>
|
|
|
- <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>
|
|
|
- <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>
|
|
|
- <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>
|
|
|
- <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>
|
|
|
- <if test="status!=null and status==1">
|
|
|
|
|
|
|
+ <if test="query.status!=null and query.status==1">
|
|
|
and tor.status in (1,2)
|
|
and tor.status in (1,2)
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="shopId!=null">
|
|
|
|
|
- and tor.shop_id = #{shopId}
|
|
|
|
|
|
|
+ <if test="query.shopId!=null">
|
|
|
|
|
+ and tor.shop_id = #{query.shopId}
|
|
|
</if>
|
|
</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>
|
|
|
- <if test="indentStatus != null and indentStatus != ''">
|
|
|
|
|
- and ti.indent_state = #{indentStatus}
|
|
|
|
|
|
|
+ <if test="query.indentStatus != null and query.indentStatus != ''">
|
|
|
|
|
+ and ti.indent_state = #{query.indentStatus}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="reservationFlag != null and reservationFlag !=''">
|
|
|
|
|
- and tor.reservation_flag = #{reservationFlag}
|
|
|
|
|
|
|
+ <if test="query.reservationFlag != null and query.reservationFlag !=''">
|
|
|
|
|
+ and tor.reservation_flag = #{query.reservationFlag}
|
|
|
</if>
|
|
</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.startTime!=null and query.startTime!=''">
|
|
|
|
|
+ and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{query.startTime},'%Y-%m-%d')
|
|
|
</if>
|
|
</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.endTime!=null and query.endTime!='' ">
|
|
|
|
|
+ and date_format(tor.create_time,'%Y-%m-%d') <= date_format(#{query.endTime},'%Y-%m-%d')
|
|
|
</if>
|
|
</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.payStartTime != null and query.payStartTime != ''">
|
|
|
|
|
+ and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{query.payStartTime},'%Y-%m-%d')
|
|
|
</if>
|
|
</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.payEndTime != null and query.payEndTime != '' ">
|
|
|
|
|
+ and date_format(tor.pay_time,'%Y-%m-%d') <= date_format(#{query.payEndTime},'%Y-%m-%d')
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="riderStationId!=null and riderStationId!=''">
|
|
|
|
|
- and tiu.rider_station_id=#{riderStationId}
|
|
|
|
|
|
|
+ <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>
|
|
|
order by tor.pay_time desc, tor.create_time desc
|
|
order by tor.pay_time desc, tor.create_time desc
|
|
|
</select>
|
|
</select>
|