Commit 934e1fcbaf31aa39dc54d74e8f0bea0841c803dd
1 parent
51aaebc0
调度历史消息,使用有索引的字段进行查询
Showing
2 changed files
with
10 additions
and
10 deletions
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -47,15 +47,15 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -47,15 +47,15 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 47 | List<Map<String, Object>> dailyInfo(String line,String date); | 47 | List<Map<String, Object>> dailyInfo(String line,String date); |
| 48 | 48 | ||
| 49 | @Query(value="select d.device_id,d.sender,d.txt_content,d.timestamp,d.line_code from " | 49 | @Query(value="select d.device_id,d.sender,d.txt_content,d.timestamp,d.line_code from " |
| 50 | - + " bsth_v_directive_60 d where d.line_code=?1 and d.timestamp >=?2 and " | ||
| 51 | - + "d.timestamp <=?3 and d.device_id like %?4% ",nativeQuery=true) | ||
| 52 | - List<Object[]> historyMessage(String line,long d,long t,String code); | 50 | + + " bsth_v_directive_60 d where d.rq = ?1 and d.line_code = ?2 " |
| 51 | + + " and d.device_id like %?4% ",nativeQuery=true) | ||
| 52 | + List<Object[]> historyMessage(String rq, String line, String code); | ||
| 53 | 53 | ||
| 54 | //带指令类型字段 | 54 | //带指令类型字段 |
| 55 | @Query(value="select d.device_id,d.sender,d.txt_content,d.timestamp,d.line_code from " | 55 | @Query(value="select d.device_id,d.sender,d.txt_content,d.timestamp,d.line_code from " |
| 56 | - + " bsth_v_directive_60 d where d.line_code=?1 and d.timestamp >=?2 and " | ||
| 57 | - + "d.timestamp <=?3 and d.device_id like %?4% and d.dispatch_instruct =?5 ",nativeQuery=true) | ||
| 58 | - List<Object[]> historyMessage(String line,long d,long t,String code,short dispatchInstruct); | 56 | + + " bsth_v_directive_60 d where d.rq = ?1 and d.line_code = ?2 " |
| 57 | + + " and d.device_id like %?4% and d.dispatch_instruct =?5 ",nativeQuery=true) | ||
| 58 | + List<Object[]> historyMessage(String rq, String line, String code, short dispatchInstruct); | ||
| 59 | 59 | ||
| 60 | @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs " | 60 | @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs " |
| 61 | + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d " | 61 | + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d " |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -1286,9 +1286,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1286,9 +1286,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1286 | 1286 | ||
| 1287 | List<Object[]> list0 = new ArrayList<Object[]>(); | 1287 | List<Object[]> list0 = new ArrayList<Object[]>(); |
| 1288 | if(instructType > -1){ | 1288 | if(instructType > -1){ |
| 1289 | - list0 = scheduleRealInfoRepository.historyMessage(line, d, t, device, instructType); | 1289 | + list0 = scheduleRealInfoRepository.historyMessage(date, line, device, instructType); |
| 1290 | } else { | 1290 | } else { |
| 1291 | - list0 = scheduleRealInfoRepository.historyMessage(line, d, t, device); | 1291 | + list0 = scheduleRealInfoRepository.historyMessage(date, line, device); |
| 1292 | } | 1292 | } |
| 1293 | for (Object[] obj : list0) { | 1293 | for (Object[] obj : list0) { |
| 1294 | if (obj != null) { | 1294 | if (obj != null) { |
| @@ -1325,9 +1325,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1325,9 +1325,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1325 | if(!device2.equals("")){ | 1325 | if(!device2.equals("")){ |
| 1326 | List<Object[]> list1 = new ArrayList<Object[]>(); | 1326 | List<Object[]> list1 = new ArrayList<Object[]>(); |
| 1327 | if(instructType > -1){ | 1327 | if(instructType > -1){ |
| 1328 | - list1 =scheduleRealInfoRepository.historyMessage(line, d, t, device2, instructType); | 1328 | + list1 =scheduleRealInfoRepository.historyMessage(date, line, device2, instructType); |
| 1329 | } else { | 1329 | } else { |
| 1330 | - list1 =scheduleRealInfoRepository.historyMessage(line, d, t, device2); | 1330 | + list1 =scheduleRealInfoRepository.historyMessage(date, line, device2); |
| 1331 | } | 1331 | } |
| 1332 | for (Object[] obj : list1) { | 1332 | for (Object[] obj : list1) { |
| 1333 | if (obj != null) { | 1333 | if (obj != null) { |