|
|
@@ -1,53 +1,70 @@
|
|
|
-<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
<!DOCTYPE mapper
|
|
|
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.fs.his.mapper.FsExternalOrderMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="FsExternalOrder" id="FsExternalOrderResult">
|
|
|
- <result property="orderId" column="order_id" />
|
|
|
- <result property="orderCode" column="order_code" />
|
|
|
- <result property="source" column="source" />
|
|
|
- <result property="userId" column="user_id" />
|
|
|
- <result property="userName" column="user_name" />
|
|
|
- <result property="userPhone" column="user_phone" />
|
|
|
- <result property="userAddress" column="user_address" />
|
|
|
- <result property="totalNum" column="total_num" />
|
|
|
- <result property="totalPrice" column="total_price" />
|
|
|
- <result property="payPrice" column="pay_price" />
|
|
|
- <result property="freightPrice" column="freight_price" />
|
|
|
- <result property="isPay" column="is_pay" />
|
|
|
- <result property="payTime" column="pay_time" />
|
|
|
- <result property="payType" column="pay_type" />
|
|
|
- <result property="status" column="status" />
|
|
|
- <result property="deliveryCode" column="delivery_code" />
|
|
|
- <result property="deliveryName" column="delivery_name" />
|
|
|
- <result property="deliverySn" column="delivery_sn" />
|
|
|
- <result property="deliveryTime" column="delivery_time" />
|
|
|
- <result property="deliveryStatus" column="delivery_status" />
|
|
|
- <result property="deliveryType" column="delivery_type" />
|
|
|
- <result property="deliveryUpdateTime" column="delivery_update_time" />
|
|
|
- <result property="shippingType" column="shipping_type" />
|
|
|
- <result property="companyId" column="company_id" />
|
|
|
- <result property="companyUserId" column="company_user_id" />
|
|
|
- <result property="remark" column="remark" />
|
|
|
- <result property="externalCreateTime" column="external_create_time" />
|
|
|
- <result property="isSync" column="is_sync" />
|
|
|
- <result property="syncMsg" column="sync_msg" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="updateTime" column="update_time" />
|
|
|
- <result property="extendOrderId" column="extend_order_id" />
|
|
|
- <result property="storeId" column="store_id" />
|
|
|
- <result property="receiverPhone" column="receiver_phone" />
|
|
|
+ <result property="orderId" column="order_id" />
|
|
|
+ <result property="orderCode" column="order_code" />
|
|
|
+ <result property="source" column="source" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="userName" column="user_name" />
|
|
|
+ <result property="userPhone" column="user_phone" />
|
|
|
+ <result property="userAddress" column="user_address" />
|
|
|
+ <result property="totalNum" column="total_num" />
|
|
|
+ <result property="totalPrice" column="total_price" />
|
|
|
+ <result property="payPrice" column="pay_price" />
|
|
|
+ <result property="freightPrice" column="freight_price" />
|
|
|
+ <result property="isPay" column="is_pay" />
|
|
|
+ <result property="payTime" column="pay_time" />
|
|
|
+ <result property="payType" column="pay_type" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <result property="deliveryCode" column="delivery_code" />
|
|
|
+ <result property="deliveryName" column="delivery_name" />
|
|
|
+ <result property="deliverySn" column="delivery_sn" />
|
|
|
+ <result property="deliveryTime" column="delivery_time" />
|
|
|
+ <result property="deliveryStatus" column="delivery_status" />
|
|
|
+ <result property="deliveryType" column="delivery_type" />
|
|
|
+ <result property="deliveryUpdateTime" column="delivery_update_time" />
|
|
|
+ <result property="shippingType" column="shipping_type" />
|
|
|
+ <result property="companyId" column="company_id" />
|
|
|
+ <result property="companyUserId" column="company_user_id" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="externalCreateTime" column="external_create_time" />
|
|
|
+ <result property="isSync" column="is_sync" />
|
|
|
+ <result property="syncMsg" column="sync_msg" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="extendOrderId" column="extend_order_id" />
|
|
|
+ <result property="storeId" column="store_id" />
|
|
|
+ <result property="receiverPhone" column="receiver_phone" />
|
|
|
+ <result property="depositReturnTime" column="deposit_return_time" />
|
|
|
+ <result property="collectionPrice" column="collection_price" />
|
|
|
+ <result property="followTime" column="follow_time" />
|
|
|
+ <result property="refundPrice" column="refund_price" />
|
|
|
+ <result property="refundTime" column="refund_time" />
|
|
|
+ <result property="orderType" column="order_type" />
|
|
|
+ <result property="auditor" column="auditor" />
|
|
|
+ <result property="auditTime" column="audit_time" />
|
|
|
+ <result property="diseaseName" column="disease_name" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectFsExternalOrderVo">
|
|
|
- select order_id, order_code, source, user_id, user_name, user_phone, user_address, total_num, total_price, pay_price, freight_price, is_pay, pay_time, pay_type, status, delivery_code, delivery_name, delivery_sn, delivery_time, delivery_status, delivery_type, delivery_update_time, shipping_type, company_id, company_user_id, remark, external_create_time, is_sync, sync_msg, create_time, update_time, extend_order_id, store_id, receiver_phone from fs_external_order
|
|
|
+ select order_id, order_code, source, user_id, user_name, user_phone, user_address,
|
|
|
+ total_num, total_price, pay_price, freight_price, is_pay, pay_time, pay_type,
|
|
|
+ status, delivery_code, delivery_name, delivery_sn, delivery_time, delivery_status,
|
|
|
+ delivery_type, delivery_update_time, shipping_type, company_id, company_user_id,
|
|
|
+ remark, external_create_time, is_sync, sync_msg, create_time, update_time,
|
|
|
+ extend_order_id, store_id, receiver_phone,
|
|
|
+ deposit_return_time, collection_price, follow_time,
|
|
|
+ refund_price, refund_time, order_type, auditor, audit_time, disease_name
|
|
|
+ from fs_external_order
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectFsExternalOrderList" parameterType="FsExternalOrder" resultMap="FsExternalOrderResult">
|
|
|
<include refid="selectFsExternalOrderVo"/>
|
|
|
- <where>
|
|
|
+ <where>
|
|
|
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
|
|
|
<if test="source != null and source != ''"> and source = #{source}</if>
|
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
|
@@ -60,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</where>
|
|
|
order by create_time desc
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectFsExternalOrderByOrderId" parameterType="Long" resultMap="FsExternalOrderResult">
|
|
|
<include refid="selectFsExternalOrderVo"/>
|
|
|
where order_id = #{orderId}
|
|
|
@@ -112,9 +129,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="externalCreateTime != null">external_create_time,</if>
|
|
|
<if test="isSync != null">is_sync,</if>
|
|
|
<if test="syncMsg != null and syncMsg != ''">sync_msg,</if>
|
|
|
- <if test="extendOrderId !=null and extendOrderId !=''">extend_order_id,</if>
|
|
|
+ <if test="extendOrderId != null and extendOrderId != ''">extend_order_id,</if>
|
|
|
<if test="storeId != null">store_id,</if>
|
|
|
<if test="receiverPhone != null and receiverPhone != ''">receiver_phone,</if>
|
|
|
+ <if test="depositReturnTime != null">deposit_return_time,</if>
|
|
|
+ <if test="collectionPrice != null">collection_price,</if>
|
|
|
+ <if test="followTime != null">follow_time,</if>
|
|
|
+ <if test="refundPrice != null">refund_price,</if>
|
|
|
+ <if test="refundTime != null">refund_time,</if>
|
|
|
+ <if test="orderType != null">order_type,</if>
|
|
|
+ <if test="auditor != null and auditor != ''">auditor,</if>
|
|
|
+ <if test="auditTime != null">audit_time,</if>
|
|
|
+ <if test="diseaseName != null and diseaseName != ''">disease_name,</if>
|
|
|
create_time
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
@@ -146,9 +172,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="externalCreateTime != null">#{externalCreateTime},</if>
|
|
|
<if test="isSync != null">#{isSync},</if>
|
|
|
<if test="syncMsg != null and syncMsg != ''">#{syncMsg},</if>
|
|
|
- <if test="extendOrderId !=null and extendOrderId !=''">#{extendOrderId},</if>
|
|
|
+ <if test="extendOrderId != null and extendOrderId != ''">#{extendOrderId},</if>
|
|
|
<if test="storeId != null">#{storeId},</if>
|
|
|
<if test="receiverPhone != null and receiverPhone != ''">#{receiverPhone},</if>
|
|
|
+ <if test="depositReturnTime != null">#{depositReturnTime},</if>
|
|
|
+ <if test="collectionPrice != null">#{collectionPrice},</if>
|
|
|
+ <if test="followTime != null">#{followTime},</if>
|
|
|
+ <if test="refundPrice != null">#{refundPrice},</if>
|
|
|
+ <if test="refundTime != null">#{refundTime},</if>
|
|
|
+ <if test="orderType != null">#{orderType},</if>
|
|
|
+ <if test="auditor != null and auditor != ''">#{auditor},</if>
|
|
|
+ <if test="auditTime != null">#{auditTime},</if>
|
|
|
+ <if test="diseaseName != null and diseaseName != ''">#{diseaseName},</if>
|
|
|
sysdate()
|
|
|
</trim>
|
|
|
</insert>
|
|
|
@@ -184,9 +219,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="externalCreateTime != null">external_create_time = #{externalCreateTime},</if>
|
|
|
<if test="isSync != null">is_sync = #{isSync},</if>
|
|
|
<if test="syncMsg != null and syncMsg != ''">sync_msg = #{syncMsg},</if>
|
|
|
- <if test="extendOrderId !=null and extendOrderId !=''">extend_order_id = #{extendOrderId},</if>
|
|
|
+ <if test="extendOrderId != null and extendOrderId != ''">extend_order_id = #{extendOrderId},</if>
|
|
|
<if test="storeId != null">store_id = #{storeId},</if>
|
|
|
<if test="receiverPhone != null and receiverPhone != ''">receiver_phone = #{receiverPhone},</if>
|
|
|
+ <if test="depositReturnTime != null">deposit_return_time = #{depositReturnTime},</if>
|
|
|
+ <if test="collectionPrice != null">collection_price = #{collectionPrice},</if>
|
|
|
+ <if test="followTime != null">follow_time = #{followTime},</if>
|
|
|
+ <if test="refundPrice != null">refund_price = #{refundPrice},</if>
|
|
|
+ <if test="refundTime != null">refund_time = #{refundTime},</if>
|
|
|
+ <if test="orderType != null">order_type = #{orderType},</if>
|
|
|
+ <if test="auditor != null and auditor != ''">auditor = #{auditor},</if>
|
|
|
+ <if test="auditTime != null">audit_time = #{auditTime},</if>
|
|
|
+ <if test="diseaseName != null and diseaseName != ''">disease_name = #{diseaseName},</if>
|
|
|
update_time = sysdate()
|
|
|
</trim>
|
|
|
where order_id = #{orderId}
|
|
|
@@ -197,39 +241,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteFsExternalOrderByOrderIds" parameterType="String">
|
|
|
- delete from fs_external_order where order_id in
|
|
|
+ delete from fs_external_order where order_id in
|
|
|
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
|
|
#{orderId}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
|
|
|
<select id="selectExternalOrderListVO" parameterType="FsExternalOrder" resultType="com.fs.his.domain.vo.FsExternalOrderListVO">
|
|
|
- SELECT
|
|
|
- o.order_id,
|
|
|
- o.order_code,
|
|
|
- c.company_name AS companyName,
|
|
|
- cu.user_name AS companyUserName,
|
|
|
- o.user_name AS userName,
|
|
|
- o.user_phone AS userPhone,
|
|
|
- GROUP_CONCAT(oi.product_name SEPARATOR ',') AS productNames,
|
|
|
- IFNULL(o.total_price, SUM(oi.price)) AS receivablePrice,
|
|
|
- o.pay_price AS payPrice,
|
|
|
- o.pay_type AS payType,
|
|
|
- o.external_create_time AS externalCreateTime,
|
|
|
- o.status,
|
|
|
- o.delivery_sn AS deliverySn,
|
|
|
- o.delivery_status AS deliveryStatus,
|
|
|
- o.delivery_type AS deliveryType,
|
|
|
- o.delivery_update_time AS deliveryUpdateTime,
|
|
|
- CASE o.status
|
|
|
- WHEN 1 THEN '待审核'
|
|
|
- WHEN 2 THEN '待发货'
|
|
|
- WHEN 3 THEN '待收货'
|
|
|
- WHEN 4 THEN '已完成'
|
|
|
- WHEN -3 THEN '已取消'
|
|
|
- ELSE '未知'
|
|
|
- END AS statusDesc,
|
|
|
- IF(fa.id IS NOT NULL AND fa.audit_status = 0, true, false) AS isApplyAudit
|
|
|
+ SELECT
|
|
|
+ o.order_id,
|
|
|
+ o.order_code,
|
|
|
+ c.company_name AS companyName,
|
|
|
+ cu.user_name AS companyUserName,
|
|
|
+ o.user_name AS userName,
|
|
|
+ o.user_phone AS userPhone,
|
|
|
+ GROUP_CONCAT(oi.product_name SEPARATOR ',') AS productNames,
|
|
|
+ IFNULL(o.total_price, SUM(oi.price)) AS receivablePrice,
|
|
|
+ o.pay_price AS payPrice,
|
|
|
+ o.pay_type AS payType,
|
|
|
+ o.external_create_time AS externalCreateTime,
|
|
|
+ o.status,
|
|
|
+ o.delivery_sn AS deliverySn,
|
|
|
+ o.delivery_status AS deliveryStatus,
|
|
|
+ o.delivery_type AS deliveryType,
|
|
|
+ o.delivery_update_time AS deliveryUpdateTime,
|
|
|
+ CASE o.status
|
|
|
+ WHEN 1 THEN '待审核'
|
|
|
+ WHEN 2 THEN '待发货'
|
|
|
+ WHEN 3 THEN '待收货'
|
|
|
+ WHEN 4 THEN '已完成'
|
|
|
+ WHEN -3 THEN '已取消'
|
|
|
+ ELSE '未知'
|
|
|
+ END AS statusDesc,
|
|
|
+ IF(fa.id IS NOT NULL AND fa.audit_status = 0, true, false) AS isApplyAudit
|
|
|
FROM fs_external_order o
|
|
|
LEFT JOIN company c ON o.company_id = c.company_id
|
|
|
LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
|
|
|
@@ -282,17 +326,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
c.company_name AS companyName,
|
|
|
cu.nick_name AS companyUserName
|
|
|
FROM fs_external_order o
|
|
|
- LEFT JOIN company c ON o.company_id = c.company_id
|
|
|
- LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
|
|
|
+ LEFT JOIN company c ON o.company_id = c.company_id
|
|
|
+ LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
|
|
|
WHERE o.order_id = #{orderId}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectSignedOrdersWithoutAudit" resultMap="FsExternalOrderResult">
|
|
|
select * from fs_external_order o
|
|
|
- where o.delivery_status = 3 and o.status !=-3
|
|
|
+ where o.delivery_status = 3 and o.status != -3
|
|
|
and not exists (
|
|
|
select 1 from fs_store_order_finance_audit fa
|
|
|
- where fa.order_id = o.order_id and fa.audit_type = 2 and fa.order_type=0
|
|
|
+ where fa.order_id = o.order_id and fa.audit_type = 2 and fa.order_type = 0
|
|
|
)
|
|
|
</select>
|
|
|
-</mapper>
|
|
|
+
|
|
|
+</mapper>
|