|
@@ -1764,26 +1764,51 @@
|
|
|
</select>
|
|
|
<select id="selectLastOrderOperatorLog"
|
|
|
resultType="com.gree.mall.manager.bean.listvo.workorder.OperatorLogBean">
|
|
|
+<!-- mysql8.0语法 -->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- order_base_id,-->
|
|
|
+<!-- content-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- (-->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- order_base_id, content, ROW_NUMBER() OVER ( PARTITION BY order_base_id ORDER BY create_time DESC ) AS rn-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- pg_order_operator_log${year}-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- <if test="ids != null and ids.size > 0">-->
|
|
|
+<!-- AND order_base_id IN-->
|
|
|
+<!-- <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">-->
|
|
|
+<!-- #{item}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- ) AS ranked-->
|
|
|
+<!-- WHERE-->
|
|
|
+<!-- rn = 1;-->
|
|
|
SELECT
|
|
|
order_base_id,
|
|
|
content
|
|
|
FROM
|
|
|
- (
|
|
|
+ pg_order_operator_log
|
|
|
+ WHERE
|
|
|
+ order_base_id IN
|
|
|
+ <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND (order_base_id, create_time) IN (
|
|
|
SELECT
|
|
|
- order_base_id, content, ROW_NUMBER() OVER ( PARTITION BY order_base_id ORDER BY create_time DESC ) AS rn
|
|
|
+ order_base_id,
|
|
|
+ MAX(create_time)
|
|
|
FROM
|
|
|
- pg_order_operator_log${year}
|
|
|
- <where>
|
|
|
- <if test="ids != null and ids.size > 0">
|
|
|
- AND order_base_id IN
|
|
|
- <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- ) AS ranked
|
|
|
- WHERE
|
|
|
- rn = 1;
|
|
|
+ pg_order_operator_log
|
|
|
+ WHERE
|
|
|
+ order_base_id IN
|
|
|
+ <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ GROUP BY
|
|
|
+ order_base_id
|
|
|
+ );
|
|
|
</select>
|
|
|
|
|
|
|