You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

255 lines
12 KiB

<?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.inspect.metadata.eqpbook.mapper.BasedataEqpBookChannelMapper">
<resultMap type="BasedataEqpBookChannel" id="BasedataEqpBookChannelResult">
<result property="areaId" column="area_id"/>
<result property="areaName" column="area_name"/>
<result property="stationName" column="station_name"/>
<result property="stationCode" column="station_code"/>
<result property="channelId" column="channel_id"/>
<result property="channelCode" column="channel_code"/>
<result property="upSystemDeviceCode" column="up_system_device_code"/>
<result property="channelName" column="channel_name"/>
<result property="parentChannelId" column="parent_channel_id"/>
<result property="eqpBookId" column="eqp_book_id"/>
<result property="eqpBookName" column="eqpBookName"/>
<result property="channelType" column="channel_type"/>
<result property="onlineState" column="online_state"/>
<result property="channelContent" column="channel_content"/>
<result property="provider" column="provider"/>
<result property="address" column="address"/>
<result property="host" column="host"/>
<result property="port" column="port"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="patrolDeviceCode" column="patrol_device_code"/>
<result property="username" column="username"/>
<result property="password" column="password"/>
<result property="deviceSource" column="device_source" />
</resultMap>
<sql id="selectBasedataEqpBookChannelVo">
select channel_id,
channel_code,
up_system_device_code,
channel_name,
parent_channel_id,
eqp_book_id,
channel_type,
online_state,
channel_content,
provider,
address,
host,
port,
create_by,
create_time,
update_by,
update_time,
delete_flag,
patrol_device_code,
username,
password,
device_source
from basedata_eqpbook_channel
</sql>
<select id="selectBasedataEqpBookChannelList" parameterType="BasedataEqpBookChannel"
resultMap="BasedataEqpBookChannelResult">
select
be.area_id,
be.area_name,
be.station_name,
be.station_code,
be.patrol_device_name as eqpBookName,
bec.channel_id,
bec.channel_code,
bec.up_system_device_code,
bec.channel_name,
bec.parent_channel_id,
bec.eqp_book_id,
bec.channel_type,
bec.online_state,
bec.channel_content,
bec.provider,
bec.address,
bec.host,
bec.port,
bec.create_by,
bec.create_time,
bec.update_by,
bec.update_time,
bec.delete_flag,
bec.patrol_device_code,
bec.username,
bec.password,
COALESCE(bec.device_source, be.device_source) AS device_source
from basedata_eqpbook_channel bec left join basedata_eqpbook be on bec.eqp_book_id = be.eqp_book_id
<where>
<if test="channelCode != null and channelCode != ''">and bec.channel_code = #{channelCode}</if>
<if test="stationCode != null and stationCode != ''">and be.station_code = #{channelCode}</if>
<if test="deviceSource != null and deviceSource != ''">and be.device_source = #{deviceSource}</if>
<if test="channelName != null and channelName != ''">and bec.channel_name like concat('%', #{channelName},
'%')
</if>
<if test="parentChannelId != null and parentChannelId != ''">and bec.parent_channel_id = #{parentChannelId}
</if>
<if test="eqpBookId != null">and bec.eqp_book_id = #{eqpBookId}</if>
<if test="channelType != null and channelType != ''">and bec.channel_type = #{channelType}</if>
<if test="onlineState != null and onlineState != ''">and bec.online_state = #{onlineState}</if>
<if test="channelContent != null and channelContent != ''">and bec.channel_content = #{channelContent}</if>
<if test="provider != null and provider != ''">and bec.provider = #{provider}</if>
<if test="address != null and address != ''">and bec.address = #{address}</if>
<if test="host != null and host != ''">and bec.host = #{host}</if>
<if test="port != null and port != ''">and bec.port = #{port}</if>
<if test="patrolDeviceCode != null and patrolDeviceCode != ''">and bec.patrol_device_code =
#{patrolDeviceCode}
</if>
<if test="username != null and username != ''">and bec.username = #{username}</if>
<if test="password != null and password != ''">and bec.password = #{password}</if>
</where>
</select>
<select id="selectBasedataEqpBookChannelByChannelId" parameterType="Long" resultMap="BasedataEqpBookChannelResult">
<include refid="selectBasedataEqpBookChannelVo"/>
where channel_id = #{channelId}
</select>
<select id="selectBasedataEqpBookChannelByChannelCode" parameterType="String" resultMap="BasedataEqpBookChannelResult">
<include refid="selectBasedataEqpBookChannelVo"/>
where channel_code = #{channelCode}
</select>
<insert id="insertBasedataEqpBookChannel" parameterType="BasedataEqpBookChannel" useGeneratedKeys="true"
keyProperty="channelId">
insert into basedata_eqpbook_channel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="channelCode != null">channel_code,</if>
<if test="channelName != null and channelName != ''">channel_name,</if>
<if test="parentChannelId != null">parent_channel_id,</if>
<if test="eqpBookId != null">eqp_book_id,</if>
<if test="channelType != null">channel_type,</if>
<if test="onlineState != null">online_state,</if>
<if test="channelContent != null">channel_content,</if>
<if test="provider != null">provider,</if>
<if test="address != null">address,</if>
<if test="host != null">host,</if>
<if test="port != null">port,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleteFlag != null">delete_flag,</if>
<if test="patrolDeviceCode != null">patrol_device_code,</if>
<if test="username != null">username,</if>
<if test="password != null">password,</if>
<if test="deviceSource != null">device_source,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="channelCode != null">#{channelCode},</if>
<if test="channelName != null and channelName != ''">#{channelName},</if>
<if test="parentChannelId != null">#{parentChannelId},</if>
<if test="eqpBookId != null">#{eqpBookId},</if>
<if test="channelType != null">#{channelType},</if>
<if test="onlineState != null">#{onlineState},</if>
<if test="channelContent != null">#{channelContent},</if>
<if test="provider != null">#{provider},</if>
<if test="address != null">#{address},</if>
<if test="host != null">#{host},</if>
<if test="port != null">#{port},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleteFlag != null">#{deleteFlag},</if>
<if test="patrolDeviceCode != null">#{patrolDeviceCode},</if>
<if test="username != null">#{username},</if>
<if test="password != null">#{password},</if>
<if test="deviceSource != null">#{deviceSource},</if>
</trim>
</insert>
<update id="updateBasedataEqpBookChannel" parameterType="BasedataEqpBookChannel">
update basedata_eqpbook_channel
<trim prefix="SET" suffixOverrides=",">
<if test="channelCode != null">channel_code = #{channelCode},</if>
<if test="channelName != null and channelName != ''">channel_name = #{channelName},</if>
<if test="parentChannelId != null">parent_channel_id = #{parentChannelId},</if>
<if test="eqpBookId != null">eqp_book_id = #{eqpBookId},</if>
<if test="channelType != null">channel_type = #{channelType},</if>
<if test="onlineState != null">online_state = #{onlineState},</if>
<if test="channelContent != null">channel_content = #{channelContent},</if>
<if test="provider != null">provider = #{provider},</if>
<if test="address != null">address = #{address},</if>
<if test="host != null">host = #{host},</if>
<if test="port != null">port = #{port},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
<if test="patrolDeviceCode != null">patrol_device_code = #{patrolDeviceCode},</if>
<if test="username != null">username = #{username},</if>
<if test="password != null">password = #{password},</if>
<if test="deviceSource != null">device_source = #{deviceSource},</if>
</trim>
where channel_id = #{channelId}
</update>
<delete id="deleteBasedataEqpBookChannelByChannelId" parameterType="Long">
delete
from basedata_eqpbook_channel
where channel_id = #{channelId}
</delete>
<delete id="deleteBasedataEqpBookChannelByChannelIds" parameterType="String">
delete from basedata_eqpbook_channel where channel_id in
<foreach item="channelId" collection="array" open="(" separator="," close=")">
#{channelId}
</foreach>
</delete>
<select id="getChannelByEqpBookCode" parameterType="BasedataEqpBookChannel"
resultMap="BasedataEqpBookChannelResult">
SELECT
b.channel_id,
b.channel_name,
b.channel_code,
a.eqp_book_id,
a.patroldevice_name,
a.patrol_device_code
FROM
basedata_eqpbook a,
basedata_eqpbook_channel b
WHERE
a.eqp_book_id = b.eqp_book_id
<if test="patrolDeviceCode != null">AND a.patrol_device_code = #{patrolDeviceCode}</if>
</select>
<select id="getChannelByEqpBookByVideoNvrCode"
parameterType="com.inspect.metadata.eqpbook.domain.vo.BasedataEqpBookChannelQueryVo"
resultMap="BasedataEqpBookChannelResult">
SELECT
b.channel_id,
b.channel_name,
b.channel_code,
a.eqp_book_id,
a.patroldevice_name,
a.patrol_device_code
FROM
basedata_eqpbook a,
basedata_eqpbook_channel b
WHERE
a.eqp_book_id = b.eqp_book_id
<if test="patrolDeviceCode != null">AND a.patrol_device_code = #{patrolDeviceCode}</if>
<if test="videoNvrCode != null">AND a.video_nvr_code = #{videoNvrCode}</if>
<if test="channelCode != null">AND b.channel_code = #{channelCode}</if>
</select>
</mapper>