1、去掉所有t_camera_channel01和t_camera_organization02的后缀。并添加sql版本为t_camera_channel和t_camera_organization增加字段
This commit is contained in:
parent
b3e4b77447
commit
75a51451fb
|
@ -0,0 +1,6 @@
|
|||
ALTER TABLE t_camera_channel ADD COLUMN region_code VARCHAR(255) COMMENT '市区编码';
|
||||
ALTER TABLE t_camera_channel ADD COLUMN region_name VARCHAR(255) COMMENT '市区名称';
|
||||
|
||||
ALTER TABLE t_camera_organization ADD COLUMN count INT DEFAULT(0);
|
||||
ALTER TABLE t_camera_organization ADD COLUMN is_parent INT COMMENT '是否父节点';
|
||||
ALTER TABLE t_camera_organization ADD COLUMN path VARCHAR(500) COMMENT '从属关系';
|
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("t_camera_channel01")
|
||||
@TableName("t_camera_channel")
|
||||
public class CameraChannelNew {
|
||||
|
||||
@TableId
|
||||
|
|
|
@ -17,51 +17,51 @@ public interface CameraOrgenizationMapper extends BaseDao<CameraOrganization> {
|
|||
@Select("select * from t_camera_organization where parent_id = #{parentId}")
|
||||
List<CameraOrganization> selectSubOrganization(@Param("parentId") String parentId);
|
||||
|
||||
@Select("select * from t_camera_organization02 where parent_id = #{parentId}")
|
||||
@Select("select * from t_camera_organization where parent_id = #{parentId}")
|
||||
List<Map> selectSubOrganizationMap(@Param("parentId") String parentId);
|
||||
|
||||
@Select("select name,parent_id,id from t_camera_organization02 where path LIKE CONCAT(#{path},'%') ")
|
||||
@Select("select name,parent_id,id from t_camera_organization where path LIKE CONCAT(#{path},'%') ")
|
||||
List<Map> selectSubOrganizationMapByPath(@Param("path") String path);
|
||||
|
||||
void batchSaveOrgenization(List<Map> list);
|
||||
|
||||
@Select("SELECT name,parent_id,id,path FROM t_camera_organization02 WHERE id = #{id}")
|
||||
@Select("SELECT name,parent_id,id,path FROM t_camera_organization WHERE id = #{id}")
|
||||
Map selectOrgenizationById(@Param("id") String id);
|
||||
|
||||
@Update("UPDATE t_camera_organization02 SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}")
|
||||
@Update("UPDATE t_camera_organization SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}")
|
||||
void updateOrganizationPaht(@Param("path") String path,@Param("id") String id);
|
||||
|
||||
@Select(" SELECT id FROM t_camera_organization02")
|
||||
@Select(" SELECT id FROM t_camera_organization")
|
||||
List<Map> listOrgenization();
|
||||
|
||||
@Select(" SELECT name FROM t_camera_organization02 where substring(id,5) = #{idPart} and left(id,3) = '006'")
|
||||
@Select(" SELECT name FROM t_camera_organization where substring(id,5) = #{idPart} and left(id,3) = '006'")
|
||||
String getNameByidPart(@Param("idPart")String idPart);
|
||||
|
||||
@Update("UPDATE t_camera_organization02 SET COUNT = COUNT + 1 WHERE id = #{id}")
|
||||
@Update("UPDATE t_camera_organization SET COUNT = COUNT + 1 WHERE id = #{id}")
|
||||
void updateOrganizationCount(@Param("id") String id);
|
||||
|
||||
void batchSaveCameraChannel(List<Map> list);
|
||||
|
||||
@Select("select * from t_camera_organization02")
|
||||
@Select("select * from t_camera_organization")
|
||||
List<Map> testAll();
|
||||
|
||||
@Update("truncate table ${tableName}")
|
||||
void truncate(@Param("tableName") String tableName) ;
|
||||
|
||||
@Select("select orgaid,id,name,path from t_camera_organization02 order by orgaid")
|
||||
@Select("select orgaid,id,name,path from t_camera_organization order by orgaid")
|
||||
List<Map> selectAllSubOrganizationMap();
|
||||
|
||||
@Update("UPDATE t_camera_organization02 SET channelCount = #{channelCount} where orgaid = #{orgaId}")
|
||||
@Update("UPDATE t_camera_organization SET channelCount = #{channelCount} where orgaid = #{orgaId}")
|
||||
void editChannelCount(@Param("channelCount") Integer channelCount,@Param("orgaId") Integer orgaId);
|
||||
|
||||
@Update(" UPDATE t_region a inner join \n" +
|
||||
" (SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel01 GROUP BY region_code) b\n" +
|
||||
" (SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel GROUP BY region_code) b\n" +
|
||||
" ON a.region_code = b.region_code set a.channel_count = b.channel_count")
|
||||
void updateRegionChannelCount();
|
||||
|
||||
@Select(" SELECT id FROM t_camera_organization02 WHERE orgaid >(SELECT a.orgaid FROM t_camera_organization02 a INNER JOIN \n" +
|
||||
@Select(" SELECT id FROM t_camera_organization WHERE orgaid >(SELECT a.orgaid FROM t_camera_organization a INNER JOIN \n" +
|
||||
"\t(\n" +
|
||||
"\t\tSELECT parent_id FROM t_camera_channel01 ORDER BY idt_camera_channel desc LIMIT 1\n" +
|
||||
"\t\tSELECT parent_id FROM t_camera_channel ORDER BY idt_camera_channel desc LIMIT 1\n" +
|
||||
"\t) b ON a.id = b.parent_id \n" +
|
||||
") ORDER BY orgaid ASC ")
|
||||
List<Map> listOrgenization2();
|
||||
|
|
|
@ -1248,8 +1248,8 @@ public class MonitorService {
|
|||
//2、获取视频通道信息并保存,多线程版
|
||||
@Async
|
||||
public void saveChannelInfoAsync() throws Exception {
|
||||
//1-清空t_camera_channel01
|
||||
cameraOrgenMapper.truncate("t_camera_channel01");
|
||||
//1-清空t_camera_channel
|
||||
cameraOrgenMapper.truncate("t_camera_channel");
|
||||
|
||||
//2-创建线程池
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(20);//20个线程足够
|
||||
|
@ -1294,6 +1294,9 @@ public class MonitorService {
|
|||
|
||||
//6-更新完通道信息后,查询地区下通道的数量并更新到地区表和市区表中
|
||||
editChannelCount();
|
||||
|
||||
//7-同步武伟达的t_channel_mtm_label数据
|
||||
|
||||
}
|
||||
|
||||
//单独保存视频通道信息
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectChannelCounts" parameterType="java.lang.String" resultType="integer">
|
||||
SELECT COUNT(a.idt_camera_channel) FROM t_camera_channel01 a inner join t_camera_organization02 b on a.parent_id = b.id
|
||||
SELECT COUNT(a.idt_camera_channel) FROM t_camera_channel a inner join t_camera_organization b on a.parent_id = b.id
|
||||
WHERE b.path like concat(#{path},'%')
|
||||
</select>
|
||||
|
||||
|
@ -135,7 +135,7 @@
|
|||
* sin(radians( tcc.gps_y ))) AS `distance`
|
||||
</if>
|
||||
FROM
|
||||
t_camera_channel01 tcc
|
||||
t_camera_channel tcc
|
||||
<if test = "labelCodes != null and labelCodes.size > 0">
|
||||
JOIN t_channel_mtm_label tcml ON tcml.channel_code = tcc.channel_code
|
||||
JOIN t_label tl ON tl.label_code = tcml.label_code
|
||||
|
@ -183,7 +183,7 @@
|
|||
* sin(radians( tcc.gps_y ))) AS `distance`
|
||||
</if>
|
||||
FROM
|
||||
t_camera_channel01 tcc
|
||||
t_camera_channel tcc
|
||||
<if test = "labelCodes != null and labelCodes.size > 0">
|
||||
JOIN t_channel_mtm_label tcml ON tcml.channel_code = tcc.channel_code
|
||||
JOIN t_label tl ON tl.label_code = tcml.label_code
|
||||
|
@ -215,6 +215,6 @@
|
|||
|
||||
|
||||
<select id="selectChannelNumByRegion" resultType="java.util.Map">
|
||||
SELECT ROUND(COUNT(idt_camera_channel) /10000,1) AS channelCount,region_code,region_name FROM t_camera_channel01 WHERE region_name is not null GROUP BY region_code,region_name
|
||||
SELECT ROUND(COUNT(idt_camera_channel) /10000,1) AS channelCount,region_code,region_name FROM t_camera_channel WHERE region_name is not null GROUP BY region_code,region_name
|
||||
</select>
|
||||
</mapper>
|
|
@ -3,7 +3,7 @@
|
|||
<mapper namespace="io.renren.modules.monitor.mapper.CameraOrgenizationMapper">
|
||||
<insert id="batchSaveOrgenization" parameterType="java.util.List">
|
||||
|
||||
INSERT INTO t_camera_organization02 (
|
||||
INSERT INTO t_camera_organization (
|
||||
id,name,parent_id,sort,subCount,path,is_parent,is_root
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator="," >
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
|
||||
<insert id="batchSaveCameraChannel" parameterType="java.util.List">
|
||||
INSERT INTO t_camera_channel01
|
||||
INSERT INTO t_camera_channel
|
||||
(
|
||||
channel_code,channel_id,channel_name,gps_x,gps_y,status,
|
||||
parent_id,region_code,region_name,node_name
|
||||
|
|
Loading…
Reference in New Issue