|
|
@@ -344,15 +344,51 @@
|
|
|
<where>
|
|
|
<if test="orderCode != null and orderCode != ''"> AND o.order_code = #{orderCode}</if>
|
|
|
<if test="userId != null"> AND o.user_id = #{userId}</if>
|
|
|
+ <if test="companyUserId != null"> AND o.company_user_id = #{companyUserId}</if>
|
|
|
+ <if test="companyUserName != null and companyUserName != ''"> AND cu.user_name LIKE CONCAT('%', #{companyUserName}, '%')</if>
|
|
|
+ <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
|
|
|
<if test="userName != null and userName != ''"> AND o.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
<if test="userPhone != null and userPhone != ''"> AND o.user_phone = #{userPhone}</if>
|
|
|
+ <if test="memberPhone != null and memberPhone != ''"> AND u.phone = #{memberPhone}</if>
|
|
|
+ <if test="memberName != null and memberName != ''"> AND u.nick_name LIKE CONCAT('%', #{memberName}, '%')</if>
|
|
|
+ <if test="memberSex != null"> AND u.sex = #{memberSex}</if>
|
|
|
+ <if test="memberAge != null"> AND TIMESTAMPDIFF(YEAR, FROM_UNIXTIME(u.birthday), CURDATE()) = #{memberAge}</if>
|
|
|
<if test="isPay != null"> AND o.is_pay = #{isPay}</if>
|
|
|
<if test="status != null"> AND o.status = #{status}</if>
|
|
|
+ <if test="deliveryStatus != null"> AND o.delivery_status = #{deliveryStatus}</if>
|
|
|
<if test="companyId != null"> AND o.company_id = #{companyId}</if>
|
|
|
- <if test="companyUserId != null"> AND o.company_user_id = #{companyUserId}</if>
|
|
|
<if test="isSync != null"> AND o.is_sync = #{isSync}</if>
|
|
|
<if test="sTime != null and sTime != ''"> AND o.external_create_time >= #{sTime}</if>
|
|
|
<if test="eTime != null and eTime != ''"> AND o.external_create_time <= CONCAT(#{eTime},' 23:59:59')</if>
|
|
|
+ <if test="address != null and address != ''"> AND (ua.province LIKE CONCAT('%', #{address}, '%') OR ua.city LIKE CONCAT('%', #{address}, '%') OR ua.district LIKE CONCAT('%', #{address}, '%') OR ua.detail LIKE CONCAT('%', #{address}, '%'))</if>
|
|
|
+ <if test="province != null and province != ''"> AND ua.province = #{province}</if>
|
|
|
+ <if test="city != null and city != ''"> AND ua.city = #{city}</if>
|
|
|
+ <if test="district != null and district != ''"> AND ua.district = #{district}</if>
|
|
|
+ <if test="township != null and township != ''"> AND ua.town_ship = #{township}</if>
|
|
|
+ <if test="productName != null and productName != ''"> AND oi.product_name LIKE CONCAT('%', #{productName}, '%')</if>
|
|
|
+ <if test="payPrice != null"> AND o.pay_price = #{payPrice}</if>
|
|
|
+ <if test="totalPrice != null"> AND o.total_price = #{totalPrice}</if>
|
|
|
+ <if test="collectionPrice != null"> AND o.collection_price = #{collectionPrice}</if>
|
|
|
+ <if test="refundPrice != null"> AND o.refund_price = #{refundPrice}</if>
|
|
|
+ <if test="remark != null and remark != ''"> AND o.remark LIKE CONCAT('%', #{remark}, '%')</if>
|
|
|
+ <if test="deliverySn != null and deliverySn != ''"> AND o.delivery_sn = #{deliverySn}</if>
|
|
|
+ <if test="deliveryCode != null and deliveryCode != ''"> AND o.delivery_code = #{deliveryCode}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="deliveryStartTime != null and deliveryStartTime != ''"> AND o.delivery_time >= #{deliveryStartTime}</if>
|
|
|
+ <if test="deliveryEndTime != null and deliveryEndTime != ''"> AND o.delivery_time <= CONCAT(#{deliveryEndTime},' 23:59:59')</if>
|
|
|
+ <if test="depositReturnTimeStart != null and depositReturnTimeStart != ''"> AND o.update_time >= #{depositReturnTimeStart}</if>
|
|
|
+ <if test="depositReturnTimeEnd != null and depositReturnTimeEnd != ''"> AND o.update_time <= CONCAT(#{depositReturnTimeEnd},' 23:59:59')</if>
|
|
|
+ <if test="followTimeStart != null and followTimeStart != ''"> AND o.follow_time >= #{followTimeStart}</if>
|
|
|
+ <if test="followTimeEnd != null and followTimeEnd != ''"> AND o.follow_time <= CONCAT(#{followTimeEnd},' 23:59:59')</if>
|
|
|
+ <if test="refundTimeStart != null and refundTimeStart != ''"> AND o.refund_time >= #{refundTimeStart}</if>
|
|
|
+ <if test="refundTimeEnd != null and refundTimeEnd != ''"> AND o.refund_time <= CONCAT(#{refundTimeEnd},' 23:59:59')</if>
|
|
|
+ <if test="auditor != null and auditor != ''"> AND o.auditor LIKE CONCAT('%', #{auditor}, '%')</if>
|
|
|
+ <if test="auditTimeStart != null and auditTimeStart != ''"> AND o.audit_time >= #{auditTimeStart}</if>
|
|
|
+ <if test="auditTimeEnd != null and auditTimeEnd != ''"> AND o.audit_time <= CONCAT(#{auditTimeEnd},' 23:59:59')</if>
|
|
|
+ <if test="diseaseName != null and diseaseName != ''"> AND o.disease_name LIKE CONCAT('%', #{diseaseName}, '%')</if>
|
|
|
+ <if test="memberBuyCountMin != null">
|
|
|
+ AND (SELECT COUNT(DISTINCT o2.order_id) FROM fs_external_order o2 WHERE o2.user_id = o.user_id AND o2.company_id = o.company_id AND o2.status != -3) >= #{memberBuyCountMin}
|
|
|
+ </if>
|
|
|
${params.dataScope}
|
|
|
</where>
|
|
|
GROUP BY o.order_id
|
|
|
@@ -470,17 +506,34 @@
|
|
|
<where>
|
|
|
<if test="orderCode != null and orderCode != ''"> AND o.order_code = #{orderCode}</if>
|
|
|
<if test="userName != null and userName != ''"> AND o.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
+ <if test="userPhone != null and userPhone != ''"> AND o.user_phone LIKE CONCAT('%', #{userPhone}, '%')</if>
|
|
|
<if test="deliverySn != null and deliverySn != ''"> AND o.delivery_sn = #{deliverySn}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
<if test="status != null"> AND o.status = #{status}</if>
|
|
|
<if test="companyId != null"> AND o.company_id = #{companyId}</if>
|
|
|
<if test="returnStatus != null">
|
|
|
<if test="returnStatus == 1"> AND o.status = 4</if>
|
|
|
<if test="returnStatus == 0"> AND o.status != 4</if>
|
|
|
</if>
|
|
|
+ <if test="returnUser != null and returnUser != ''"> AND o.update_by LIKE CONCAT('%', #{returnUser}, '%')</if>
|
|
|
+ <if test="returnTimeStart != null and returnTimeStart != ''"> AND o.update_time >= #{returnTimeStart}</if>
|
|
|
+ <if test="returnTimeEnd != null and returnTimeEnd != ''"> AND o.update_time <= #{returnTimeEnd}</if>
|
|
|
+ <if test="totalPrice != null"> AND o.total_price = #{totalPrice}</if>
|
|
|
+ <if test="collectionPrice != null"> AND o.collection_price = #{collectionPrice}</if>
|
|
|
+ <if test="receiverPhone != null and receiverPhone != ''"> AND o.receiver_phone LIKE CONCAT('%', #{receiverPhone}, '%')</if>
|
|
|
+ <if test="remark != null and remark != ''"> AND o.remark LIKE CONCAT('%', #{remark}, '%')</if>
|
|
|
+ <if test="payType != null"> AND o.pay_type = #{payType}</if>
|
|
|
+ <if test="companyUserName != null and companyUserName != ''"> AND cu.user_name LIKE CONCAT('%', #{companyUserName}, '%')</if>
|
|
|
+ <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
|
|
|
+ <if test="sTime != null and sTime != ''"> AND o.external_create_time >= #{sTime}</if>
|
|
|
+ <if test="eTime != null and eTime != ''"> AND o.external_create_time <= #{eTime}</if>
|
|
|
<if test="deliveryStartTime != null and deliveryStartTime != ''"> AND o.delivery_time >= #{deliveryStartTime}</if>
|
|
|
<if test="deliveryEndTime != null and deliveryEndTime != ''"> AND o.delivery_time <= #{deliveryEndTime}</if>
|
|
|
</where>
|
|
|
GROUP BY o.order_id
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ HAVING GROUP_CONCAT(oi.product_name SEPARATOR ',') LIKE CONCAT('%', #{productName}, '%')
|
|
|
+ </if>
|
|
|
ORDER BY o.create_time DESC
|
|
|
</select>
|
|
|
|
|
|
@@ -517,11 +570,26 @@
|
|
|
<if test="userAddress != null and userAddress != ''">
|
|
|
AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')
|
|
|
</if>
|
|
|
+ <if test="sTime != null and sTime != ''"> AND o.create_time >= #{sTime}</if>
|
|
|
+ <if test="eTime != null and eTime != ''"> AND o.create_time <= #{eTime}</if>
|
|
|
+ <if test="payPrice != null"> AND o.pay_price = #{payPrice}</if>
|
|
|
+ <if test="totalPrice != null"> AND o.total_price = #{totalPrice}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="returnUser != null and returnUser != ''"> AND o.update_by LIKE CONCAT('%', #{returnUser}, '%')</if>
|
|
|
+ <if test="returnTimeStart != null and returnTimeStart != ''"> AND o.update_time >= #{returnTimeStart}</if>
|
|
|
+ <if test="returnTimeEnd != null and returnTimeEnd != ''"> AND o.update_time <= #{returnTimeEnd}</if>
|
|
|
+ <if test="userPhone != null and userPhone != ''"> AND o.user_phone LIKE CONCAT('%', #{userPhone}, '%')</if>
|
|
|
+ <if test="memberPhone != null and memberPhone != ''"> AND o.receiver_phone LIKE CONCAT('%', #{memberPhone}, '%')</if>
|
|
|
+ <if test="companyUserName != null and companyUserName != ''"> AND cu.user_name LIKE CONCAT('%', #{companyUserName}, '%')</if>
|
|
|
+ <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
|
|
|
<if test="deliveryStartTime != null and deliveryStartTime != ''"> AND o.delivery_time >= #{deliveryStartTime}</if>
|
|
|
<if test="deliveryEndTime != null and deliveryEndTime != ''"> AND o.delivery_time <= #{deliveryEndTime}</if>
|
|
|
<if test="companyId != null"> AND o.company_id = #{companyId}</if>
|
|
|
</where>
|
|
|
GROUP BY o.order_id,o.update_time
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ HAVING GROUP_CONCAT(oi.product_name SEPARATOR ',') LIKE CONCAT('%', #{productName}, '%')
|
|
|
+ </if>
|
|
|
ORDER BY o.order_id DESC
|
|
|
</select>
|
|
|
|
|
|
@@ -541,6 +609,11 @@
|
|
|
<where>
|
|
|
o.status = 4
|
|
|
<if test="productName != null and productName != ''"> AND oi.product_name LIKE CONCAT('%', #{productName}, '%')</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
|
|
|
+ <if test="returnTimeStart != null and returnTimeStart != ''"> AND o.update_time >= #{returnTimeStart}</if>
|
|
|
+ <if test="returnTimeEnd != null and returnTimeEnd != ''"> AND o.update_time <= #{returnTimeEnd}</if>
|
|
|
+ <if test="companyId != null"> AND o.company_id = #{companyId}</if>
|
|
|
</where>
|
|
|
GROUP BY d.dept_name, o.delivery_name, oi.product_id, oi.product_name
|
|
|
ORDER BY d.dept_name, o.delivery_name, oi.product_name
|
|
|
@@ -578,11 +651,24 @@
|
|
|
<if test="userAddress != null and userAddress != ''">
|
|
|
AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')
|
|
|
</if>
|
|
|
+ <if test="sTime != null and sTime != ''"> AND o.create_time >= #{sTime}</if>
|
|
|
+ <if test="eTime != null and eTime != ''"> AND o.create_time <= #{eTime}</if>
|
|
|
+ <if test="totalPrice != null"> AND o.total_price = #{totalPrice}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="rejectReturnTimeStart != null and rejectReturnTimeStart != ''"> AND o.reject_return_time >= #{rejectReturnTimeStart}</if>
|
|
|
+ <if test="rejectReturnTimeEnd != null and rejectReturnTimeEnd != ''"> AND o.reject_return_time <= #{rejectReturnTimeEnd}</if>
|
|
|
+ <if test="returnUser != null and returnUser != ''"> AND o.update_by LIKE CONCAT('%', #{returnUser}, '%')</if>
|
|
|
+ <if test="userPhone != null and userPhone != ''"> AND o.user_phone LIKE CONCAT('%', #{userPhone}, '%')</if>
|
|
|
+ <if test="memberPhone != null and memberPhone != ''"> AND o.receiver_phone LIKE CONCAT('%', #{memberPhone}, '%')</if>
|
|
|
+ <if test="companyUserName != null and companyUserName != ''"> AND cu.user_name LIKE CONCAT('%', #{companyUserName}, '%')</if>
|
|
|
<if test="deliveryStartTime != null and deliveryStartTime != ''"> AND o.delivery_time >= #{deliveryStartTime}</if>
|
|
|
<if test="deliveryEndTime != null and deliveryEndTime != ''"> AND o.delivery_time <= #{deliveryEndTime}</if>
|
|
|
<if test="companyId != null"> AND o.company_id = #{companyId}</if>
|
|
|
</where>
|
|
|
GROUP BY o.order_id,o.reject_return_time
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ HAVING GROUP_CONCAT(oi.product_name SEPARATOR ',') LIKE CONCAT('%', #{productName}, '%')
|
|
|
+ </if>
|
|
|
ORDER BY o.order_id DESC
|
|
|
</select>
|
|
|
|
|
|
@@ -601,9 +687,15 @@
|
|
|
<where>
|
|
|
o.delivery_status IN (4, 5, 6)
|
|
|
<if test="productName != null and productName != ''"> AND oi.product_name LIKE CONCAT('%', #{productName}, '%')</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
<if test="companyId != null"> AND o.company_id = #{companyId}</if>
|
|
|
</where>
|
|
|
GROUP BY o.delivery_name, oi.product_id, oi.product_name
|
|
|
+ <if test="totalNum != null or totalPrice != null">
|
|
|
+ HAVING 1=1
|
|
|
+ <if test="totalNum != null"> AND SUM(oi.num) = #{totalNum}</if>
|
|
|
+ <if test="totalPrice != null"> AND SUM(oi.price * oi.num) = #{totalPrice}</if>
|
|
|
+ </if>
|
|
|
ORDER BY o.delivery_name, oi.product_name
|
|
|
</select>
|
|
|
|
|
|
@@ -632,6 +724,13 @@
|
|
|
<if test="deliverySn != null and deliverySn != ''"> AND o.delivery_sn = #{deliverySn}</if>
|
|
|
<if test="userName != null and userName != ''"> AND o.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
<if test="userAddress != null and userAddress != ''"> AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
|
|
|
+ <if test="payPrice != null"> AND o.pay_price = #{payPrice}</if>
|
|
|
+ <if test="collectionPrice != null"> AND o.collection_price = #{collectionPrice}</if>
|
|
|
+ <if test="totalPrice != null"> AND o.total_price = #{totalPrice}</if>
|
|
|
+ <if test="followTimeStart != null and followTimeStart != ''"> AND o.follow_time >= #{followTimeStart}</if>
|
|
|
+ <if test="followTimeEnd != null and followTimeEnd != ''"> AND o.follow_time <= #{followTimeEnd}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
|
|
|
<if test="deliveryStartTime != null and deliveryStartTime != ''"> AND o.delivery_time >= #{deliveryStartTime}</if>
|
|
|
<if test="deliveryEndTime != null and deliveryEndTime != ''"> AND o.delivery_time <= #{deliveryEndTime}</if>
|
|
|
<if test="companyId != null"> AND o.company_id = #{companyId}</if>
|
|
|
@@ -660,6 +759,10 @@
|
|
|
<if test="deliverySn != null and deliverySn != ''"> AND o.delivery_sn = #{deliverySn}</if>
|
|
|
<if test="userName != null and userName != ''"> AND o.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
<if test="userAddress != null and userAddress != ''"> AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
|
|
|
+ <if test="totalPrice != null"> AND o.total_price = #{totalPrice}</if>
|
|
|
+ <if test="followTimeStart != null and followTimeStart != ''"> AND o.follow_time >= #{followTimeStart}</if>
|
|
|
+ <if test="followTimeEnd != null and followTimeEnd != ''"> AND o.follow_time <= #{followTimeEnd}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND o.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
<if test="deliveryStartTime != null and deliveryStartTime != ''"> AND o.delivery_time >= #{deliveryStartTime}</if>
|
|
|
<if test="deliveryEndTime != null and deliveryEndTime != ''"> AND o.delivery_time <= #{deliveryEndTime}</if>
|
|
|
<if test="companyId != null"> AND o.company_id = #{companyId}</if>
|
|
|
@@ -706,6 +809,12 @@
|
|
|
</where>
|
|
|
GROUP BY d.dept_id, d.dept_name, c.company_id, c.company_name
|
|
|
) t
|
|
|
+ <where>
|
|
|
+ <if test="deliveryCount != null"> AND t.delivery_count = #{deliveryCount}</if>
|
|
|
+ <if test="deliveryAmount != null"> AND t.delivery_amount = #{deliveryAmount}</if>
|
|
|
+ <if test="signCount != null"> AND t.sign_count = #{signCount}</if>
|
|
|
+ <if test="signAmount != null"> AND t.sign_amount = #{signAmount}</if>
|
|
|
+ </where>
|
|
|
ORDER BY t.company_name, t.dept_name, t.order_type
|
|
|
</select>
|
|
|
|