|
@@ -1786,35 +1786,27 @@
|
|
|
<!-- WHERE-->
|
|
|
<!-- rn = 1;-->
|
|
|
SELECT
|
|
|
- order_base_id,
|
|
|
- content
|
|
|
+ t1.order_base_id,
|
|
|
+ t1.content
|
|
|
FROM
|
|
|
- pg_order_operator_log
|
|
|
- <where>
|
|
|
- <if test="ids != null and ids.size > 0">
|
|
|
- order_base_id IN
|
|
|
- <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- AND (order_base_id, create_time) IN (
|
|
|
- SELECT
|
|
|
- order_base_id,
|
|
|
- MAX(create_time)
|
|
|
- FROM
|
|
|
- pg_order_operator_log
|
|
|
- <where>
|
|
|
- <if test="ids != null and ids.size > 0">
|
|
|
+ pg_order_operator_log${year} t1
|
|
|
+ INNER JOIN (
|
|
|
+ SELECT order_base_id, MAX(create_time) AS latest_create_time
|
|
|
+ FROM pg_order_operator_log${year}
|
|
|
+ <where>
|
|
|
+ <if test="ids != null and ids.size > 0">
|
|
|
order_base_id IN
|
|
|
- <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- order_base_id
|
|
|
- </where>
|
|
|
- );
|
|
|
- </where>
|
|
|
+ <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ AND company_wechat_id = 1
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ order_base_id
|
|
|
+ ) t2
|
|
|
+ ON t1.order_base_id = t2.order_base_id
|
|
|
+ AND t1.create_time = t2.latest_create_time
|
|
|
</select>
|
|
|
|
|
|
|