Commit 2072f1b9 by 杨林龙

优化假性离线查询

1 parent 97483118
package cn.com.glsx.admin.modules.model.param; package cn.com.glsx.admin.modules.model.param;
import cn.hutool.db.Page;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.List;
/** /**
* 假性离线搜索参数实体类 * 假性离线搜索参数实体类
* *
...@@ -32,5 +29,5 @@ public class FakeOfficeSearch extends BasicSearch { ...@@ -32,5 +29,5 @@ public class FakeOfficeSearch extends BasicSearch {
/** /**
* 车辆集合 * 车辆集合
*/ */
private List<String> vinList; private String vinStrs;
} }
...@@ -74,9 +74,13 @@ public class FakeOfflineService extends AbstractCommonService { ...@@ -74,9 +74,13 @@ public class FakeOfflineService extends AbstractCommonService {
return new PageInfo(); return new PageInfo();
} }
StringBuilder builder = new StringBuilder();
// 分页查询 // 分页查询
Page<Object> page = PageHelper.startPage(search.getPageNumber(), search.getPageSize(), true); Page<Object> page = PageHelper.startPage(search.getPageNumber(), search.getPageSize(), true);
search.setVinList(vinList); for (String vin : vinList) {
builder.append("'").append(vin).append("'").append(",");
}
search.setVinStrs(builder.toString().substring(0, builder.toString().length() - 1));
List<FakeOfficeExport> fakeOfficeList = buildFakeOfficeResult(search, reasonMap); List<FakeOfficeExport> fakeOfficeList = buildFakeOfficeResult(search, reasonMap);
return new PageInfo(fakeOfficeList, (int) page.getTotal()); return new PageInfo(fakeOfficeList, (int) page.getTotal());
...@@ -153,7 +157,11 @@ public class FakeOfflineService extends AbstractCommonService { ...@@ -153,7 +157,11 @@ public class FakeOfflineService extends AbstractCommonService {
if (CollectionUtil.isEmpty(vinList)) { if (CollectionUtil.isEmpty(vinList)) {
return null; return null;
} }
search.setVinList(vinList); StringBuilder builder = new StringBuilder();
for (String vin : vinList) {
builder.append("'").append(vin).append("'").append(",");
}
search.setVinStrs(builder.toString().substring(0, builder.toString().length() - 1));
return buildFakeOfficeResult(search, reasonMap); return buildFakeOfficeResult(search, reasonMap);
} }
......
...@@ -67,16 +67,13 @@ ...@@ -67,16 +67,13 @@
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) > 259200 and and ((timestampdiff(SECOND, tdl.last_gps_time, now()) > 259200 and
timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 1) timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 1)
or (timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 0)) or (timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 0))
<if test="vinList != null and vinList.size > 0 "> <if test="vinStrs != null and vinStrs != '' ">
and tv.vin in and tv.vin in (${vinStrs})
<foreach collection="vinList" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if> </if>
<if test="checkedUserIdsStr != null and checkedUserIdsStr !=''"> <if test="checkedUserIdsStr != null and checkedUserIdsStr !=''">
and find_in_set(tv.created_by,#{checkedUserIdsStr}) and find_in_set(tv.created_by,#{checkedUserIdsStr})
</if> </if>
group by tv.vin) temp group by tv.id) temp
where 1 = 1 where 1 = 1
<if test="keywords != null and keywords !=''"> <if test="keywords != null and keywords !=''">
and( and(
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!