|
|
@@ -90,6 +90,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="source" column="source" />
|
|
|
<result property="billPrice" column="bill_price" />
|
|
|
<result property="erpPhone" column="erp_phone" />
|
|
|
+ <result property="depositReturnTime" column="deposit_return_time" />
|
|
|
+ <result property="collectionPrice" column="collection_price" />
|
|
|
+ <result property="refundPrice" column="refund_price" />
|
|
|
+ <result property="auditor" column="auditor" />
|
|
|
+ <result property="auditTime" column="audit_time" />
|
|
|
+ <result property="diseaseName" column="disease_name" />
|
|
|
+ <result property="returnPrice" column="return_price" />
|
|
|
+ <result property="deliveryStatusUpdateTime" column="delivery_status_update_time" />
|
|
|
+ <result property="deliveryStatusUpdateBy" column="delivery_status_update_by" />
|
|
|
+ <result property="rejectReturnTime" column="reject_return_time" />
|
|
|
+ <result property="isReturnGoods" column="is_return_goods" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectFsStoreOrderVo">
|
|
|
@@ -721,6 +732,93 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
|
|
|
and so.erp_phone like concat(#{maps.erpPhoneNumber},'%')
|
|
|
</if>
|
|
|
+ <if test="maps.deliveryCode != null and maps.deliveryCode != ''">
|
|
|
+ and so.delivery_code = #{maps.deliveryCode}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryName != null and maps.deliveryName != ''">
|
|
|
+ and so.delivery_name like concat('%', #{maps.deliveryName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryTime != null and maps.deliveryTime != ''">
|
|
|
+ and so.delivery_time = #{maps.deliveryTime}
|
|
|
+ </if>
|
|
|
+ <if test="maps.totalPrice != null">
|
|
|
+ and so.total_price = #{maps.totalPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTime != null">
|
|
|
+ and DATE(so.follow_time) = DATE(#{maps.followTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTimeStart != null">
|
|
|
+ and DATE(so.follow_time) >= DATE(#{maps.followTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTimeEnd != null">
|
|
|
+ and DATE(so.follow_time) <= DATE(#{maps.followTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.remark != null and maps.remark != ''">
|
|
|
+ and so.remark like concat('%', #{maps.remark}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTime != null">
|
|
|
+ and DATE(so.deposit_return_time) = DATE(#{maps.depositReturnTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTimeStart != null">
|
|
|
+ and DATE(so.deposit_return_time) >= DATE(#{maps.depositReturnTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTimeEnd != null">
|
|
|
+ and DATE(so.deposit_return_time) <= DATE(#{maps.depositReturnTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.collectionPrice != null">
|
|
|
+ and so.collection_price = #{maps.collectionPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.refundPrice != null">
|
|
|
+ and so.refund_price = #{maps.refundPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditor != null and maps.auditor != ''">
|
|
|
+ and so.auditor = #{maps.auditor}
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTime != null">
|
|
|
+ and DATE(so.audit_time) = DATE(#{maps.auditTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTimeStart != null">
|
|
|
+ and DATE(so.audit_time) >= DATE(#{maps.auditTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTimeEnd != null">
|
|
|
+ and DATE(so.audit_time) <= DATE(#{maps.auditTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.diseaseName != null and maps.diseaseName != ''">
|
|
|
+ and so.disease_name like concat('%', #{maps.diseaseName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.returnPrice != null">
|
|
|
+ and so.return_price = #{maps.returnPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTime != null">
|
|
|
+ and DATE(so.delivery_status_update_time) = DATE(#{maps.deliveryStatusUpdateTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTimeStart != null">
|
|
|
+ and DATE(so.delivery_status_update_time) >= DATE(#{maps.deliveryStatusUpdateTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTimeEnd != null">
|
|
|
+ and DATE(so.delivery_status_update_time) <= DATE(#{maps.deliveryStatusUpdateTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateBy != null and maps.deliveryStatusUpdateBy != ''">
|
|
|
+ and so.delivery_status_update_by = #{maps.deliveryStatusUpdateBy}
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTime != null">
|
|
|
+ and DATE(so.reject_return_time) = DATE(#{maps.rejectReturnTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTimeStart != null">
|
|
|
+ and DATE(so.reject_return_time) >= DATE(#{maps.rejectReturnTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTimeEnd != null">
|
|
|
+ and DATE(so.reject_return_time) <= DATE(#{maps.rejectReturnTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.isReturnGoods != null">
|
|
|
+ and so.is_return_goods = #{maps.isReturnGoods}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStartTime != null">
|
|
|
+ and DATE(so.delivery_time) >= DATE(#{maps.deliveryStartTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryEndTime != null">
|
|
|
+ and DATE(so.delivery_time) <= DATE(#{maps.deliveryEndTime})
|
|
|
+ </if>
|
|
|
${maps.params.dataScope}
|
|
|
</select>
|
|
|
<select id="selectFsStoreOrderByOrderIdIn" resultType="com.fs.his.domain.FsStoreOrder">
|
|
|
@@ -932,6 +1030,93 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="maps.isPay != null">
|
|
|
and so.is_pay = #{maps.isPay}
|
|
|
</if>
|
|
|
+ <if test="maps.deliveryCode != null and maps.deliveryCode != ''">
|
|
|
+ and so.delivery_code = #{maps.deliveryCode}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryName != null and maps.deliveryName != ''">
|
|
|
+ and so.delivery_name like concat('%', #{maps.deliveryName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryTime != null and maps.deliveryTime != ''">
|
|
|
+ and so.delivery_time = #{maps.deliveryTime}
|
|
|
+ </if>
|
|
|
+ <if test="maps.totalPrice != null">
|
|
|
+ and so.total_price = #{maps.totalPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTime != null">
|
|
|
+ and DATE(so.follow_time) = DATE(#{maps.followTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTimeStart != null">
|
|
|
+ and DATE(so.follow_time) >= DATE(#{maps.followTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTimeEnd != null">
|
|
|
+ and DATE(so.follow_time) <= DATE(#{maps.followTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.remark != null and maps.remark != ''">
|
|
|
+ and so.remark like concat('%', #{maps.remark}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTime != null">
|
|
|
+ and DATE(so.deposit_return_time) = DATE(#{maps.depositReturnTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTimeStart != null">
|
|
|
+ and DATE(so.deposit_return_time) >= DATE(#{maps.depositReturnTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTimeEnd != null">
|
|
|
+ and DATE(so.deposit_return_time) <= DATE(#{maps.depositReturnTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.collectionPrice != null">
|
|
|
+ and so.collection_price = #{maps.collectionPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.refundPrice != null">
|
|
|
+ and so.refund_price = #{maps.refundPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditor != null and maps.auditor != ''">
|
|
|
+ and so.auditor = #{maps.auditor}
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTime != null">
|
|
|
+ and DATE(so.audit_time) = DATE(#{maps.auditTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTimeStart != null">
|
|
|
+ and DATE(so.audit_time) >= DATE(#{maps.auditTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTimeEnd != null">
|
|
|
+ and DATE(so.audit_time) <= DATE(#{maps.auditTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.diseaseName != null and maps.diseaseName != ''">
|
|
|
+ and so.disease_name like concat('%', #{maps.diseaseName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.returnPrice != null">
|
|
|
+ and so.return_price = #{maps.returnPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTime != null">
|
|
|
+ and DATE(so.delivery_status_update_time) = DATE(#{maps.deliveryStatusUpdateTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTimeStart != null">
|
|
|
+ and DATE(so.delivery_status_update_time) >= DATE(#{maps.deliveryStatusUpdateTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTimeEnd != null">
|
|
|
+ and DATE(so.delivery_status_update_time) <= DATE(#{maps.deliveryStatusUpdateTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateBy != null and maps.deliveryStatusUpdateBy != ''">
|
|
|
+ and so.delivery_status_update_by = #{maps.deliveryStatusUpdateBy}
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTime != null">
|
|
|
+ and DATE(so.reject_return_time) = DATE(#{maps.rejectReturnTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTimeStart != null">
|
|
|
+ and DATE(so.reject_return_time) >= DATE(#{maps.rejectReturnTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTimeEnd != null">
|
|
|
+ and DATE(so.reject_return_time) <= DATE(#{maps.rejectReturnTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.isReturnGoods != null">
|
|
|
+ and so.is_return_goods = #{maps.isReturnGoods}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStartTime != null">
|
|
|
+ and DATE(so.delivery_time) >= DATE(#{maps.deliveryStartTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryEndTime != null">
|
|
|
+ and DATE(so.delivery_time) <= DATE(#{maps.deliveryEndTime})
|
|
|
+ </if>
|
|
|
|
|
|
</where>
|
|
|
${maps.params.dataScope}
|
|
|
@@ -2348,6 +2533,93 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="maps.isPay != null">
|
|
|
and so.is_pay = #{maps.isPay}
|
|
|
</if>
|
|
|
+ <if test="maps.deliveryCode != null and maps.deliveryCode != ''">
|
|
|
+ and so.delivery_code = #{maps.deliveryCode}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryName != null and maps.deliveryName != ''">
|
|
|
+ and so.delivery_name like concat('%', #{maps.deliveryName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryTime != null and maps.deliveryTime != ''">
|
|
|
+ and so.delivery_time = #{maps.deliveryTime}
|
|
|
+ </if>
|
|
|
+ <if test="maps.totalPrice != null">
|
|
|
+ and so.total_price = #{maps.totalPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTime != null">
|
|
|
+ and DATE(so.follow_time) = DATE(#{maps.followTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTimeStart != null">
|
|
|
+ and DATE(so.follow_time) >= DATE(#{maps.followTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.followTimeEnd != null">
|
|
|
+ and DATE(so.follow_time) <= DATE(#{maps.followTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.remark != null and maps.remark != ''">
|
|
|
+ and so.remark like concat('%', #{maps.remark}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTime != null">
|
|
|
+ and DATE(so.deposit_return_time) = DATE(#{maps.depositReturnTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTimeStart != null">
|
|
|
+ and DATE(so.deposit_return_time) >= DATE(#{maps.depositReturnTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.depositReturnTimeEnd != null">
|
|
|
+ and DATE(so.deposit_return_time) <= DATE(#{maps.depositReturnTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.collectionPrice != null">
|
|
|
+ and so.collection_price = #{maps.collectionPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.refundPrice != null">
|
|
|
+ and so.refund_price = #{maps.refundPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditor != null and maps.auditor != ''">
|
|
|
+ and so.auditor = #{maps.auditor}
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTime != null">
|
|
|
+ and DATE(so.audit_time) = DATE(#{maps.auditTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTimeStart != null">
|
|
|
+ and DATE(so.audit_time) >= DATE(#{maps.auditTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.auditTimeEnd != null">
|
|
|
+ and DATE(so.audit_time) <= DATE(#{maps.auditTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.diseaseName != null and maps.diseaseName != ''">
|
|
|
+ and so.disease_name like concat('%', #{maps.diseaseName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.returnPrice != null">
|
|
|
+ and so.return_price = #{maps.returnPrice}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTime != null">
|
|
|
+ and DATE(so.delivery_status_update_time) = DATE(#{maps.deliveryStatusUpdateTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTimeStart != null">
|
|
|
+ and DATE(so.delivery_status_update_time) >= DATE(#{maps.deliveryStatusUpdateTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateTimeEnd != null">
|
|
|
+ and DATE(so.delivery_status_update_time) <= DATE(#{maps.deliveryStatusUpdateTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatusUpdateBy != null and maps.deliveryStatusUpdateBy != ''">
|
|
|
+ and so.delivery_status_update_by = #{maps.deliveryStatusUpdateBy}
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTime != null">
|
|
|
+ and DATE(so.reject_return_time) = DATE(#{maps.rejectReturnTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTimeStart != null">
|
|
|
+ and DATE(so.reject_return_time) >= DATE(#{maps.rejectReturnTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="maps.rejectReturnTimeEnd != null">
|
|
|
+ and DATE(so.reject_return_time) <= DATE(#{maps.rejectReturnTimeEnd})
|
|
|
+ </if>
|
|
|
+ <if test="maps.isReturnGoods != null">
|
|
|
+ and so.is_return_goods = #{maps.isReturnGoods}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStartTime != null">
|
|
|
+ and DATE(so.delivery_time) >= DATE(#{maps.deliveryStartTime})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryEndTime != null">
|
|
|
+ and DATE(so.delivery_time) <= DATE(#{maps.deliveryEndTime})
|
|
|
+ </if>
|
|
|
|
|
|
</where>
|
|
|
ORDER BY
|
|
|
@@ -2382,4 +2654,320 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
)
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectStoreFinanceOrderListVO" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsStoreFinanceOrderListVO">
|
|
|
+ SELECT
|
|
|
+ so.order_id AS orderId,
|
|
|
+ so.order_code AS orderCode,
|
|
|
+ so.create_time AS externalCreateTime,
|
|
|
+ so.deposit_return_time AS returnTime,
|
|
|
+ so.update_by AS returnUser,
|
|
|
+ so.user_name AS userName,
|
|
|
+ so.delivery_name AS deliveryName,
|
|
|
+ so.delivery_sn AS deliverySn,
|
|
|
+ so.total_price AS totalPrice,
|
|
|
+ so.collection_price AS collectionPrice,
|
|
|
+ so.return_price AS returnPrice,
|
|
|
+ so.user_phone AS receiverPhone,
|
|
|
+ GROUP_CONCAT(soi.json_info->>'$.productName' SEPARATOR ',') AS productNames,
|
|
|
+ so.remark,
|
|
|
+ so.delivery_time AS deliveryTime,
|
|
|
+ cu.user_name AS companyUserName,
|
|
|
+ c.company_name AS companyName,
|
|
|
+ d.dept_name AS deptName,
|
|
|
+ so.pay_type AS payType,
|
|
|
+ CASE WHEN so.status = 4 THEN 1 ELSE 0 END AS returnStatus
|
|
|
+ FROM fs_store_order so
|
|
|
+ LEFT JOIN company c ON so.company_id = c.company_id
|
|
|
+ LEFT JOIN company_user cu ON so.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
|
|
|
+ LEFT JOIN fs_store_order_item soi ON so.order_id = soi.order_id
|
|
|
+ <where>
|
|
|
+ <if test="orderCode != null and orderCode != ''"> AND so.order_code = #{orderCode}</if>
|
|
|
+ <if test="userName != null and userName != ''"> AND so.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
+ <if test="userPhone != null and userPhone != ''"> AND so.user_phone LIKE CONCAT('%', #{userPhone}, '%')</if>
|
|
|
+ <if test="deliverySn != null and deliverySn != ''"> AND so.delivery_sn = #{deliverySn}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND so.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="companyId != null"> AND so.company_id = #{companyId}</if>
|
|
|
+ <if test="returnStatus != null">
|
|
|
+ <if test="returnStatus == 1"> AND so.status = 4</if>
|
|
|
+ <if test="returnStatus == 0"> AND so.status != 4</if>
|
|
|
+ </if>
|
|
|
+ <if test="returnUser != null and returnUser != ''"> AND so.update_by LIKE CONCAT('%', #{returnUser}, '%')</if>
|
|
|
+ <if test="returnTimeStart != null and returnTimeStart != ''"> AND so.deposit_return_time >= #{returnTimeStart}</if>
|
|
|
+ <if test="returnTimeEnd != null and returnTimeEnd != ''"> AND so.deposit_return_time <= #{returnTimeEnd}</if>
|
|
|
+ <if test="totalPrice != null"> AND so.total_price = #{totalPrice}</if>
|
|
|
+ <if test="collectionPrice != null"> AND so.collection_price = #{collectionPrice}</if>
|
|
|
+ <if test="receiverPhone != null and receiverPhone != ''"> AND so.user_phone LIKE CONCAT('%', #{receiverPhone}, '%')</if>
|
|
|
+ <if test="remark != null and remark != ''"> AND so.remark LIKE CONCAT('%', #{remark}, '%')</if>
|
|
|
+ <if test="payType != null"> AND so.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 so.create_time >= #{sTime}</if>
|
|
|
+ <if test="eTime != null"> AND so.create_time <= #{eTime}</if>
|
|
|
+ <if test="deliveryStartTime != null"> AND so.delivery_time >= #{deliveryStartTime}</if>
|
|
|
+ <if test="deliveryEndTime != null"> AND so.delivery_time <= #{deliveryEndTime}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY so.order_id
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ HAVING GROUP_CONCAT(soi.json_info->>'$.productName' SEPARATOR ',') LIKE CONCAT('%', #{productName}, '%')
|
|
|
+ </if>
|
|
|
+ ORDER BY so.create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStoreReturnOrderReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsReturnOrderReportVO">
|
|
|
+ SELECT
|
|
|
+ so.order_code AS orderCode,
|
|
|
+ so.delivery_sn AS deliverySn,
|
|
|
+ so.user_name AS userName,
|
|
|
+ so.user_address AS userAddress,
|
|
|
+ so.create_time AS externalCreateTime,
|
|
|
+ so.pay_money AS payPrice,
|
|
|
+ so.total_price AS totalPrice,
|
|
|
+ so.delivery_name AS deliveryName,
|
|
|
+ so.update_by AS returnUser,
|
|
|
+ so.deposit_return_time AS returnTime,
|
|
|
+ so.user_phone AS userPhone,
|
|
|
+ so.user_phone AS memberPhone,
|
|
|
+ cu.user_name AS companyUserName,
|
|
|
+ d.dept_name AS deptName,
|
|
|
+ GROUP_CONCAT(soi.json_info->>'$.productName' SEPARATOR ',') AS productNames,
|
|
|
+ so.delivery_time AS deliveryTime
|
|
|
+ FROM fs_store_order so
|
|
|
+ LEFT JOIN company c ON so.company_id = c.company_id
|
|
|
+ LEFT JOIN company_user cu ON so.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
|
|
|
+ LEFT JOIN fs_store_order_item soi ON so.order_id = soi.order_id
|
|
|
+ WHERE so.status = 4
|
|
|
+ <if test="orderCode != null and orderCode != ''"> AND so.order_code = #{orderCode}</if>
|
|
|
+ <if test="deliverySn != null and deliverySn != ''"> AND so.delivery_sn = #{deliverySn}</if>
|
|
|
+ <if test="userName != null and userName != ''"> AND so.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
+ <if test="userAddress != null and userAddress != ''"> AND so.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
|
|
|
+ <if test="sTime != null"> AND so.create_time >= #{sTime}</if>
|
|
|
+ <if test="eTime != null"> AND so.create_time <= #{eTime}</if>
|
|
|
+ <if test="payPrice != null"> AND so.pay_money = #{payPrice}</if>
|
|
|
+ <if test="totalPrice != null"> AND so.total_price = #{totalPrice}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND so.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="returnUser != null and returnUser != ''"> AND so.update_by LIKE CONCAT('%', #{returnUser}, '%')</if>
|
|
|
+ <if test="returnTimeStart != null and returnTimeStart != ''"> AND so.deposit_return_time >= #{returnTimeStart}</if>
|
|
|
+ <if test="returnTimeEnd != null and returnTimeEnd != ''"> AND so.deposit_return_time <= #{returnTimeEnd}</if>
|
|
|
+ <if test="userPhone != null and userPhone != ''"> AND so.user_phone LIKE CONCAT('%', #{userPhone}, '%')</if>
|
|
|
+ <if test="receiverPhone != null and receiverPhone != ''"> AND so.user_phone LIKE CONCAT('%', #{receiverPhone}, '%')</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 so.delivery_time >= #{deliveryStartTime}</if>
|
|
|
+ <if test="deliveryEndTime != null"> AND so.delivery_time <= #{deliveryEndTime}</if>
|
|
|
+ <if test="companyId != null"> AND so.company_id = #{companyId}</if>
|
|
|
+ GROUP BY so.order_id
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ HAVING GROUP_CONCAT(soi.json_info->>'$.productName' SEPARATOR ',') LIKE CONCAT('%', #{productName}, '%')
|
|
|
+ </if>
|
|
|
+ ORDER BY so.order_id DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStoreReturnProductReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsReturnProductReportVO">
|
|
|
+ SELECT
|
|
|
+ d.dept_name AS deptName,
|
|
|
+ so.delivery_name AS deliveryName,
|
|
|
+ soi.json_info->>'$.productName' AS productName,
|
|
|
+ soi.product_id AS productId,
|
|
|
+ SUM(CAST(soi.json_info->>'$.num' AS DECIMAL(10,0))) AS num,
|
|
|
+ SUM(CAST(soi.json_info->>'$.price' AS DECIMAL(10,2)) * CAST(soi.json_info->>'$.num' AS DECIMAL(10,0))) AS totalPrice
|
|
|
+ FROM fs_store_order so
|
|
|
+ LEFT JOIN company_user cu ON so.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
|
|
|
+ INNER JOIN fs_store_order_item soi ON so.order_id = soi.order_id
|
|
|
+ WHERE so.status = 4
|
|
|
+ <if test="productName != null and productName != ''"> AND soi.json_info->>'$.productName' LIKE CONCAT('%', #{productName}, '%')</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND so.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
|
|
|
+ <if test="returnTimeStart != null and returnTimeStart != ''"> AND so.deposit_return_time >= #{returnTimeStart}</if>
|
|
|
+ <if test="returnTimeEnd != null and returnTimeEnd != ''"> AND so.deposit_return_time <= #{returnTimeEnd}</if>
|
|
|
+ <if test="companyId != null"> AND so.company_id = #{companyId}</if>
|
|
|
+ GROUP BY d.dept_name, so.delivery_name, soi.product_id, soi.json_info->>'$.productName'
|
|
|
+ ORDER BY d.dept_name, so.delivery_name, soi.json_info->>'$.productName'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStoreRejectOrderReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsRejectOrderReportVO">
|
|
|
+ SELECT
|
|
|
+ so.order_code AS orderCode,
|
|
|
+ so.delivery_sn AS deliverySn,
|
|
|
+ so.user_name AS userName,
|
|
|
+ so.create_time AS externalCreateTime,
|
|
|
+ so.delivery_time AS deliveryTime,
|
|
|
+ so.total_price AS totalPrice,
|
|
|
+ so.delivery_name AS deliveryName,
|
|
|
+ so.follow_time AS followTime,
|
|
|
+ so.reject_return_time AS rejectReturnTime,
|
|
|
+ so.delivery_status_update_by AS rejectUser,
|
|
|
+ so.user_phone AS userPhone,
|
|
|
+ so.user_phone AS memberPhone,
|
|
|
+ cu.user_name AS companyUserName,
|
|
|
+ GROUP_CONCAT(soi.json_info->>'$.productName' SEPARATOR ',') AS productNames,
|
|
|
+ so.user_address AS userAddress
|
|
|
+ FROM fs_store_order so
|
|
|
+ LEFT JOIN company c ON so.company_id = c.company_id
|
|
|
+ LEFT JOIN company_user cu ON so.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
|
|
|
+ LEFT JOIN fs_store_order_item soi ON so.order_id = soi.order_id
|
|
|
+ <where>
|
|
|
+ so.delivery_status IN (4, 5, 6)
|
|
|
+ <if test="orderCode != null and orderCode != ''"> AND so.order_code = #{orderCode}</if>
|
|
|
+ <if test="deliverySn != null and deliverySn != ''"> AND so.delivery_sn = #{deliverySn}</if>
|
|
|
+ <if test="userName != null and userName != ''"> AND so.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
+ <if test="userAddress != null and userAddress != ''"> AND so.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
|
|
|
+ <if test="sTime != null"> AND so.create_time >= #{sTime}</if>
|
|
|
+ <if test="eTime != null"> AND so.create_time <= #{eTime}</if>
|
|
|
+ <if test="totalPrice != null"> AND so.total_price = #{totalPrice}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND so.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="rejectReturnTimeStart != null and rejectReturnTimeStart != ''"> AND so.reject_return_time >= #{rejectReturnTimeStart}</if>
|
|
|
+ <if test="rejectReturnTimeEnd != null and rejectReturnTimeEnd != ''"> AND so.reject_return_time <= #{rejectReturnTimeEnd}</if>
|
|
|
+ <if test="returnUser != null and returnUser != ''"> AND so.delivery_status_update_by LIKE CONCAT('%', #{returnUser}, '%')</if>
|
|
|
+ <if test="userPhone != null and userPhone != ''"> AND so.user_phone LIKE CONCAT('%', #{userPhone}, '%')</if>
|
|
|
+ <if test="receiverPhone != null and receiverPhone != ''"> AND so.receiver_phone LIKE CONCAT('%', #{receiverPhone}, '%')</if>
|
|
|
+ <if test="companyUserName != null and companyUserName != ''"> AND cu.user_name LIKE CONCAT('%', #{companyUserName}, '%')</if>
|
|
|
+ <if test="deliveryStartTime != null"> AND so.delivery_time >= #{deliveryStartTime}</if>
|
|
|
+ <if test="deliveryEndTime != null"> AND so.delivery_time <= #{deliveryEndTime}</if>
|
|
|
+ <if test="companyId != null"> AND so.company_id = #{companyId}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY so.order_id
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ HAVING GROUP_CONCAT(soi.json_info->>'$.productName' SEPARATOR ',') LIKE CONCAT('%', #{productName}, '%')
|
|
|
+ </if>
|
|
|
+ ORDER BY so.order_id DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStoreRejectProductReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsRejectProductReportVO">
|
|
|
+ SELECT
|
|
|
+ soi.json_info->>'$.productName' AS productName,
|
|
|
+ so.delivery_name AS deliveryName,
|
|
|
+ SUM(CAST(soi.json_info->>'$.num' AS DECIMAL(10,0))) AS num,
|
|
|
+ SUM(CAST(soi.json_info->>'$.price' AS DECIMAL(10,2)) * CAST(soi.json_info->>'$.num' AS DECIMAL(10,0))) AS totalPrice
|
|
|
+ FROM fs_store_order so
|
|
|
+ LEFT JOIN company_user cu ON so.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
|
|
|
+ INNER JOIN fs_store_order_item soi ON so.order_id = soi.order_id
|
|
|
+ <where>
|
|
|
+ so.delivery_status IN (4, 5, 6)
|
|
|
+ <if test="productName != null and productName != ''"> AND soi.json_info->>'$.productName' LIKE CONCAT('%', #{productName}, '%')</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND so.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="companyId != null"> AND so.company_id = #{companyId}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY so.delivery_name, soi.json_info->>'$.productName'
|
|
|
+ <if test="totalNum != null or totalPrice != null">
|
|
|
+ HAVING 1=1
|
|
|
+ <if test="totalNum != null"> AND SUM(CAST(soi.json_info->>'$.num' AS DECIMAL(10,0))) = #{totalNum}</if>
|
|
|
+ <if test="totalPrice != null"> AND SUM(CAST(soi.json_info->>'$.price' AS DECIMAL(10,2)) * CAST(soi.json_info->>'$.num' AS DECIMAL(10,0))) = #{totalPrice}</if>
|
|
|
+ </if>
|
|
|
+ ORDER BY so.delivery_name, soi.json_info->>'$.productName'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStoreSignOrderReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsSignOrderReportVO">
|
|
|
+ SELECT
|
|
|
+ so.order_code AS orderCode,
|
|
|
+ so.delivery_sn AS deliverySn,
|
|
|
+ so.user_name AS userName,
|
|
|
+ so.user_address AS userAddress,
|
|
|
+ so.delivery_time AS deliveryTime,
|
|
|
+ so.pay_money AS payPrice,
|
|
|
+ so.collection_price AS collectionPrice,
|
|
|
+ so.total_price AS totalPrice,
|
|
|
+ so.follow_time AS followTime,
|
|
|
+ so.delivery_name AS deliveryName,
|
|
|
+ d.dept_name AS deptName,
|
|
|
+ c.company_name AS companyName
|
|
|
+ FROM fs_store_order so
|
|
|
+ LEFT JOIN company c ON so.company_id = c.company_id
|
|
|
+ LEFT JOIN company_user cu ON so.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
|
|
|
+ <where>
|
|
|
+ so.delivery_status = 3 AND so.status != 4
|
|
|
+ <if test="orderCode != null and orderCode != ''"> AND so.order_code = #{orderCode}</if>
|
|
|
+ <if test="deliverySn != null and deliverySn != ''"> AND so.delivery_sn = #{deliverySn}</if>
|
|
|
+ <if test="userName != null and userName != ''"> AND so.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
+ <if test="userAddress != null and userAddress != ''"> AND so.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
|
|
|
+ <if test="payPrice != null"> AND so.pay_money = #{payPrice}</if>
|
|
|
+ <if test="collectionPrice != null"> AND so.collection_price = #{collectionPrice}</if>
|
|
|
+ <if test="totalPrice != null"> AND so.total_price = #{totalPrice}</if>
|
|
|
+ <if test="followTimeStart != null and followTimeStart != ''"> AND so.follow_time >= #{followTimeStart}</if>
|
|
|
+ <if test="followTimeEnd != null and followTimeEnd != ''"> AND so.follow_time <= #{followTimeEnd}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND so.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
|
|
|
+ <if test="deliveryStartTime != null"> AND so.delivery_time >= #{deliveryStartTime}</if>
|
|
|
+ <if test="deliveryEndTime != null"> AND so.delivery_time <= #{deliveryEndTime}</if>
|
|
|
+ <if test="companyId != null"> AND so.company_id = #{companyId}</if>
|
|
|
+ </where>
|
|
|
+ ORDER BY so.order_id DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStoreRejectNoReturnReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsRejectNoReturnReportVO">
|
|
|
+ SELECT
|
|
|
+ so.order_code AS orderCode,
|
|
|
+ so.delivery_sn AS deliverySn,
|
|
|
+ so.user_name AS userName,
|
|
|
+ so.user_address AS userAddress,
|
|
|
+ so.delivery_time AS deliveryTime,
|
|
|
+ so.total_price AS totalPrice,
|
|
|
+ so.follow_time AS followTime,
|
|
|
+ so.delivery_name AS deliveryName
|
|
|
+ FROM fs_store_order so
|
|
|
+ LEFT JOIN company c ON so.company_id = c.company_id
|
|
|
+ LEFT JOIN company_user cu ON so.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
|
|
|
+ <where>
|
|
|
+ so.delivery_status = 4 AND (so.is_return_goods IS NULL OR so.is_return_goods = 2)
|
|
|
+ <if test="orderCode != null and orderCode != ''"> AND so.order_code = #{orderCode}</if>
|
|
|
+ <if test="deliverySn != null and deliverySn != ''"> AND so.delivery_sn = #{deliverySn}</if>
|
|
|
+ <if test="userName != null and userName != ''"> AND so.user_name LIKE CONCAT('%', #{userName}, '%')</if>
|
|
|
+ <if test="userAddress != null and userAddress != ''"> AND so.user_address LIKE CONCAT('%', #{userAddress}, '%')</if>
|
|
|
+ <if test="totalPrice != null"> AND so.total_price = #{totalPrice}</if>
|
|
|
+ <if test="followTimeStart != null and followTimeStart != ''"> AND so.follow_time >= #{followTimeStart}</if>
|
|
|
+ <if test="followTimeEnd != null and followTimeEnd != ''"> AND so.follow_time <= #{followTimeEnd}</if>
|
|
|
+ <if test="deliveryName != null and deliveryName != ''"> AND so.delivery_name LIKE CONCAT('%', #{deliveryName}, '%')</if>
|
|
|
+ <if test="deliveryStartTime != null"> AND so.delivery_time >= #{deliveryStartTime}</if>
|
|
|
+ <if test="deliveryEndTime != null"> AND so.delivery_time <= #{deliveryEndTime}</if>
|
|
|
+ <if test="companyId != null"> AND so.company_id = #{companyId}</if>
|
|
|
+ </where>
|
|
|
+ ORDER BY so.order_id DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStoreSignDetailReport" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="com.fs.his.domain.vo.FsSignDetailReportVO">
|
|
|
+ SELECT
|
|
|
+ t.order_type AS orderType,
|
|
|
+ t.delivery_count AS deliveryCount,
|
|
|
+ t.delivery_amount AS deliveryAmount,
|
|
|
+ t.sign_count AS signCount,
|
|
|
+ t.sign_amount AS signAmount,
|
|
|
+ CASE WHEN t.delivery_count > 0
|
|
|
+ THEN CONCAT(ROUND(t.sign_count * 100.0 / t.delivery_count, 2), '%')
|
|
|
+ ELSE '0%' END AS orderSignRate,
|
|
|
+ CASE WHEN t.delivery_amount > 0
|
|
|
+ THEN CONCAT(ROUND(t.sign_amount * 100.0 / t.delivery_amount, 2), '%')
|
|
|
+ ELSE '0%' END AS amountSignRate,
|
|
|
+ t.dept_name AS deptName,
|
|
|
+ t.company_name AS companyName
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ 2 AS order_type,
|
|
|
+ COUNT(so.order_id) AS delivery_count,
|
|
|
+ COALESCE(SUM(so.total_price), 0) AS delivery_amount,
|
|
|
+ COUNT(CASE WHEN so.delivery_status = 3 THEN 1 END) AS sign_count,
|
|
|
+ COALESCE(SUM(CASE WHEN so.delivery_status = 3 THEN so.total_price ELSE 0 END), 0) AS sign_amount,
|
|
|
+ d.dept_name AS dept_name,
|
|
|
+ c.company_name AS company_name
|
|
|
+ FROM fs_store_order so
|
|
|
+ LEFT JOIN company c ON so.company_id = c.company_id
|
|
|
+ LEFT JOIN company_user cu ON so.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company_dept d ON cu.dept_id = d.dept_id
|
|
|
+ <where>
|
|
|
+ so.status >= 3
|
|
|
+ <if test="companyId != null"> AND so.company_id = #{companyId}</if>
|
|
|
+ <if test="deptId != null"> AND cu.dept_id = #{deptId}</if>
|
|
|
+ <if test="sTime != null and sTime != ''"> AND so.create_time >= #{sTime}</if>
|
|
|
+ <if test="eTime != null and eTime != ''"> AND so.create_time <= #{eTime}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY d.dept_id, d.dept_name, c.company_id, c.company_name
|
|
|
+ ) t
|
|
|
+ ORDER BY t.company_name, t.dept_name
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|