REM:
1. 修正任务列表分页查询功能
2. 重命名任务列表result map
This commit is contained in:
HuangXin 2020-10-12 11:19:41 +08:00
parent 37393c35ca
commit 75c6448f57
3 changed files with 29 additions and 12 deletions

View File

@ -124,22 +124,22 @@ public class DisposeTaskManagerImpl implements DisposeTaskManager {
Integer startPage, Integer startPage,
Integer pageSize) { Integer pageSize) {
PageInfo<DisposeTask> pageInfo; PageInfo<DisposeTask> pageInfo;
List<DisposeTask> taskList = new ArrayList<>(); List<DisposeTask> preList;
// 设置分页信息 // 设置分页信息
PageHelper.startPage(startPage, pageSize); PageHelper.startPage(startPage, pageSize);
if(taskId.size() > 0) { if(taskId.size() > 0) {
taskList.addAll(disposeTaskMapper.selectByIdSet(taskId)); preList = disposeTaskMapper.selectPageById(taskId);
pageInfo = new PageInfo<>(taskList);
} else { } else {
List<DisposeTask> preList = disposeTaskMapper.selectPageAll(); preList = disposeTaskMapper.selectPageAll();
pageInfo = new PageInfo<>(preList);
preList.forEach(k -> taskId.add(k.getId())); preList.forEach(k -> taskId.add(k.getId()));
taskList.addAll(disposeTaskMapper.selectByIdSet(taskId));
} }
pageInfo = new PageInfo<>(preList);
List<DisposeTask> taskList = new ArrayList<>(disposeTaskMapper.selectByIdSet(taskId));
return new MulReturnType<>(pageInfo, taskList); return new MulReturnType<>(pageInfo, taskList);
} }
} }

View File

@ -27,6 +27,14 @@ public interface DisposeTaskMapper {
*/ */
List<DisposeTask> selectPageAll(); List<DisposeTask> selectPageAll();
/**
* Select page by id list.
*
* @param idList the id list
* @return the list
*/
List<DisposeTask> selectPageById(@Param("idList") List<Long> idList);
/** /**
* Select by id set list. * Select by id set list.
* *

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dispose.mapper.DisposeTaskMapper"> <mapper namespace="com.dispose.mapper.DisposeTaskMapper">
<resultMap id="dispose_task" type="com.dispose.pojo.entity.DisposeTask"> <resultMap id="dispose_task_map" type="com.dispose.pojo.entity.DisposeTask">
<id column="id" property="id"/> <id column="id" property="id"/>
<id column="deviceId" property="deviceId"/> <id column="deviceId" property="deviceId"/>
<id column="accountId" property="accountId"/> <id column="accountId" property="accountId"/>
@ -37,7 +37,16 @@
FROM dispose_task d FROM dispose_task d
</select> </select>
<select id="selectByIdSet" resultMap="dispose_task"> <select id="selectPageById" resultType="com.dispose.pojo.entity.DisposeTask">
SELECT *
FROM dispose_task d
WHERE id IN
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<select id="selectByIdSet" resultMap="dispose_task_map">
SELECT dt.*, SELECT dt.*,
ti.id t_id, ti.id t_id,
ti.taskId taskId, ti.taskId taskId,
@ -60,7 +69,7 @@
</foreach> </foreach>
</select> </select>
<select id="selectAll" resultMap="dispose_task"> <select id="selectAll" resultMap="dispose_task_map">
SELECT dt.*, SELECT dt.*,
ti.id t_id, ti.id t_id,
ti.taskId taskId, ti.taskId taskId,
@ -79,7 +88,7 @@
LEFT JOIN device_task ti on dt.id = ti.taskId LEFT JOIN device_task ti on dt.id = ti.taskId
</select> </select>
<select id="getDisposeTaskById" resultMap="dispose_task"> <select id="getDisposeTaskById" resultMap="dispose_task_map">
SELECT dt.*, SELECT dt.*,
ti.id t_id, ti.id t_id,
ti.taskId taskId, ti.taskId taskId,
@ -99,7 +108,7 @@
WHERE dt.id = #{taskId} WHERE dt.id = #{taskId}
</select> </select>
<select id="getRunningTask" resultMap="dispose_task"> <select id="getRunningTask" resultMap="dispose_task_map">
SELECT dt.*, ti.* SELECT dt.*, ti.*
FROM dispose_task dt LEFT JOIN device_task ti on dt.id = ti.taskId FROM dispose_task dt LEFT JOIN device_task ti on dt.id = ti.taskId
WHERE WHERE