qa-prevention-gwj/src/main/resources/mybatis/dsno2/keyProjects/VideoManagerMapper.xml

314 lines
7.8 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="com.zcloud.mapper.dsno2.keyProjects.VideoManagerMapper">
<!--表名 -->
<sql id="tableName">
BUS_VIDEOMANAGER
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.OUTSOURCED_ID,
f.VIDEONAME,
f.VIDEOURL,
f.OPDATE,
f.OPUSER,
f.ISDELETE,
f.CODE,
f.VIDEO_RESOURCES_ID,
f.PLATFORMVIDEOMANAGEMENT_ID,
f.VIDEOMANAGER_ID,
f.LATITUDE,
f.LONGITUDE
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
OUTSOURCED_ID,
VIDEONAME,
VIDEOURL,
OPDATE,
OPUSER,
ISDELETE,
CODE,
VIDEO_RESOURCES_ID,
PLATFORMVIDEOMANAGEMENT_ID,
VIDEOMANAGER_ID,
LATITUDE,
LONGITUDE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{OUTSOURCED_ID},
#{VIDEONAME},
#{VIDEOURL},
#{OPDATE},
#{OPUSER},
#{ISDELETE},
#{CODE},
#{VIDEO_RESOURCES_ID},
#{PLATFORMVIDEOMANAGEMENT_ID},
#{VIDEOMANAGER_ID},
#{LATITUDE},
#{LONGITUDE}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
VIDEOMANAGER_ID = #{VIDEOMANAGER_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
PLATFORMVIDEOMANAGEMENT_ID = #{PLATFORMVIDEOMANAGEMENT_ID},
VIDEO_RESOURCES_ID = #{VIDEO_RESOURCES_ID},
<if test="OUTSOURCED_ID != null and OUTSOURCED_ID != ''"><!-- 关键词检索 -->
OUTSOURCED_ID = #{OUTSOURCED_ID},
</if>
<if test="VIDEONAME != null and VIDEONAME != ''"><!-- 关键词检索 -->
VIDEONAME = #{VIDEONAME},
</if>
VIDEOURL = #{VIDEOURL},
<if test="CODE != null and CODE != ''"><!-- 关键词检索 -->
CODE = #{CODE},
</if>
VIDEOMANAGER_ID = VIDEOMANAGER_ID
where
VIDEOMANAGER_ID = #{VIDEOMANAGER_ID}
</update>
<!-- 定位 -->
<update id="savePosition" parameterType="pd">
update
<include refid="tableName"></include>
set
LATITUDE = #{LATITUDE},
LONGITUDE = #{LONGITUDE}
where
VIDEOMANAGER_ID = #{VIDEOMANAGER_ID}
</update>
<update id="editIsShowBycorpinfoid" parameterType="pd">
update
<include refid="tableName"></include>
set CODE= #{CODE}
where
OUTSOURCED_ID = #{OUTSOURCED_ID}
</update>
<update id="editIsShow" parameterType="pd">
update
<include refid="tableName"></include>
set CODE= #{CODE}
where
VIDEOMANAGER_ID = #{VIDEOMANAGER_ID}
</update>
<update id="editByResourcesId">
update
<include refid="tableName"></include>
set
<if test="VIDEONAME != null and VIDEONAME != ''">
VIDEONAME = #{VIDEONAME},
</if>
<if test="VIDEOURL != null and VIDEOURL != ''">
VIDEOURL = #{VIDEOURL},
</if>
<if test="CODE != null and CODE != ''">
CODE = #{CODE},
</if>
VIDEOMANAGER_ID = VIDEOMANAGER_ID
where
VIDEO_RESOURCES_ID = #{VIDEO_RESOURCES_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} and
f.ISDELETE = '0'
<if test="OUTSOURCED_ID != null and OUTSOURCED_ID != ''"><!-- 关键词检索 -->
and f.OUTSOURCED_ID=#{OUTSOURCED_ID}
</if>
<if test="CODE != null and CODE != ''"><!-- 关键词检索 -->
and f.CODE=#{CODE}
</if>
</select>
<!-- 通过CODE获取数据 -->
<select id="findByCode" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.CODE=#{CODE}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>,
pv.INDEXCODE
from
<include refid="tableName"></include> f
left join bus_platformvideomanagement pv on pv.PLATFORMVIDEOMANAGEMENT_ID = f.PLATFORMVIDEOMANAGEMENT_ID
where f.ISDELETE = '0'
<if test="pd.OUTSOURCED_ID != null and pd.OUTSOURCED_ID != ''"><!-- 关键词检索 -->
and f.OUTSOURCED_ID=#{pd.OUTSOURCED_ID}
</if>
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
f.VIDEONAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
)
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="OUTSOURCED_ID != null and OUTSOURCED_ID != ''"><!-- 关键词检索 -->
and f.OUTSOURCED_ID=#{OUTSOURCED_ID}
</if>
<if test="CODE != null and CODE != ''"><!-- 关键词检索 -->
and f.CODE=#{CODE}
</if>
</select>
<!-- 列表(全部) -->
<select id="listBo" parameterType="pd" resultType="pd">
select
f.VIDEONAME,
f.OPDATE,
f.OPUSER,
f.ISDELETE,
f.VIDEOMANAGER_ID,
f.VIDEOURL GBSVIDEOURL,
pv.INDEXCODE
from
<include refid="tableName"></include> f
left join bus_platformvideomanagement pv on pv.PLATFORMVIDEOMANAGEMENT_ID = f.PLATFORMVIDEOMANAGEMENT_ID
where f.ISDELETE = '0'
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
and f.CORPINFO_ID=#{CORPINFO_ID}
</if>
<if test="ArrayDATA_IDS != null and ArrayDATA_IDS != ''"><!-- 关键词检索 -->
and VIDEOMANAGER_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
VIDEOMANAGER_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 列表(全部) -->
<select id="listAllForMap" parameterType="pd" resultType="pd">
select
f.*
from
<include refid="tableName"></include> f
where f.ISDELETE = '0' and f.LATITUDE is not null and f.LONGITUDE is not null
</select>
<!-- 消防点位已定位 -->
<select id="getPointsInfo" parameterType="pd" resultType="pd">
select
f.*
from
<include refid="tableName"></include> f
where f.ISDELETE = '0' and f.LATITUDE is not null and f.LONGITUDE is not null
</select>
<select id="getCameraPosition" resultType="com.zcloud.entity.PageData">
SELECT
VIDEOMANAGER_ID AS id,
VIDEONAME AS `NAME`,
'CAMERA' AS TYPE,
LATITUDE,
LONGITUDE
FROM
`qa-gwj-regulatory`.bus_videomanager v
LEFT JOIN `qa-gwj-regulatory`.bus_outsourced o on v.OUTSOURCED_ID = o.OUTSOURCED_ID
WHERE
v.ISDELETE = 0
and LATITUDE is not null and LONGITUDE is not null
<if test="AREA != null and AREA != ''">
and o.INVOLVING_CORPS in (select CORPINFO_ID from `qa-gwj-prevention`.bus_corp_info where AREA = #{AREA} and ISDELETE = 0)
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and o.INVOLVING_CORPS = #{CORPINFO_ID}
</if>
</select>
<update id="updateAiByOUTSOURCED_ID" parameterType="pd">
update
<include refid="tableName"></include>
set
PLATFORMVIDEOMANAGEMENT_ID = null,
VIDEO_RESOURCES_ID = null
where
OUTSOURCED_ID = #{OUTSOURCED_ID}
</update>
<!-- 列表 -->
<select id="dataApplistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.OUTSOURCED_ID != null and pd.OUTSOURCED_ID != ''"><!-- 关键词检索 -->
and f.OUTSOURCED_ID=#{pd.OUTSOURCED_ID}
</if>
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
f.VIDEONAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
)
</if>
</select>
</mapper>