72 lines
3.0 KiB
XML
72 lines
3.0 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="io.renren.modules.monitor.mapper.CameraOrgenizationMapper">
|
|
<insert id="batchSaveOrgenizationCache" parameterType="java.util.List">
|
|
|
|
INSERT INTO t_camera_organization_cache (
|
|
id,name,parent_id,sort,subCount,path,is_parent,is_root
|
|
) VALUES
|
|
<foreach collection="list" item="item" separator="," >
|
|
(
|
|
#{item.id},#{item.name},#{item.parentId},#{item.sort},#{item.subCount},#{item.name},#{item.isParent},#{item.root}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
<!-- <insert id="batchSaveCameraChannel" parameterType="java.util.List">-->
|
|
<!-- INSERT INTO t_camera_channel_cache-->
|
|
<!-- (-->
|
|
<!-- channel_code,channel_id,channel_name,gps_x,gps_y,status,-->
|
|
<!-- parent_id,region_code,region_name,node_name-->
|
|
<!-- )-->
|
|
<!-- VALUES-->
|
|
<!-- <foreach collection="list" item="item" separator="," >-->
|
|
<!-- (-->
|
|
<!-- #{item.channelCode},#{item.channelId},#{item.channelName},#{item.gpsX},#{item.gpsY},#{item.status},-->
|
|
<!-- #{item.parentId},#{item.regionCode},#{item.regionName},TRIM(TRAILING '->' FROM #{item.nodeName})-->
|
|
|
|
<!-- )-->
|
|
<!-- </foreach>-->
|
|
<!-- </insert>-->
|
|
|
|
<update id="updateRegionChannelCount">
|
|
UPDATE t_region a
|
|
INNER JOIN
|
|
(
|
|
SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel GROUP BY region_code
|
|
) b
|
|
ON a.region_code = b.region_code
|
|
SET a.channel_count = b.channel_count
|
|
</update>
|
|
|
|
<!-- <select id="listOrgenization2" resultType="java.util.Map">-->
|
|
<!-- SELECT id FROM t_camera_organization-->
|
|
<!-- WHERE orgaid >-->
|
|
<!-- (SELECT a.orgaid FROM t_camera_organization a INNER JOIN-->
|
|
<!-- (-->
|
|
<!-- SELECT parent_id FROM t_camera_channel ORDER BY idt_camera_channel desc LIMIT 1-->
|
|
<!-- ) b-->
|
|
<!-- ON a.id = b.parent_id-->
|
|
<!-- ) ORDER BY orgaid ASC-->
|
|
<!-- </select>-->
|
|
<select id="selectAllFromOrgenizationCache" resultType="java.util.Map">
|
|
select * from t_camera_organization_cache
|
|
</select>
|
|
|
|
<update id="updateOrganizationCachePath" parameterType="java.lang.String">
|
|
UPDATE t_camera_organization_cache SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}
|
|
</update>
|
|
|
|
<insert id="insertOrganizationCacheToCameraOrganization">
|
|
INSERT INTO t_camera_organization
|
|
(
|
|
id,name,parent_id,sort,subCount,is_parent,path,is_root,channelCount,count
|
|
)
|
|
SELECT id,name,parent_id,sort,subCount,is_parent,path,is_root,channelCount,count FROM t_camera_organization_cache
|
|
</insert>
|
|
|
|
<select id="selectOrgenizationCacheById" parameterType="java.lang.String" resultType="java.util.Map">
|
|
SELECT name,parent_id,id,path FROM t_camera_organization_cache WHERE id = #{id}
|
|
</select>
|
|
</mapper> |