This commit is contained in:
van
2026-06-03 12:06:43 +08:00
parent 6412168cc6
commit 67e6723685
12 changed files with 278 additions and 29 deletions
@@ -7,6 +7,7 @@
<result property="remark" column="remark"/>
<result property="distributionMark" column="distribution_mark"/>
<result property="modelNumber" column="model_number"/>
<result property="modelShop" column="model_shop"/>
<result property="link" column="link"/>
<result property="paymentAmount" column="payment_amount"/>
<result property="rebateAmount" column="rebate_amount"/>
@@ -46,7 +47,7 @@
</resultMap>
<sql id="selectJDOrderBase">
select id, remark, distribution_mark, model_number, link, payment_amount, rebate_amount,
select id, remark, distribution_mark, model_number, model_shop, link, payment_amount, rebate_amount,
address, logistics_link, order_id, buyer, order_time, create_time, update_time, status, is_count_enabled, third_party_order_no, jingfen_actual_price,
is_refunded, refund_date, is_refund_received, refund_received_date, is_rebate_received, rebate_received_date,
is_price_protected, price_protected_date, is_invoice_opened, invoice_opened_date, is_review_posted, review_posted_date,
@@ -67,7 +68,13 @@
)
</if>
<if test="distributionMark != null and distributionMark != ''"> and distribution_mark = #{distributionMark}</if>
<if test="modelNumber != null and modelNumber != ''"> and model_number like concat('%', #{modelNumber}, '%')</if>
<if test="modelNumber != null and modelNumber != ''">
and (
model_number like concat('%', #{modelNumber}, '%')
or concat(IFNULL(model_number, ''), IFNULL(model_shop, '')) like concat('%', #{modelNumber}, '%')
)
</if>
<if test="modelShop != null and modelShop != ''"> and model_shop = #{modelShop}</if>
<if test="params.modelNumberExcludeList != null and params.modelNumberExcludeList.size() > 0">
<foreach collection="params.modelNumberExcludeList" item="ex">
and (model_number is null or model_number not like concat('%', #{ex}, '%'))
@@ -120,7 +127,13 @@
)
</if>
<if test="distributionMark != null and distributionMark != ''"> and distribution_mark = #{distributionMark}</if>
<if test="modelNumber != null and modelNumber != ''"> and model_number like concat('%', #{modelNumber}, '%')</if>
<if test="modelNumber != null and modelNumber != ''">
and (
model_number like concat('%', #{modelNumber}, '%')
or concat(IFNULL(model_number, ''), IFNULL(model_shop, '')) like concat('%', #{modelNumber}, '%')
)
</if>
<if test="modelShop != null and modelShop != ''"> and model_shop = #{modelShop}</if>
<if test="params.modelNumberExcludeList != null and params.modelNumberExcludeList.size() > 0">
<foreach collection="params.modelNumberExcludeList" item="ex">
and (model_number is null or model_number not like concat('%', #{ex}, '%'))
@@ -177,7 +190,7 @@
<insert id="insertJDOrder" parameterType="JDOrder" useGeneratedKeys="true" keyProperty="id">
insert into jd_order (
remark, distribution_mark, model_number, link,
remark, distribution_mark, model_number, model_shop, link,
payment_amount, rebate_amount, address, logistics_link,
tencent_doc_pushed, tencent_doc_push_time,
order_id, buyer, order_time, create_time, update_time, status, is_count_enabled, third_party_order_no, jingfen_actual_price,
@@ -185,7 +198,7 @@
is_price_protected, price_protected_date, is_invoice_opened, invoice_opened_date, is_review_posted, review_posted_date,
selling_price_type, selling_price, profit, selling_price_manual, profit_manual, extra_cost
) values (
#{remark}, #{distributionMark}, #{modelNumber}, #{link},
#{remark}, #{distributionMark}, #{modelNumber}, #{modelShop}, #{link},
#{paymentAmount}, #{rebateAmount}, #{address}, #{logisticsLink},
0, null,
#{orderId}, #{buyer}, #{orderTime}, now(), now(), #{status}, #{isCountEnabled}, #{thirdPartyOrderNo}, #{jingfenActualPrice},
@@ -201,6 +214,7 @@
<if test="remark != null"> remark = #{remark},</if>
<if test="distributionMark != null"> distribution_mark = #{distributionMark},</if>
<if test="modelNumber != null"> model_number = #{modelNumber},</if>
<if test="modelShop != null"> model_shop = #{modelShop},</if>
<if test="link != null"> link = #{link},</if>
<if test="paymentAmount != null"> payment_amount = #{paymentAmount},</if>
<if test="rebateAmount != null"> rebate_amount = #{rebateAmount},</if>
@@ -305,24 +319,45 @@
<resultMap id="QuickRecordModelOptionResult" type="com.ruoyi.jarvis.domain.dto.QuickRecordModelOption">
<result property="modelNumber" column="model_number"/>
<result property="modelShop" column="model_shop"/>
<result property="lastPaymentAmount" column="last_payment_amount"/>
<result property="lastRebateAmount" column="last_rebate_amount"/>
</resultMap>
<select id="selectQuickRecordModelOptions" resultMap="QuickRecordModelOptionResult">
select o.model_number as model_number,
o.model_shop as model_shop,
o.payment_amount as last_payment_amount,
o.rebate_amount as last_rebate_amount
from jd_order o
inner join (
select trim(model_number) as m, max(id) as mid
select trim(IFNULL(model_number, '')) as m,
trim(IFNULL(model_shop, '')) as s,
max(id) as mid
from jd_order
where model_number is not null and trim(model_number) != ''
group by trim(model_number)
) t on trim(o.model_number) = t.m and o.id = t.mid
group by trim(IFNULL(model_number, '')), trim(IFNULL(model_shop, ''))
) t on trim(IFNULL(o.model_number, '')) = t.m
and trim(IFNULL(o.model_shop, '')) = t.s
and o.id = t.mid
order by o.id desc
</select>
<select id="selectOrdersPendingModelShopMigration" resultMap="JDOrderResult">
<include refid="selectJDOrderBase"/>
where model_number is not null
and trim(model_number) != ''
order by id asc
</select>
<update id="updateModelShopFields">
update jd_order
set model_number = #{modelNumber},
model_shop = #{modelShop},
update_time = now()
where id = #{id}
</update>
</mapper>