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

261 lines
12 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.shxy.xymanager_dao.dao.DyLevelDao">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.DyLevel">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="dy_value" jdbcType="INTEGER" property="dyValue"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<resultMap id="LineAndTerminalMap" type="com.shxy.xymanager_common.dto.DyLineAndTerminalWithHeartDto">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="dyvalue" jdbcType="INTEGER" property="dyValue"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.LineAndTerminalWithHeartDto">
<id column="line_id" jdbcType="INTEGER" property="id"/>
<result column="line_name" jdbcType="VARCHAR" property="name"/>
<result column="bs_manufacturer" jdbcType="VARCHAR" property="bsManufacturer"/>
<result column="dy_level_id" jdbcType="INTEGER" property="dyLevel"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalsWithHeart">
<result column="term_id" jdbcType="INTEGER" property="id"/>
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
<result column="tower_name" jdbcType="INTEGER" property="name"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="equip_name" jdbcType="VARCHAR" property="equipname"/>
<result column="display_name" jdbcType="VARCHAR" property="displayname"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastheartbeat"/>
</collection>
</collection>
</resultMap>
<resultMap id="LineAndTerminalNoHeartMap" type="com.shxy.xymanager_common.dto.DyLineAndTerminalNoHeartDto">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="dyvalue" jdbcType="INTEGER" property="dyValue"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.LineAndTerminalNoHeartDto">
<id column="line_id" jdbcType="INTEGER" property="id"/>
<result column="line_name" jdbcType="VARCHAR" property="name"/>
<result column="bs_manufacturer" jdbcType="VARCHAR" property="bsManufacturer"/>
<result column="dy_level_id" jdbcType="INTEGER" property="dyLevel"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.entity.Terminals">
<result column="term_id" jdbcType="INTEGER" property="id"/>
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastheartbeat"/>
<result column="display_name" jdbcType="VARCHAR" property="name"/>
</collection>
</collection>
</resultMap>
<resultMap id="DyAndLineAndTowerAnTermMap" type="com.shxy.xymanager_common.dto.DyAndLineAndTowerAndTermDto">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="dyvalue" jdbcType="INTEGER" property="dyValue"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.LineAndTowerAndTermDto">
<id column="line_id" jdbcType="INTEGER" property="id"/>
<result column="line_name" jdbcType="VARCHAR" property="name"/>
<result column="bs_manufacturer" jdbcType="VARCHAR" property="bsManufacturer"/>
<result column="dy_level_id" jdbcType="INTEGER" property="dyLevel"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TowerAndTermDto">
<result column="tower_id" jdbcType="INTEGER" property="id"/>
<result column="tower_name" jdbcType="VARCHAR" property="name"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.entity.Terminals">
<result column="term_id" jdbcType="INTEGER" property="id"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="equip_name" jdbcType="VARCHAR" property="equipName"/>
<result column="display_name" jdbcType="VARCHAR" property="displayName"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
</collection>
</collection>
</collection>
</resultMap>
<sql id="Base_Column_List">
id, name, dy_value, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from dy_level
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAll" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from dy_level
where status = #{status}
</select>
<select id="selectDyAndLineAndTowerAnTermList" resultMap="DyAndLineAndTowerAnTermMap">
select
a.id as id,
a.name as name,
a.dy_value as dyvalue,
b.id as line_id,
b.name as line_name,
b.bs_manufacturer as bs_manufacturer,
b.dy_level_id as dy_level_id,
c.id as tower_id,
c.name as tower_name,
d.id as term_id,
d.cmdid as cmdid,
d.equip_name as equip_name,
d.display_name as display_name,
d.model as model
from (((dy_level a left join `lines` b on a.id = b.dy_level_id and a.status = #{status} and b.status =#{status})
left join tower c on c.line_id = b.id and c.status = #{status})
left join terminals d on d.tower_id = c.id and d.status = #{status})
<where>
true
<if test="dyid != null">
and a.id = #{dyid}
</if>
<if test="lineid != null">
and b.id = #{lineid}
</if>
<if test="towerid != null">
and c.id = #{towerid}
</if>
<if test="termid != null">
and d.id = #{termid}
</if>
</where>
</select>
<select id="selectTreeList" resultMap="LineAndTerminalMap">
select
z.id as id,
z.name as name,
z.dy_value as dyvalue,
x.id as line_id,
x.name as line_name,
x.bs_manufacturer as bs_manufacturer,
x.dy_level_id as dy_level_id,
y.id as term_id,
y.tower_id as tower_id,
t.name as tower_name,
y.cmdid as cmdid,
y.equip_name as equip_name,
y.display_name as display_name,
y.model as model,
f.last_heartbeat as last_heartbeat
from ((((dy_level z left join `lines` x on z.id = x.dy_level_id and x.status = #{status} and z.status = #{status})
left join terminals y on x.id = y.line_id and y.status = #{status})
left join tower t on y.tower_id = t.id)
left join terminal_status f on f.term_id = y.id)
</select>
<select id="selectTreeListByChannelId" resultMap="LineAndTerminalNoHeartMap">
SELECT
a.id AS id,
a.name AS name,
a.dy_value AS dyvalue,
b.id AS line_id,
b.name AS line_name,
b.bs_manufacturer AS bs_manufacturer,
c.id AS term_id,
c.tower_id AS tower_id,
c.cmdid AS cmdid,
ts.last_heartbeat as last_heartbeat,
c.display_name AS display_name
FROM
(((((dy_level a
left JOIN `lines` b ON a.id = b.dy_level_id and a.status = #{status} and b.status = #{status})
left JOIN terminals c ON b.id = c.line_id and c.status = #{status})
left JOIN terminal_channel_mapper d ON d.term_id = c.id)
left JOIN terminal_channels e ON d.channel_id = e.id and e.status = #{status})
left JOIN terminal_status ts ON c.id = ts.term_id )
<if test="channelid != null">
where e.id = #{channelid}
</if>
</select>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.DyLevel">
insert into dy_level (id, name, dy_value,
status, create_time, update_time
)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{dyValue,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.DyLevel">
insert into dy_level
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="dyValue != null">
dy_value,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="dyValue != null">
#{dyValue,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.DyLevel">
update dy_level
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="dyValue != null">
dy_value = #{dyValue,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.DyLevel">
update dy_level
set name = #{name,jdbcType=VARCHAR},
dy_value = #{dyValue,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>