1、摄像头根据区域聚合查询的sql修改

This commit is contained in:
yitonglei 2022-07-14 12:43:59 +08:00
parent e3f451b375
commit 3b0e930aa9
4 changed files with 4 additions and 35 deletions

View File

@ -17,7 +17,7 @@ public interface CameraOrgenizationMapper extends BaseDao<CameraOrganization> {
@Select("select * from t_camera_organization where parent_id = #{parentId}") @Select("select * from t_camera_organization where parent_id = #{parentId}")
List<CameraOrganization> selectSubOrganization(@Param("parentId") String parentId); List<CameraOrganization> selectSubOrganization(@Param("parentId") String parentId);
@Select("select *,0 AS channelCount from t_camera_organization02 where parent_id = #{parentId}") @Select("select * channelCount from t_camera_organization02 where parent_id = #{parentId}")
List<Map> selectSubOrganizationMap(@Param("parentId") String parentId); List<Map> selectSubOrganizationMap(@Param("parentId") String parentId);
void batchSaveOrgenization(List<Map> list); void batchSaveOrgenization(List<Map> list);

View File

@ -1097,16 +1097,8 @@ public class MonitorService {
if (parentId == null){ if (parentId == null){
parentId = ""; parentId = "";
} }
List<Map> organs = cameraOrgenMapper.selectSubOrganizationMap(parentId);//查询某个区域下的所有地区 List<Map> organs = cameraOrgenMapper.selectSubOrganizationMap(parentId);
if(organs.size() > 0){
for(int i=0;i< organs.size();i++){
String path = organs.get(i).get("path").toString();
Integer count = cameraChannelMapper.selectChannelCounts(path);
organs.get(i).put("channelCount",count);
};
}
return organs; return organs;
} }

View File

@ -1,23 +0,0 @@
DROP PROCEDURE IF EXISTS del_idx;
create procedure del_idx(IN p_tablename varchar(200), IN p_idxname VARCHAR(200))
begin
DECLARE str VARCHAR(250);
set @str=concat(' drop index ',p_idxname,' on ',p_tablename);
select count(*) into @cnt from information_schema.statistics where table_name=p_tablename and index_name=p_idxname ;
if @cnt >0 then
PREPARE stmt FROM @str;
EXECUTE stmt ;
end if;
end ;
call del_idx('sys_user_token','user_id');

View File

@ -4,11 +4,11 @@
<insert id="batchSaveOrgenization" parameterType="java.util.List"> <insert id="batchSaveOrgenization" parameterType="java.util.List">
INSERT INTO t_camera_organization02 ( INSERT INTO t_camera_organization02 (
id,name,parent_id,sort,subCount,is_parent,path id,name,parent_id,sort,subCount,path
) VALUES ) VALUES
<foreach collection="list" item="item" separator="," > <foreach collection="list" item="item" separator="," >
( (
#{item.id},#{item.name},#{item.parentId},#{item.sort},#{item.subCount},case when #{item.isParent} = true then 1 else 0 end,#{item.name} #{item.id},#{item.name},#{item.parentId},#{item.sort},#{item.subCount},#{item.name}
) )
</foreach> </foreach>
</insert> </insert>