From be460c5828a744197018c51a412ac12a172db659 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 18 十二月 2024 16:46:56 +0800 Subject: [PATCH] # --- zy-acs-manager/src/main/resources/application.yml | 1 + zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml | 24 ++++++++---------------- zy-acs-fake/src/main/resources/mapper/ActionMapper.xml | 24 ++++++++---------------- version/db/sqlIndex | 3 +++ 4 files changed, 20 insertions(+), 32 deletions(-) diff --git a/version/db/sqlIndex b/version/db/sqlIndex new file mode 100644 index 0000000..47b9482 --- /dev/null +++ b/version/db/sqlIndex @@ -0,0 +1,3 @@ +CREATE INDEX idx_agv_action ON man_action(agv_id, action_sts); +CREATE INDEX idx_group_io_time ON man_action(group_id, io_time); +CREATE INDEX idx_priority ON man_action(priority); \ No newline at end of file diff --git a/zy-acs-fake/src/main/resources/mapper/ActionMapper.xml b/zy-acs-fake/src/main/resources/mapper/ActionMapper.xml index 337cb63..0f6a768 100644 --- a/zy-acs-fake/src/main/resources/mapper/ActionMapper.xml +++ b/zy-acs-fake/src/main/resources/mapper/ActionMapper.xml @@ -98,24 +98,16 @@ <select id="selectLatestOfGroup" resultType="com.zy.acs.fake.entity.Action"> SELECT * - FROM man_action - WHERE 1=1 - AND agv_id = #{agvId} - AND action_sts = #{actionSts} - AND group_id IN ( - SELECT group_id + FROM man_action a + JOIN ( + SELECT group_id, MAX(io_time) AS max_io_time FROM man_action - WHERE agv_id = #{agvId} - AND action_sts = #{actionSts} + WHERE agv_id = #{agvId} AND action_sts = #{actionSts} GROUP BY group_id - HAVING MAX(io_time) = ( - SELECT MAX(io_time) - FROM man_action - WHERE agv_id = #{agvId} - AND action_sts = #{actionSts} - ) - ) - ORDER BY priority DESC + ) b ON a.group_id = b.group_id AND a.io_time = b.max_io_time + WHERE a.agv_id = #{agvId} + AND a.action_sts = #{actionSts} + ORDER BY a.priority DESC </select> </mapper> diff --git a/zy-acs-manager/src/main/resources/application.yml b/zy-acs-manager/src/main/resources/application.yml index b360fb9..e253677 100644 --- a/zy-acs-manager/src/main/resources/application.yml +++ b/zy-acs-manager/src/main/resources/application.yml @@ -35,6 +35,7 @@ reset-enable: true login-username: admin login-password: admin + enabled: true servlet: multipart: maxFileSize: 100MB diff --git a/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml b/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml index 488e2fb..5e5ac69 100644 --- a/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml +++ b/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml @@ -98,24 +98,16 @@ <select id="selectLatestOfGroup" resultType="com.zy.acs.manager.manager.entity.Action"> SELECT * - FROM man_action - WHERE 1=1 - AND agv_id = #{agvId} - AND action_sts = #{actionSts} - AND group_id IN ( - SELECT group_id + FROM man_action a + JOIN ( + SELECT group_id, MAX(io_time) AS max_io_time FROM man_action - WHERE agv_id = #{agvId} - AND action_sts = #{actionSts} + WHERE agv_id = #{agvId} AND action_sts = #{actionSts} GROUP BY group_id - HAVING MAX(io_time) = ( - SELECT MAX(io_time) - FROM man_action - WHERE agv_id = #{agvId} - AND action_sts = #{actionSts} - ) - ) - ORDER BY priority DESC + ) b ON a.group_id = b.group_id AND a.io_time = b.max_io_time + WHERE a.agv_id = #{agvId} + AND a.action_sts = #{actionSts} + ORDER BY a.priority DESC </select> </mapper> -- Gitblit v1.9.1