优化通道数据显示

This commit is contained in:
648540858
2024-07-10 17:33:04 +08:00
parent 6ecf8af6ca
commit a084fac7cd
6 changed files with 199 additions and 144 deletions

View File

@@ -35,7 +35,7 @@ public interface DeviceChannelMapper {
", device_id=#{deviceId}" +
", device_db_id=#{deviceDbId}" +
", name=#{name}" +
", manufacturer#{manufacturer}" +
", manufacturer=#{manufacturer}" +
", model=#{model}" +
", owner=#{owner}" +
", civil_code=#{civilCode}" +
@@ -72,7 +72,7 @@ public interface DeviceChannelMapper {
", has_audio=#{hasAudio}" +
", gps_time=#{gpsTime}" +
", stream_identification=#{streamIdentification}" +
"WHERE id=#{id}" +
" WHERE id=#{id}" +
" </script>"})
int update(DeviceChannel channel);
@@ -112,12 +112,13 @@ public interface DeviceChannelMapper {
", gb_download_speed = #{gbDownloadSpeed}" +
", gb_svc_space_support_mod = #{gbSvcSpaceSupportMod}" +
", gb_svc_time_support_mode = #{gbSvcTimeSupportMode}" +
"WHERE id = #{id}" +
" WHERE id = #{id}" +
" </script>"})
int updateCustomInfo(DeviceChannel channel);
@Select(value = {" <script>" +
"SELECT " +
" dc.id,\n" +
" dc.device_db_id,\n" +
" dc.create_time,\n" +
" dc.update_time,\n" +
@@ -225,20 +226,20 @@ public interface DeviceChannelMapper {
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode,svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel\n" +
"where device_db_id = #{deviceDbId}")
" from wvp_device_channel\n" +
" where device_db_id = #{deviceDbId}")
List<DeviceChannel> queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId);
@Select(value = {" <script>" +
"SELECT " +
"dc.*, " +
"de.name as device_name, " +
"de.on_line as device_online " +
"from " +
"wvp_device_channel dc " +
"LEFT JOIN wvp_device de ON dc.device_db_id = de.id " +
"WHERE 1=1" +
" SELECT " +
" dc.*, " +
" de.name as device_name, " +
" de.on_line as device_online " +
" from " +
" wvp_device_channel dc " +
" LEFT JOIN wvp_device de ON dc.device_db_id = de.id " +
" WHERE 1=1" +
" <if test='deviceId != null'> AND de.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
@@ -254,6 +255,7 @@ public interface DeviceChannelMapper {
List<DeviceChannelExtend> queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
@Select("SELECT " +
" dc.id,\n" +
" dc.device_db_id,\n" +
" dc.create_time,\n" +
" dc.update_time,\n" +
@@ -473,12 +475,12 @@ public interface DeviceChannelMapper {
int updateChannelSubCount(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId);
@Update(value = {" <script>" +
"UPDATE wvp_device_channel " +
"SET " +
"latitude=#{latitude}, " +
"longitude=#{longitude}, " +
"gps_time=#{gpsTime} " +
"WHERE id=#{id} " +
" UPDATE wvp_device_channel " +
" SET " +
" latitude=#{latitude}, " +
" longitude=#{longitude}, " +
" gps_time=#{gpsTime} " +
" WHERE id=#{id} " +
" </script>"})
int updatePosition(DeviceChannel deviceChannel);
@@ -562,7 +564,7 @@ public interface DeviceChannelMapper {
int getAllChannelCount();
@Select(value = {" <script>" +
"SELECT " +
" SELECT " +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
@@ -606,8 +608,8 @@ public interface DeviceChannelMapper {
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel " +
"where device_db_id=#{deviceDbId}" +
" from wvp_device_channel " +
" where device_db_id=#{deviceDbId}" +
" <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" +
" <if test='parentId == null or parentId == deviceId'> and parent_id is null or parent_id = #{deviceId}</if>" +
" <if test='onlyCatalog == true '> and parental = 1 </if>" +
@@ -635,7 +637,7 @@ public interface DeviceChannelMapper {
void batchUpdatePosition(List<DeviceChannel> channelList);
@Select(value = {" <script>" +
"SELECT " +
" SELECT " +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
@@ -679,13 +681,13 @@ public interface DeviceChannelMapper {
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel " +
"where id=#{id}" +
" from wvp_device_channel " +
" where id=#{id}" +
" </script>"})
DeviceChannel getOne(@Param("id") int id);
@Select(value = {" <script>" +
"SELECT " +
" SELECT " +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
@@ -729,8 +731,8 @@ public interface DeviceChannelMapper {
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel " +
"where device_db_id=#{deviceDbId} and coalesce(gb_device_id, device_id) = #{channelId}" +
" from wvp_device_channel " +
" where device_db_id=#{deviceDbId} and coalesce(gb_device_id, device_id) = #{channelId}" +
" </script>"})
DeviceChannel getOneByDeviceId(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId);
}

View File

@@ -338,7 +338,7 @@ public interface DeviceMapper {
" FROM wvp_device de" +
" where 1 = 1 "+
" <if test='status != null'> AND de.on_line=${status}</if>"+
" <if test='query != null'> AND coalesce(custom_name, name) as name LIKE '%${query}%'</if> " +
" <if test='query != null'> AND coalesce(custom_name, name) LIKE '%${query}%'</if> " +
" order by create_time desc "+
" </script>")
List<Device> getDeviceList(@Param("query") String query, @Param("status") Boolean status);

View File

@@ -108,9 +108,10 @@ public class DeviceQuery {
@GetMapping("/devices")
@Options()
public PageInfo<Device> devices(int page, int count, String query, Boolean status){
// if (page == null) page = 0;
// if (count == null) count = 20;
return deviceService.getAll(page, count,query, status);
if (ObjectUtils.isEmpty(query)){
query = null;
}
return deviceService.getAll(page, count, query, status);
}
/**