From 75c6448f57a2bca0e1cffb97fb4d74ee09744c85 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Mon, 12 Oct 2020 11:19:41 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=AD=A3=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=97=E8=A1=A8=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=202.=20=E9=87=8D=E5=91=BD=E5=90=8D=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=97=E8=A1=A8result=20map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/impl/DisposeTaskManagerImpl.java | 14 +++++++------- .../com/dispose/mapper/DisposeTaskMapper.java | 8 ++++++++ src/main/resources/mappers/DisposeTask.xml | 19 ++++++++++++++----- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/dispose/manager/impl/DisposeTaskManagerImpl.java b/src/main/java/com/dispose/manager/impl/DisposeTaskManagerImpl.java index 6dff034e..6b9c2824 100644 --- a/src/main/java/com/dispose/manager/impl/DisposeTaskManagerImpl.java +++ b/src/main/java/com/dispose/manager/impl/DisposeTaskManagerImpl.java @@ -124,22 +124,22 @@ public class DisposeTaskManagerImpl implements DisposeTaskManager { Integer startPage, Integer pageSize) { PageInfo pageInfo; - List taskList = new ArrayList<>(); + List preList; // 设置分页信息 PageHelper.startPage(startPage, pageSize); if(taskId.size() > 0) { - taskList.addAll(disposeTaskMapper.selectByIdSet(taskId)); - pageInfo = new PageInfo<>(taskList); + preList = disposeTaskMapper.selectPageById(taskId); } else { - List preList = disposeTaskMapper.selectPageAll(); - pageInfo = new PageInfo<>(preList); - + preList = disposeTaskMapper.selectPageAll(); preList.forEach(k -> taskId.add(k.getId())); - taskList.addAll(disposeTaskMapper.selectByIdSet(taskId)); } + pageInfo = new PageInfo<>(preList); + + List taskList = new ArrayList<>(disposeTaskMapper.selectByIdSet(taskId)); + return new MulReturnType<>(pageInfo, taskList); } } diff --git a/src/main/java/com/dispose/mapper/DisposeTaskMapper.java b/src/main/java/com/dispose/mapper/DisposeTaskMapper.java index 97c68227..ced8dc50 100644 --- a/src/main/java/com/dispose/mapper/DisposeTaskMapper.java +++ b/src/main/java/com/dispose/mapper/DisposeTaskMapper.java @@ -27,6 +27,14 @@ public interface DisposeTaskMapper { */ List selectPageAll(); + /** + * Select page by id list. + * + * @param idList the id list + * @return the list + */ + List selectPageById(@Param("idList") List idList); + /** * Select by id set list. * diff --git a/src/main/resources/mappers/DisposeTask.xml b/src/main/resources/mappers/DisposeTask.xml index 19813b2d..1caed23b 100644 --- a/src/main/resources/mappers/DisposeTask.xml +++ b/src/main/resources/mappers/DisposeTask.xml @@ -1,7 +1,7 @@ - + @@ -37,7 +37,16 @@ FROM dispose_task d - + SELECT * + FROM dispose_task d + WHERE id IN + + #{id} + + + + - SELECT dt.*, ti.id t_id, ti.taskId taskId, @@ -79,7 +88,7 @@ LEFT JOIN device_task ti on dt.id = ti.taskId - SELECT dt.*, ti.id t_id, ti.taskId taskId, @@ -99,7 +108,7 @@ WHERE dt.id = #{taskId} - SELECT dt.*, ti.* FROM dispose_task dt LEFT JOIN device_task ti on dt.id = ti.taskId WHERE