|
@@ -964,12 +964,903 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
#{item.orderNumber}
|
|
|
</foreach>
|
|
|
</update>
|
|
|
+ <update id="batchUpdateErpByOrderIds">
|
|
|
+ UPDATE fs_store_order_scrm
|
|
|
+ SET erp_phone =
|
|
|
+ <trim prefix="CASE id" suffix="END">
|
|
|
+ <foreach collection="maps" item="map">
|
|
|
+ WHEN #{map.orderId} THEN #{map.erpPhone}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ WHERE id IN
|
|
|
+ <foreach collection="maps" item="map" open="(" separator="," close=")">
|
|
|
+ #{map.orderId}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
|
|
|
<select id="selectStoreOrderScrmInId" resultType="com.fs.hisStore.domain.FsStoreOrderScrm">
|
|
|
<include refid="selectFsStoreOrderVo"/>
|
|
|
where id IN <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
+ </select>
|
|
|
+ <select id="selectFsStoreOrderListVOByErpAccount" resultType="com.fs.hisStore.vo.FsStoreOrderVO">
|
|
|
+ select o.*,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber,,df.login_account as erp_account,
|
|
|
+ from fs_store_order_scrm o
|
|
|
+ left join fs_user u on o.user_id=u.user_id
|
|
|
+ left join company c on c.company_id=o.company_id
|
|
|
+ left join company_user cu on cu.user_id=o.company_user_id
|
|
|
+ LEFT JOIN fs_store_order_df df on df.order_id=o.id
|
|
|
+ <if test = "maps.productName != null and maps.productName != '' ">
|
|
|
+ left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
|
+ left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
|
+ </if>
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ sp.*,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
|
|
|
+ FROM fs_store_payment_scrm sp
|
|
|
+ ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ <where>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ and csc.id = #{maps.coursePlaySourceConfigId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCodes != null and maps.orderCodes.size > 0">
|
|
|
+ and o.order_code in
|
|
|
+ <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
|
|
|
+ #{orderCode}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode !=''">
|
|
|
+ and o.order_code like CONCAT('%',#{maps.orderCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isPayRemain != null">
|
|
|
+ and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
+ </if>
|
|
|
+ <if test="maps.userId != null">
|
|
|
+ and o.user_id =#{maps.userId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId !=''">
|
|
|
+ and o.delivery_id =#{maps.deliveryId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.nickname != null and maps.nickname !=''">
|
|
|
+ and u.nickname like CONCAT('%',#{maps.nickname},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName !=''">
|
|
|
+ and o.real_name like CONCAT('%',#{maps.realName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.phone != null and maps.phone !=''">
|
|
|
+ and u.phone like CONCAT('%',#{maps.phone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone !=''">
|
|
|
+ and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="maps.status != null and maps.status != 6">
|
|
|
+ and o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.status == 6">
|
|
|
+ and o.`status`= 2
|
|
|
+
|
|
|
+ and (o.extend_order_id is null or o.extend_order_id like '')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 0 ">
|
|
|
+ and o.certificates is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 1 ">
|
|
|
+ and o.certificates is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null ">
|
|
|
+ and o.delivery_status =#{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null ">
|
|
|
+ and o.delivery_pay_status =#{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null ">
|
|
|
+ and o.company_id =#{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.isHealth != null and maps.isHealth != '' ">
|
|
|
+ and o.company_id is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.notHealth != null ">
|
|
|
+ and o.company_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserId != null ">
|
|
|
+ and o.company_user_id =#{maps.companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
|
|
|
+ and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ and fsp.product_name like concat('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderType != null ">
|
|
|
+ and o.order_type =#{maps.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null ">
|
|
|
+ and o.pay_type =#{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.scheduleId != null ">
|
|
|
+ and o.schedule_id =#{maps.scheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeList != null ">
|
|
|
+ AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeList != null ">
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.paidStatus != null ">
|
|
|
+ and o.paid =#{maps.paidStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeList != null ">
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryImportTimeList != null ">
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null ">
|
|
|
+ AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
|
|
|
+ and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
|
|
|
+ and df.login_account like #{maps.erpAccount}
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount == '未分拣'">
|
|
|
+ and ( df.login_account is null or df.login_account like '')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ${maps.params.dataScope}
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ group by o.id
|
|
|
+ </if>
|
|
|
+ ORDER BY
|
|
|
+
|
|
|
+ <if test="maps.sortField == 'companyUserName'">
|
|
|
+ cu.nick_name
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortField == 'packageName'">
|
|
|
+ o.package_name
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortField == 'payPrice'">
|
|
|
+ o.pay_price
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortField == 'payMoney'">
|
|
|
+ o.pay_money
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortOrder != null and maps.sortOrder != ''">
|
|
|
+ ${maps.sortOrder}
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortField == null or maps.sortField == ''">
|
|
|
+ o.id desc
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="selectFsStoreOrderListVOByErpAccountByExportCount" resultType="java.lang.Long">
|
|
|
+ select count(1)
|
|
|
+ from fs_store_order_scrm o
|
|
|
+ <if test="(maps.phone != null and maps.phone !='') or (maps.nickname != null and maps.nickname !='')">
|
|
|
+ left join fs_user u on o.user_id=u.user_id
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
|
|
|
+ left join company_user cu on cu.user_id=o.company_user_id
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test = "maps.productName != null and maps.productName != '' ">
|
|
|
+ left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
|
+ left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount != null and maps.erpAccount != ''">
|
|
|
+ LEFT JOIN fs_store_order_df df on df.order_id==o.id
|
|
|
+ </if>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ sp.*,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
|
|
|
+ FROM fs_store_payment_scrm sp
|
|
|
+ ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ and csc.id = #{maps.coursePlaySourceConfigId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCodes != null and maps.orderCodes.size > 0">
|
|
|
+ and o.order_code in
|
|
|
+ <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
|
|
|
+ #{orderCode}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode !=''">
|
|
|
+ and o.order_code like CONCAT('%',#{maps.orderCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isPayRemain != null">
|
|
|
+ and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
+ </if>
|
|
|
+ <if test="maps.userId != null">
|
|
|
+ and o.user_id =#{maps.userId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId !=''">
|
|
|
+ and o.delivery_id =#{maps.deliveryId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.nickname != null and maps.nickname !=''">
|
|
|
+ and u.nickname like CONCAT('%',#{maps.nickname},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName !=''">
|
|
|
+ and o.real_name like CONCAT('%',#{maps.realName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.phone != null and maps.phone !=''">
|
|
|
+ and u.phone like CONCAT('%',#{maps.phone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone !=''">
|
|
|
+ and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="maps.status != null and maps.status != 6">
|
|
|
+ and o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.status == 6">
|
|
|
+ and o.`status`= 2
|
|
|
+
|
|
|
+ and (o.extend_order_id is null or o.extend_order_id like '')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 0 ">
|
|
|
+ and o.certificates is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 1 ">
|
|
|
+ and o.certificates is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null ">
|
|
|
+ and o.delivery_status =#{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null ">
|
|
|
+ and o.delivery_pay_status =#{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null ">
|
|
|
+ and o.company_id =#{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.isHealth != null and maps.isHealth != '' ">
|
|
|
+ and o.company_id is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.notHealth != null ">
|
|
|
+ and o.company_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserId != null ">
|
|
|
+ and o.company_user_id =#{maps.companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
|
|
|
+ and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ and fsp.product_name like concat('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderType != null ">
|
|
|
+ and o.order_type =#{maps.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null ">
|
|
|
+ and o.pay_type =#{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.scheduleId != null ">
|
|
|
+ and o.schedule_id =#{maps.scheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeList != null ">
|
|
|
+ AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeList != null ">
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.paidStatus != null ">
|
|
|
+ and o.paid =#{maps.paidStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeList != null ">
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryImportTimeList != null ">
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null ">
|
|
|
+ AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
|
|
|
+ and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
|
|
|
+ and df.login_account like #{maps.erpAccount}
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount == '未分拣'">
|
|
|
+ and ( df.login_account is null or df.login_account like '')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ group by o.id
|
|
|
+ </if>
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="selectFsStoreOrderStatistics" resultType="java.util.Map">
|
|
|
+ select sum(o.pay_price) pay_price,sum(o.pay_money) pay_money,sum(o.pay_delivery) pay_remain
|
|
|
+ FROM fs_store_order_scrm o
|
|
|
+ left join fs_user u on o.user_id=u.user_id
|
|
|
+ left join company c on c.company_id=o.company_id
|
|
|
+ left join company_user cu on cu.user_id=o.company_user_id
|
|
|
+ <if test="maps.erpAccount != null or maps.erpAccount != ''">
|
|
|
+ LEFT JOIN fs_store_order_df df on df.order_id=o.id
|
|
|
+ </if>
|
|
|
+ <if test = "maps.productName != null and maps.productName != '' ">
|
|
|
+ left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
|
+ left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
|
+ </if>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ sp.*,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
|
|
|
+ FROM fs_store_payment_scrm sp
|
|
|
+ WHERE sp.business_code IS NOT NULL
|
|
|
+ ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ and csc.id = #{maps.coursePlaySourceConfigId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCodes != null and maps.orderCodes.size > 0">
|
|
|
+ and o.order_code in
|
|
|
+ <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
|
|
|
+ #{orderCode}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode !=''">
|
|
|
+ and o.order_code like CONCAT('%',#{maps.orderCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isPayRemain != null">
|
|
|
+ and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
+ </if>
|
|
|
+ <if test="maps.userId != null">
|
|
|
+ and o.user_id =#{maps.userId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId !=''">
|
|
|
+ and o.delivery_id =#{maps.deliveryId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.nickname != null and maps.nickname !=''">
|
|
|
+ and u.nickname like CONCAT('%',#{maps.nickname},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName !=''">
|
|
|
+ and o.real_name like CONCAT('%',#{maps.realName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.phone != null and maps.phone !=''">
|
|
|
+ and u.phone like CONCAT('%',#{maps.phone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone !=''">
|
|
|
+ and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="maps.status != null and maps.status != 6">
|
|
|
+ and o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.status == 6">
|
|
|
+ and o.`status`= 1
|
|
|
+
|
|
|
+ and (o.extend_order_id is null or o.extend_order_id like '')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 0 ">
|
|
|
+ and o.certificates is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 1 ">
|
|
|
+ and o.certificates is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null ">
|
|
|
+ and o.delivery_status =#{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null ">
|
|
|
+ and o.delivery_pay_status =#{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null ">
|
|
|
+ and o.company_id =#{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.isHealth != null and maps.isHealth != '' ">
|
|
|
+ and o.company_id is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.notHealth != null ">
|
|
|
+ and o.company_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserId != null ">
|
|
|
+ and o.company_user_id =#{maps.companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
|
|
|
+ and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ and fsp.product_name like concat('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderType != null ">
|
|
|
+ and o.order_type =#{maps.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null ">
|
|
|
+ and o.pay_type =#{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.scheduleId != null ">
|
|
|
+ and o.schedule_id =#{maps.scheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeList != null ">
|
|
|
+ AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeList != null ">
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.paidStatus != null ">
|
|
|
+ and o.paid =#{maps.paidStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeList != null ">
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryImportTimeList != null ">
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null ">
|
|
|
+ AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
|
|
|
+ and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
|
|
|
+ and df.login_account like #{maps.erpAccount}
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount == '未分拣'">
|
|
|
+ and ( df.login_account is null or df.login_account like '')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ ${maps.params.dataScope}
|
|
|
+ </select>
|
|
|
+ <select id="selectFsStoreOrderProductStatistics" resultType="java.lang.String">
|
|
|
+ SELECT GROUP_CONCAT(
|
|
|
+ CONCAT(product_name, ':', product_num)
|
|
|
+ ORDER BY product_name
|
|
|
+ SEPARATOR ' '
|
|
|
+ ) AS product_num_list
|
|
|
+ FROM (
|
|
|
+ SELECT sp.product_name,SUM(IF(soi.num IS NULL,0,soi.num)) product_num
|
|
|
+ FROM fs_store_product_scrm sp
|
|
|
+ INNER JOIN fs_store_order_item_scrm soi ON soi.product_id = sp.product_id
|
|
|
+ INNER JOIN fs_store_order_scrm o ON soi.order_id = o.id
|
|
|
+ LEFT JOIN fs_user us ON us.user_id=o.user_id
|
|
|
+ LEFT JOIN company_user cu on cu.user_id=o.company_user_id
|
|
|
+ LEFT JOIN fs_store_order_df df on df.order_id=o.id
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ sp.*,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
|
|
|
+ FROM fs_store_payment_scrm sp
|
|
|
+ WHERE sp.business_code IS NOT NULL
|
|
|
+ ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ and csc.id = #{maps.coursePlaySourceConfigId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCodes != null and maps.orderCodes.size > 0">
|
|
|
+ and o.order_code in
|
|
|
+ <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
|
|
|
+ #{orderCode}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode !=''">
|
|
|
+ and o.order_code like CONCAT('%',#{maps.orderCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isPayRemain != null">
|
|
|
+ and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
+ </if>
|
|
|
+ <if test="maps.userId != null">
|
|
|
+ and o.user_id =#{maps.userId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId !=''">
|
|
|
+ and o.delivery_id =#{maps.deliveryId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.nickname != null and maps.nickname !=''">
|
|
|
+ and u.nickname like CONCAT('%',#{maps.nickname},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName !=''">
|
|
|
+ and o.real_name like CONCAT('%',#{maps.realName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.phone != null and maps.phone !=''">
|
|
|
+ and u.phone like CONCAT('%',#{maps.phone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone !=''">
|
|
|
+ and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="maps.status != null and maps.status != 6">
|
|
|
+ and o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.status == 6">
|
|
|
+ and o.`status`= 1
|
|
|
+
|
|
|
+ and (o.extend_order_id is null or o.extend_order_id like '')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 0 ">
|
|
|
+ and o.certificates is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 1 ">
|
|
|
+ and o.certificates is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null ">
|
|
|
+ and o.delivery_status =#{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null ">
|
|
|
+ and o.delivery_pay_status =#{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null ">
|
|
|
+ and o.company_id =#{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.isHealth != null and maps.isHealth != '' ">
|
|
|
+ and o.company_id is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.notHealth != null ">
|
|
|
+ and o.company_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserId != null ">
|
|
|
+ and o.company_user_id =#{maps.companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
|
|
|
+ and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ and fsp.product_name like concat('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderType != null ">
|
|
|
+ and o.order_type =#{maps.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null ">
|
|
|
+ and o.pay_type =#{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.scheduleId != null ">
|
|
|
+ and o.schedule_id =#{maps.scheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeList != null ">
|
|
|
+ AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeList != null ">
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.paidStatus != null ">
|
|
|
+ and o.paid =#{maps.paidStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeList != null ">
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryImportTimeList != null ">
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null ">
|
|
|
+ AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
|
|
|
+ and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
|
|
|
+ and df.login_account like #{maps.erpAccount}
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount == '未分拣'">
|
|
|
+ and ( df.login_account is null or df.login_account like '')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ${maps.params.dataScope} GROUP BY sp.product_id
|
|
|
+ ) AS t
|
|
|
+ </select>
|
|
|
+ <select id="selectFsStoreOrderListVO" resultType="com.fs.hisStore.vo.FsStoreOrderVO">
|
|
|
+ select o.*,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber
|
|
|
+ , csc.name miniProgramName
|
|
|
+ from fs_store_order_scrm o
|
|
|
+ left join fs_user u on o.user_id=u.user_id
|
|
|
+ left join company c on c.company_id=o.company_id
|
|
|
+ left join company_user cu on cu.user_id=o.company_user_id
|
|
|
+ <if test="maps.erpAccount != null and maps.erpAccount != ''">
|
|
|
+ LEFT JOIN fs_store_order_df df on df.order_id=o.id
|
|
|
+
|
|
|
+ </if>
|
|
|
+ <if test = "maps.productName != null and maps.productName != '' ">
|
|
|
+ left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
|
+ left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
|
+ </if>
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ sp.*,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
|
|
|
+ FROM fs_store_payment_scrm sp
|
|
|
+ WHERE sp.business_code IS NOT NULL
|
|
|
+ ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ <where>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ and csc.id = #{maps.coursePlaySourceConfigId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCodes != null and maps.orderCodes.size > 0">
|
|
|
+ and o.order_code in
|
|
|
+ <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
|
|
|
+ #{orderCode}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode !=''">
|
|
|
+ and o.order_code like CONCAT('%',#{maps.orderCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isPayRemain != null">
|
|
|
+ and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
+ </if>
|
|
|
+ <if test="maps.userId != null">
|
|
|
+ and o.user_id =#{maps.userId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId !=''">
|
|
|
+ and o.delivery_id =#{maps.deliveryId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.nickname != null and maps.nickname !=''">
|
|
|
+ and u.nickname like CONCAT('%',#{maps.nickname},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName !=''">
|
|
|
+ and o.real_name like CONCAT('%',#{maps.realName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.phone != null and maps.phone !=''">
|
|
|
+ and u.phone like CONCAT('%',#{maps.phone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone !=''">
|
|
|
+ and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.status != null and maps.status != 6">
|
|
|
+ and o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.status == 6">
|
|
|
+ and o.`status`= 1
|
|
|
+ and (o.extend_order_id is null or o.extend_order_id like '')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 0 ">
|
|
|
+ and o.certificates is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 1 ">
|
|
|
+ and o.certificates is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null ">
|
|
|
+ and o.delivery_status =#{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null ">
|
|
|
+ and o.delivery_pay_status =#{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null ">
|
|
|
+ and o.company_id =#{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.isHealth != null and maps.isHealth != '' ">
|
|
|
+ and o.company_id is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.notHealth != null ">
|
|
|
+ and o.company_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserId != null ">
|
|
|
+ and o.company_user_id =#{maps.companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
|
|
|
+ and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ and fsp.product_name like concat('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderType != null ">
|
|
|
+ and o.order_type =#{maps.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null ">
|
|
|
+ and o.pay_type =#{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.scheduleId != null ">
|
|
|
+ and o.schedule_id =#{maps.scheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeList != null ">
|
|
|
+ AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeList != null ">
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.paidStatus != null ">
|
|
|
+ and o.paid =#{maps.paidStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeList != null ">
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryImportTimeList != null ">
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null ">
|
|
|
+ AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
|
|
|
+ and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
|
|
|
+ and df.login_account like #{maps.erpAccount}
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpAccount == '未分拣'">
|
|
|
+ and ( df.login_account is null or df.login_account like '')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ${maps.params.dataScope}
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ group by o.id
|
|
|
+ </if>
|
|
|
+ order by
|
|
|
+ <if test="maps.sortField == 'companyUserName'">
|
|
|
+ cu.nick_name
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortField == 'packageName'">
|
|
|
+ o.package_name
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortField == 'payPrice'">
|
|
|
+ o.pay_price
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortField == 'payMoney'">
|
|
|
+ o.pay_money
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortOrder != null and maps.sortOrder != ''">
|
|
|
+ ${maps.sortOrder}
|
|
|
+ </if>
|
|
|
+ <if test="maps.sortField == null or maps.sortField == ''">
|
|
|
+ o.id desc
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsStoreOrderListVO_COUNT" resultType="java.lang.Long">
|
|
|
+ select count(*)
|
|
|
+ from fs_store_order_scrm o
|
|
|
+ <if test="(maps.nickname != null and maps.nickname !='') or (maps.phone != null and maps.phone !='')">
|
|
|
+ left join fs_user u on o.user_id=u.user_id
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
|
|
|
+ left join company_user cu on cu.user_id=o.company_user_id
|
|
|
+ </if>
|
|
|
+ <if test = "maps.productName != null and maps.productName != '' ">
|
|
|
+ left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
|
+ left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
|
+ </if>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ sp.*,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
|
|
|
+ FROM fs_store_payment_scrm sp
|
|
|
+ WHERE sp.business_code IS NOT NULL
|
|
|
+ ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <where>
|
|
|
+ <if test="maps.coursePlaySourceConfigId != null">
|
|
|
+ and csc.id = #{maps.coursePlaySourceConfigId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode !=''">
|
|
|
+ and o.order_code like CONCAT('%',#{maps.orderCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isPayRemain != null">
|
|
|
+ and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
+ </if>
|
|
|
+ <if test="maps.userId != null">
|
|
|
+ and o.user_id =#{maps.userId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId !=''">
|
|
|
+ and o.delivery_id =#{maps.deliveryId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.nickname != null and maps.nickname !=''">
|
|
|
+ and u.nickname like CONCAT('%',#{maps.nickname},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName !=''">
|
|
|
+ and o.real_name like CONCAT('%',#{maps.realName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.phone != null and maps.phone !=''">
|
|
|
+ and u.phone like CONCAT('%',#{maps.phone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone !=''">
|
|
|
+ and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.status != null and maps.status != 6">
|
|
|
+ and o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.status == 6">
|
|
|
+ and o.`status`= 2
|
|
|
+ and ( o.extend_order_id is null or o.extend_order_id like '')
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 0 ">
|
|
|
+ and o.certificates is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.isUpload != null and maps.isUpload == 1 ">
|
|
|
+ and o.certificates is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null ">
|
|
|
+ and o.delivery_status =#{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null ">
|
|
|
+ and o.delivery_pay_status =#{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null ">
|
|
|
+ and o.company_id =#{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.isHealth != null and maps.isHealth != '' ">
|
|
|
+ and o.company_id is null
|
|
|
+ </if>
|
|
|
+ <if test="maps.notHealth != null ">
|
|
|
+ and o.company_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserId != null ">
|
|
|
+ and o.company_user_id =#{maps.companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
|
|
|
+ and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ and fsp.product_name like concat('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderType != null ">
|
|
|
+ and o.order_type =#{maps.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null ">
|
|
|
+ and o.pay_type =#{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.scheduleId != null ">
|
|
|
+ and o.schedule_id =#{maps.scheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeList != null ">
|
|
|
+ AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeList != null ">
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.paidStatus != null ">
|
|
|
+ and o.paid =#{maps.paidStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeList != null ">
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryImportTimeList != null ">
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
|
|
|
+ AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null ">
|
|
|
+ AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
|
|
|
+ </if>
|
|
|
+ <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
|
|
|
+ and so.erp_phone like concat(#{maps.erpPhoneNumber},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ${maps.params.dataScope}
|
|
|
+ <if test="maps.productName != null and maps.productName != '' ">
|
|
|
+ group by o.id
|
|
|
+ </if>
|
|
|
+ order by o.id desc
|
|
|
+ </select>
|
|
|
+ <select id="selectAddTuiMoney" resultType="java.lang.Long">
|
|
|
+
|
|
|
</select>
|
|
|
<select id="selectFsStoreOrderAmountScrmStats" resultType="com.fs.his.vo.FsStoreOrderAmountScrmStatsVo">
|
|
|
SELECT
|