mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 21:09:19 +08:00
perf(订单): 列表分页走时间索引与延迟关联,批量组装 VO,前端默认 30 天下单时间范围
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?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">
|
||||
<mapper namespace="top.xyquan.ecomdmbbackend.modules.ecom.order.mapper.OrderMapper">
|
||||
|
||||
<sql id="orderListFrom">
|
||||
ec_order
|
||||
<choose>
|
||||
<when test="useShopTimeIndex">
|
||||
FORCE INDEX (idx_company_shop_time)
|
||||
</when>
|
||||
<otherwise>
|
||||
FORCE INDEX (idx_company_order_time)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
<sql id="orderListWhere">
|
||||
WHERE company_id = #{companyId}
|
||||
<if test="shopId != null">
|
||||
AND shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="platformOrderNo != null and platformOrderNo != ''">
|
||||
<choose>
|
||||
<when test="platformOrderNoPrefix">
|
||||
AND platform_order_no LIKE CONCAT(#{platformOrderNo}, '%')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND platform_order_no LIKE CONCAT('%', #{platformOrderNo}, '%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="statusId != null">
|
||||
AND status_id = #{statusId}
|
||||
</if>
|
||||
<if test="minReceivedAmount != null">
|
||||
AND received_amount >= #{minReceivedAmount}
|
||||
</if>
|
||||
<if test="maxReceivedAmount != null">
|
||||
AND received_amount <= #{maxReceivedAmount}
|
||||
</if>
|
||||
<if test="startOrderTime != null">
|
||||
AND order_time >= #{startOrderTime}
|
||||
</if>
|
||||
<if test="endOrderTime != null">
|
||||
AND order_time <= #{endOrderTime}
|
||||
</if>
|
||||
<if test="importTaskId != null">
|
||||
AND import_task_id = #{importTaskId}
|
||||
</if>
|
||||
<if test="confirm != null">
|
||||
AND confirm = #{confirm}
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
AND product_spec_id IN (
|
||||
SELECT id FROM ec_product_spec WHERE product_id = #{productId}
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="countOrderList" resultType="long">
|
||||
SELECT COUNT(*)
|
||||
FROM <include refid="orderListFrom"/>
|
||||
<include refid="orderListWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="selectOrderListIds" resultType="long">
|
||||
SELECT id
|
||||
FROM <include refid="orderListFrom"/>
|
||||
<include refid="orderListWhere"/>
|
||||
ORDER BY ${orderByClause}
|
||||
LIMIT #{limit} OFFSET #{offset}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user