|
|
@@ -1098,6 +1098,116 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
ORDER BY o.create_time DESC
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectLiveOrderListZmNew" parameterType="LiveOrder" resultType="com.fs.hisStore.vo.FsStoreOrderItemExportZMVO">
|
|
|
+ select
|
|
|
+ t1.order_code as orderCode,
|
|
|
+ t1.status,
|
|
|
+ t1.user_id as userId,
|
|
|
+ if(JSON_VALID(t2.json_info),t2.json_info->>'$.productName','') as productName,
|
|
|
+ if(JSON_VALID(t2.json_info),t2.json_info->>'$.barCode','') as barCode,
|
|
|
+ if(JSON_VALID(t2.json_info),t2.json_info->>'$.sku','') as sku,
|
|
|
+ if(JSON_VALID(t2.json_info),t2.json_info->>'$.price','') as price,
|
|
|
+ t2.num,
|
|
|
+ fsps.cost,
|
|
|
+ fspcs.cate_name as cateName,
|
|
|
+ t1.user_name as realName,
|
|
|
+ t1.user_phone as userPhone,
|
|
|
+ t1.user_address as userAddress,
|
|
|
+ t1.create_time as createTime,
|
|
|
+ t1.pay_time as payTime,
|
|
|
+ t1.delivery_sn as deliveryId,
|
|
|
+ t1.delivery_name as deliveryName,
|
|
|
+ t1.delivery_code as deliverySn,
|
|
|
+ t3.company_name as companyName,
|
|
|
+ t4.nick_name as companyUserNickName,
|
|
|
+ lop.bank_transaction_id as bankTransactionId
|
|
|
+ from
|
|
|
+ live_order t1
|
|
|
+ left join live_order_item t2 on t1.order_id = t2.order_id
|
|
|
+ left join fs_store_product_scrm fsps on fsps.product_id = t2.product_id
|
|
|
+ left join fs_store_product_category_scrm fspcs on fspcs.cate_id = fsps.cate_id
|
|
|
+ left join company t3 on t1.company_id = t3.company_id
|
|
|
+ left join company_user t4 on t4.user_id = t1.company_user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ t5.*,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY t5.business_code ORDER BY t5.status desc,t5.create_time DESC) as rn
|
|
|
+ FROM live_order_payment t5
|
|
|
+ WHERE t5.business_id IS NOT NULL
|
|
|
+ ) lop ON lop.business_id = t1.order_id AND lop.rn = 1
|
|
|
+ <where>
|
|
|
+ t1.is_del = 0 and fsps.product_id IS NOT NULL
|
|
|
+ <if test="orderId != null">
|
|
|
+ AND t1.order_id = #{orderId}
|
|
|
+ </if>
|
|
|
+ <if test="liveId != null">
|
|
|
+ AND t1.live_id = #{liveId}
|
|
|
+ </if>
|
|
|
+ <if test="storeId != null">
|
|
|
+ AND t1.store_id = #{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="orderCode != null and orderCode != ''">
|
|
|
+ AND t1.order_code LIKE CONCAT('%', #{orderCode}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ AND t1.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ AND t1.status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null">
|
|
|
+ AND t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="totalNum != null">
|
|
|
+ AND t1.total_num = #{totalNum}
|
|
|
+ </if>
|
|
|
+ <if test="price != null">
|
|
|
+ AND fsps.price = #{price}
|
|
|
+ </if>
|
|
|
+ <if test="cost != null">
|
|
|
+ AND fsps.cost = #{cost}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null">
|
|
|
+ AND t1.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="productId != null">
|
|
|
+ AND t1.product_id = #{productId}
|
|
|
+ </if>
|
|
|
+ <!-- 新增筛选条件 -->
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ AND fsps.product_name LIKE CONCAT('%', #{productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="productSpec != null and productSpec != ''">
|
|
|
+ AND fsps.prescribe_spec LIKE CONCAT('%', #{productSpec}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="storeId != null and storeId != ''">
|
|
|
+ AND fsps.store_id = #{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="userAddress != null and userAddress != ''">
|
|
|
+ AND t1.user_address LIKE CONCAT('%', #{userAddress}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
+ AND t1.user_name LIKE CONCAT('%', #{userName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="createTimeStart != null ">
|
|
|
+ AND t1.create_time >= #{createTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="createTimeEnd != null ">
|
|
|
+ AND t1.create_time <= #{createTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="payStartTime != null ">
|
|
|
+ AND t1.pay_time >= #{payStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="payEndTime != null ">
|
|
|
+ AND t1.pay_time <= #{payEndTime}
|
|
|
+ </if>
|
|
|
+ <if test="userPhone != null and userPhone != ''">
|
|
|
+ AND t1.user_phone = #{userPhone}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY t1.order_id
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getUnsettledOrder" resultType="com.fs.live.domain.LiveOrder">
|
|
|
SELECT
|
|
|
sos.*,
|