qa-prevention-gwj/src/main/resources/mybatis/datasource/map/GateVideoMapper.xml

266 lines
6.6 KiB
XML
Raw Normal View History

2024-01-02 14:12:40 +08:00
<?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.datasource.map.GateVideoMapper">
<!--表名 -->
<sql id="tableName">
BUS_GATEVIDEO
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.GATE_AREA_ID,
f.VIDEONAME,
f.OPDATE,
f.OPUSER,
f.ISDELETE,
f.CODE,
f.PLATFORMVIDEOMANAGEMENT_ID,
f.GATEVIDEO_ID,
f.LATITUDE,
f.LONGITUDE
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
GATE_AREA_ID,
VIDEONAME,
OPDATE,
OPUSER,
ISDELETE,
CODE,
PLATFORMVIDEOMANAGEMENT_ID,
GATEVIDEO_ID,
LATITUDE,
LONGITUDE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{GATE_AREA_ID},
#{VIDEONAME},
#{OPDATE},
#{OPUSER},
#{ISDELETE},
#{CODE},
#{PLATFORMVIDEOMANAGEMENT_ID},
#{GATEVIDEO_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
GATEVIDEO_ID = #{GATEVIDEO_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="GATE_AREA_ID != null and GATE_AREA_ID != ''"><!-- 关键词检索 -->
GATE_AREA_ID = #{GATE_AREA_ID},
</if>
<if test="VIDEONAME != null and VIDEONAME != ''"><!-- 关键词检索 -->
VIDEONAME = #{VIDEONAME},
</if>
<if test="PLATFORMVIDEOMANAGEMENT_ID != null and PLATFORMVIDEOMANAGEMENT_ID != ''"><!-- 关键词检索 -->
PLATFORMVIDEOMANAGEMENT_ID = #{PLATFORMVIDEOMANAGEMENT_ID},
</if>
<if test="CODE != null and CODE != ''"><!-- 关键词检索 -->
CODE = #{CODE},
</if>
GATEVIDEO_ID = GATEVIDEO_ID
where
GATEVIDEO_ID = #{GATEVIDEO_ID}
</update>
<!-- 定位 -->
<update id="savePosition" parameterType="pd">
update
<include refid="tableName"></include>
set
LATITUDE = #{LATITUDE},
LONGITUDE = #{LONGITUDE}
where
GATEVIDEO_ID = #{GATEVIDEO_ID}
</update>
<update id="editIsShowBycorpinfoid" parameterType="pd">
update
<include refid="tableName"></include>
set CODE= #{CODE}
where
GATE_AREA_ID = #{GATE_AREA_ID}
</update>
<update id="editIsShow" parameterType="pd">
update
<include refid="tableName"></include>
set CODE= #{CODE}
where
GATEVIDEO_ID = #{GATEVIDEO_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.ISDELETE = '0'
<if test="GATEVIDEO_ID != null and GATEVIDEO_ID != ''"><!-- 关键词检索 -->
and f.GATEVIDEO_ID=#{GATEVIDEO_ID}
</if>
<if test="GATE_AREA_ID != null and GATE_AREA_ID != ''"><!-- 关键词检索 -->
and f.GATE_AREA_ID=#{GATE_AREA_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 `qa-gwj-regulatory`.bus_platformvideomanagement pv on pv.PLATFORMVIDEOMANAGEMENT_ID = f.PLATFORMVIDEOMANAGEMENT_ID
where f.ISDELETE = '0'
<if test="pd.GATE_AREA_ID != null and pd.GATE_AREA_ID != ''"><!-- 关键词检索 -->
and f.GATE_AREA_ID=#{pd.GATE_AREA_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="GATE_AREA_ID != null and GATE_AREA_ID != ''"><!-- 关键词检索 -->
and f.GATE_AREA_ID=#{GATE_AREA_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.GATEVIDEO_ID,
pv.INDEXCODE
from
<include refid="tableName"></include> f
left join `qa-gwj-regulatory`.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 GATEVIDEO_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
GATEVIDEO_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
GATEVIDEO_ID AS id,
VIDEONAME AS `NAME`,
'CAMERA' AS TYPE,
v.LATITUDE,
v.LONGITUDE
FROM
bus_gatevideo v
LEFT JOIN mk_gate_machine o on v.GATE_AREA_ID = o.GATE_AREA_ID
WHERE
v.ISDELETE = 0
and v.LATITUDE is not null and v.LONGITUDE is not null
<if test="AREA != null and AREA != ''">
and o.CORPINFO_ID in (select CORPINFO_ID from bus_corp_info where AREA = #{AREA} and ISDELETE = 0)
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and o.CORPINFO_ID = #{CORPINFO_ID}
</if>
2024-05-20 14:59:43 +08:00
GROUP BY
v.GATEVIDEO_ID
2024-01-02 14:12:40 +08:00
</select>
</mapper>