Commit b9c4236e by xmh

检索人员时先查出personUnid再查询具体列表不然有些情况下不会走索引

1 parent 330053d8
...@@ -66,7 +66,8 @@ public class ReidController { ...@@ -66,7 +66,8 @@ public class ReidController {
, @RequestParam(defaultValue = "1") Integer countGTE, @RequestParam(defaultValue = "1000000") Integer countLTE) { , @RequestParam(defaultValue = "1") Integer countGTE, @RequestParam(defaultValue = "1000000") Integer countLTE) {
SubTaskMapper mapper = (SubTaskMapper) subTaskService.getMapper(); SubTaskMapper mapper = (SubTaskMapper) subTaskService.getMapper();
List<SubTaskVo> people = mapper.getPeople(packId, status, page == null ? null : (page - 1) * size, size, annotatorId, countGTE, countLTE); List<String> personUnids = mapper.getPersonUnids(packId, status, page == null ? null : (page - 1) * size, size, annotatorId, countGTE, countLTE);
List<SubTaskVo> people = mapper.getPeople(packId, personUnids);
LinkedHashMap<String, List<SubTaskVo>> temp = new LinkedHashMap<>(); LinkedHashMap<String, List<SubTaskVo>> temp = new LinkedHashMap<>();
Map<String, User> labelingMap = reidService.getRedissonClient().<String, User>getMap("labeling:" + packId).readAllMap(); Map<String, User> labelingMap = reidService.getRedissonClient().<String, User>getMap("labeling:" + packId).readAllMap();
......
...@@ -61,17 +61,22 @@ public interface SubTaskMapper extends BaseMapper { ...@@ -61,17 +61,22 @@ public interface SubTaskMapper extends BaseMapper {
"select d_sub_task.id,d_sub_task.unid,d_sub_task.create_time as createTime,pack_id as packId," + "select d_sub_task.id,d_sub_task.unid,d_sub_task.create_time as createTime,pack_id as packId," +
"pic_id as picId,task_id as taskId,person_unid as personUnid,d_sub_task.status,s_user.name as labelUserName " + "pic_id as picId,task_id as taskId,person_unid as personUnid,d_sub_task.status,s_user.name as labelUserName " +
"from d_sub_task left join s_user on annotator_id=s_user.id where pack_id=#{packId} and person_unid in " + "from d_sub_task left join s_user on annotator_id=s_user.id where pack_id=#{packId} and person_unid in " +
"(select person_unid from d_sub_task where pack_id=#{packId}" + " <foreach item='item' collection='personUnids' open='(' separator=',' close=')'> #{item} </foreach>" +
" order by person_unid " +
"</script>")
List<SubTaskVo> getPeople(Long packId, List<String> personUnids);
@Select("<script>" +
"select person_unid from d_sub_task where pack_id=#{packId}" +
" <if test = 'status != null'> and status=#{status}</if> " + " <if test = 'status != null'> and status=#{status}</if> " +
" <if test = 'status == null'> and status != -1</if> " + " <if test = 'status == null'> and status != -1</if> " +
" <if test = 'annotatorId != null'> and annotator_id = #{annotatorId}</if> " + " <if test = 'annotatorId != null'> and annotator_id = #{annotatorId}</if> " +
"group by person_unid " + "group by person_unid " +
" having count(*) between #{countGTE} and #{countLTE} " + " having count(*) between #{countGTE} and #{countLTE} " +
" order by person_unid " + " order by person_unid " +
"<if test='offset != null'> offset #{offset} limit #{limit}</if>) " + "<if test='offset != null'> offset #{offset} limit #{limit}</if>" +
" order by person_unid " +
"</script>") "</script>")
List<SubTaskVo> getPeople(Long packId, Integer status, Long offset, Long limit, Long annotatorId, Integer countGTE, Integer countLTE); List<String> getPersonUnids(Long packId, Integer status, Long offset, Long limit, Long annotatorId, Integer countGTE, Integer countLTE);
@Select("<script>" + @Select("<script>" +
"select count(*) from " + "select count(*) from " +
......
...@@ -56,7 +56,7 @@ public class KeliuController { ...@@ -56,7 +56,7 @@ public class KeliuController {
@GetMapping("/sendData") @GetMapping("/sendData")
public Object sendData(@RequestParam Date date, @RequestParam Long mallId, @RequestParam Long packId, @RequestParam Long taskId) { public Object sendData(@RequestParam Date date, @RequestParam Long mallId, @RequestParam Long packId, @RequestParam(required = false) Long taskId) {
List<Future<JsonMessageUtil.JsonMessage>> responses = new LinkedList<>(); List<Future<JsonMessageUtil.JsonMessage>> responses = new LinkedList<>();
if (SEND_DATA) { if (SEND_DATA) {
return JsonMessageUtil.getErrorJsonMsg("有数据传输任务正在进行"); return JsonMessageUtil.getErrorJsonMsg("有数据传输任务正在进行");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!