设备采集状态sql更改
This commit is contained in:
parent
68babc5786
commit
21ca5bc98f
@ -35,8 +35,15 @@ public interface DataAcquisitionMapper extends BaseMapperX<DataAcquisitionDO> {
|
|||||||
.orderByDesc(DataAcquisitionDO::getId));
|
.orderByDesc(DataAcquisitionDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Select("SELECT * FROM equipment_data_acquisition WHERE (code, create_time) IN " +
|
@Select("SELECT t1.* FROM equipment_data_acquisition t1 " +
|
||||||
"(SELECT code, MAX(create_time) FROM equipment_data_acquisition WHERE status = 1 GROUP BY code) AND status = 1 ORDER BY running_status ASC;")
|
"INNER JOIN (" +
|
||||||
|
" SELECT code, MAX(id) AS max_id " +
|
||||||
|
" FROM equipment_data_acquisition " +
|
||||||
|
" WHERE status = 1 " +
|
||||||
|
" GROUP BY code" +
|
||||||
|
") t2 ON t1.id = t2.max_id " +
|
||||||
|
"WHERE t1.status = 1 " +
|
||||||
|
"ORDER BY t1.running_status ASC")
|
||||||
List<DataAcquisitionDO> selectLatestByCode();
|
List<DataAcquisitionDO> selectLatestByCode();
|
||||||
|
|
||||||
@Select("SELECT t1.id FROM equipment_data_acquisition t1 " +
|
@Select("SELECT t1.id FROM equipment_data_acquisition t1 " +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user