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.
520 lines
21 KiB
XML
520 lines
21 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.TerminalsDao">
|
|
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.Terminals">
|
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
|
<result column="line_id" jdbcType="INTEGER" property="lineid"/>
|
|
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
|
|
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
|
|
<result column="org_id" jdbcType="SMALLINT" property="orgId"/>
|
|
<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="essential_info_version" jdbcType="VARCHAR" property="essentialInfoVersion"/>
|
|
<result column="has_pan" jdbcType="TINYINT" property="hasPan"/>
|
|
<result column="bs_manufacturer" jdbcType="VARCHAR" property="bsManufacturer"/>
|
|
<result column="bs_production_date" jdbcType="DATE" property="bsProductionDate"/>
|
|
<result column="bs_identifier" jdbcType="VARCHAR" property="bsIdentifier"/>
|
|
<result column="latitude" jdbcType="DOUBLE" property="latitude"/>
|
|
<result column="longitude" jdbcType="DOUBLE" property="longitude"/>
|
|
<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="LineAndGtAndTermMap" type="com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto">
|
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
|
<result column="line_id" jdbcType="INTEGER" property="lineid"/>
|
|
<result column="line_name" jdbcType="VARCHAR" property="linename"/>
|
|
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
|
|
<result column="tower_name" jdbcType="VARCHAR" property="towername"/>
|
|
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
|
|
<result column="org_id" jdbcType="SMALLINT" property="orgId"/>
|
|
<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="essential_info_version" jdbcType="VARCHAR" property="essentialInfoVersion"/>
|
|
<result column="has_pan" jdbcType="TINYINT" property="hasPan"/>
|
|
<result column="bs_manufacturer" jdbcType="VARCHAR" property="bsManufacturer"/>
|
|
<result column="bs_production_date" jdbcType="DATE" property="bsProductionDate"/>
|
|
<result column="bs_identifier" jdbcType="VARCHAR" property="bsIdentifier"/>
|
|
<result column="latitude" jdbcType="DOUBLE" property="latitude"/>
|
|
<result column="longitude" jdbcType="DOUBLE" property="longitude"/>
|
|
<result column="width" jdbcType="INTEGER" property="width"/>
|
|
<result column="mark_id" jdbcType="INTEGER" property="markId"/>
|
|
<result column="height" jdbcType="INTEGER" property="height"/>
|
|
<result column="color" jdbcType="VARCHAR" property="color"/>
|
|
<result column="boder_width" jdbcType="SMALLINT" property="boderWidth"/>
|
|
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalChannelsDto">
|
|
<result column="channel_id" jdbcType="INTEGER" property="id"/>
|
|
<result column="channel_name" jdbcType="VARCHAR" property="name"/>
|
|
<result column="path" jdbcType="VARCHAR" property="path"/>
|
|
<result column="photoId" jdbcType="VARCHAR" property="photoId"/>
|
|
</collection>
|
|
<collection property="lineList" javaType="list" ofType="com.shxy.xymanager_common.dto.TermChannelCoordinateDto">
|
|
<result column="path_id" jdbcType="INTEGER" property="pathId"/>
|
|
<result column="x1" jdbcType="FLOAT" property="x1"/>
|
|
<result column="x2" jdbcType="FLOAT" property="x2"/>
|
|
<result column="y1" jdbcType="FLOAT" property="y1"/>
|
|
<result column="y2" jdbcType="FLOAT" property="y2"/>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<resultMap id="ChannelAndTerm" type="com.shxy.xymanager_common.dto.ChannelAndTermDto">
|
|
<id column="term_id" jdbcType="INTEGER" property="termid"/>
|
|
<result column="line_id" jdbcType="INTEGER" property="lineid"/>
|
|
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
|
|
<result column="channel_id" jdbcType="INTEGER" property="channelid"/>
|
|
<result column="channel_name" jdbcType="VARCHAR" property="channelname"/>
|
|
<result column="display_name" jdbcType="VARCHAR" property="displayname"/>
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
id, line_id,tower_id,cmdid, org_id, equip_name, display_name, model, essential_info_version, has_pan,
|
|
bs_manufacturer, bs_production_date, bs_identifier, latitude, longitude, create_time,
|
|
update_time
|
|
</sql>
|
|
|
|
<select id="selectAll" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from terminals
|
|
where status = #{status}
|
|
</select>
|
|
|
|
<select id="selectByIdList" resultMap="ChannelAndTerm">
|
|
select
|
|
a.id as term_id,
|
|
a.line_id as line_id,
|
|
a.cmdid as cmdid,
|
|
a.display_name as display_name,
|
|
b.channel_id as channel_id,
|
|
c.channel_name as channel_name
|
|
from ((terminals a left join
|
|
terminal_channel_mapper b on a.id = b.term_id) left join
|
|
terminal_channels c on b.channel_id = c.id)
|
|
where a.status = #{status}
|
|
<if test="list != null and list.size>0">
|
|
and
|
|
<foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
|
|
a.id = #{item.termid}
|
|
<if test="item.channelidlist != null and item.channelidlist.size>0">
|
|
and c.id in
|
|
<foreach collection="item.channelidlist" item="id" index="index" open="(" close=")" separator=",">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
</foreach>
|
|
</if>
|
|
|
|
<!-- select-->
|
|
<!-- <include refid="Base_Column_List"/>-->
|
|
<!-- from terminals-->
|
|
<!-- where status = #{status}-->
|
|
<!-- <if test="list != null and list.size>0">-->
|
|
<!-- and id in-->
|
|
<!-- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">-->
|
|
<!-- #{id}-->
|
|
<!-- </foreach>-->
|
|
<!-- </if>-->
|
|
</select>
|
|
|
|
<select id="selectChannelAndTermList" resultMap="ChannelAndTerm">
|
|
select
|
|
a.id as term_id,
|
|
a.line_id as line_id,
|
|
a.cmdid as cmdid,
|
|
a.display_name as display_name,
|
|
b.channel_id as channel_id,
|
|
c.channel_name as channel_name
|
|
from ((terminals a left join
|
|
terminal_channel_mapper b on a.id = b.term_id) left join
|
|
terminal_channels c on b.channel_id = c.id)
|
|
where a.status = #{status}
|
|
</select>
|
|
|
|
<select id="selectTermAndLineList" resultMap="LineAndGtAndTermMap">
|
|
select
|
|
a.id as id,
|
|
a.line_id as line_id,
|
|
b.name as line_name,
|
|
a.tower_id as tower_id,
|
|
c.name as tower_name,
|
|
a.cmdid as cmdid,
|
|
a.org_id as org_id,
|
|
a.equip_name as equip_name,
|
|
a.display_name as display_name,
|
|
a.model as model,
|
|
a.essential_info_version as essential_info_version,
|
|
a.has_pan as has_pan,
|
|
a.bs_manufacturer as bs_manufacturer,
|
|
a.bs_production_date as bs_production_date,
|
|
a.bs_identifier as bs_identifier,
|
|
a.latitude as latitude,
|
|
a.longitude as longitude,
|
|
e.id as channel_id,
|
|
e.channel_name as channel_name,
|
|
tpm.width as width,
|
|
tpm.height as height,
|
|
tpm.color as color,
|
|
tpm.boder_width as boder_width,
|
|
tpm.id as mark_id,
|
|
tpmp.id as path_id,
|
|
tpmp.x1 as x1,
|
|
tpmp.x2 as x2,
|
|
tpmp.y1 as y1,
|
|
tpmp.y2 as y2,
|
|
tp.path as path,
|
|
tp.id as photoId
|
|
from
|
|
(((((((terminals a left join `lines` b on a.line_id = b.id )
|
|
left join tower c on a.tower_id = c.id)
|
|
left join terminal_channel_mapper d on a.id = d.term_id)
|
|
left join terminal_channels e on d.channel_id = e.id)
|
|
left join terminal_photo_marks tpm on a.id = tpm.term_id and e.id = tpm.channel_id)
|
|
left join terminal_photo_mark_paths tpmp on tpmp.mark_id = tpm.id)
|
|
left join
|
|
(
|
|
SELECT path,term_id,channel_id,id
|
|
from terminal_photos
|
|
where id in (select max(id) from terminal_photos where media_type =0 GROUP BY term_id,channel_id)
|
|
) tp on tp.channel_id = e.id and tp.term_id = a.id )
|
|
WHERE a.status = 1
|
|
order by a.create_time desc
|
|
</select>
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from terminals
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<select id="selectByCmdid" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from terminals
|
|
where cmdid = #{cmdid} and status = #{status}
|
|
</select>
|
|
<select id="selectByToweridAndLineid" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from terminals
|
|
where line_id = #{lineid} and tower_id = #{towerid} and status = #{status} limit 1;
|
|
</select>
|
|
|
|
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.Terminals">
|
|
insert into terminals
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="cmdid != null">
|
|
cmdid,
|
|
</if>
|
|
<if test="orgId != null">
|
|
org_id,
|
|
</if>
|
|
<if test="equipName != null">
|
|
equip_name,
|
|
</if>
|
|
<if test="displayName != null">
|
|
display_name,
|
|
</if>
|
|
<if test="model != null">
|
|
model,
|
|
</if>
|
|
<if test="essentialInfoVersion != null">
|
|
essential_info_version,
|
|
</if>
|
|
<if test="hasPan != null">
|
|
has_pan,
|
|
</if>
|
|
<if test="bsManufacturer != null">
|
|
bs_manufacturer,
|
|
</if>
|
|
<if test="bsProductionDate != null">
|
|
bs_production_date,
|
|
</if>
|
|
<if test="bsIdentifier != null">
|
|
bs_identifier,
|
|
</if>
|
|
<if test="latitude != null">
|
|
latitude,
|
|
</if>
|
|
<if test="longitude != null">
|
|
longitude,
|
|
</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="cmdid != null">
|
|
#{cmdid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="orgId != null">
|
|
#{orgId,jdbcType=SMALLINT},
|
|
</if>
|
|
<if test="equipName != null">
|
|
#{equipName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="displayName != null">
|
|
#{displayName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="model != null">
|
|
#{model,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="essentialInfoVersion != null">
|
|
#{essentialInfoVersion,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="hasPan != null">
|
|
#{hasPan,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="bsManufacturer != null">
|
|
#{bsManufacturer,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="bsProductionDate != null">
|
|
#{bsProductionDate,jdbcType=DATE},
|
|
</if>
|
|
<if test="bsIdentifier != null">
|
|
#{bsIdentifier,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="latitude != null">
|
|
#{latitude,jdbcType=DOUBLE},
|
|
</if>
|
|
<if test="longitude != null">
|
|
#{longitude,jdbcType=DOUBLE},
|
|
</if>
|
|
<if test="createTime != null">
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<insert id="insertList" useGeneratedKeys="true" keyProperty="item.id">
|
|
insert into terminals
|
|
<trim prefix="(" suffix=") values " suffixOverrides=",">
|
|
<if test="#{item.lineid} != null">
|
|
line_id,
|
|
</if>
|
|
<if test="#{item.towerid} != null">
|
|
tower_id,
|
|
</if>
|
|
<if test="#{item.cmdid} != null">
|
|
cmdid,
|
|
</if>
|
|
<if test="#{item.orgId} != null">
|
|
org_id,
|
|
</if>
|
|
<if test="#{item.equipName} != null">
|
|
equip_name,
|
|
</if>
|
|
<if test="#{item.displayName} != null">
|
|
display_name,
|
|
</if>
|
|
<if test="#{item.model} != null">
|
|
model,
|
|
</if>
|
|
<if test="#{item.essentialInfoVersion} != null">
|
|
essential_info_version,
|
|
</if>
|
|
<if test="#{item.hasPan} != null">
|
|
has_pan,
|
|
</if>
|
|
<if test="#{item.bsManufacturer} != null">
|
|
bs_manufacturer,
|
|
</if>
|
|
<if test="#{item.bsProductionDate} != null">
|
|
bs_production_date,
|
|
</if>
|
|
<if test="#{item.bsIdentifier} != null">
|
|
bs_identifier,
|
|
</if>
|
|
<if test="#{item.latitude} != null">
|
|
latitude,
|
|
</if>
|
|
<if test="#{item.longitude} != null">
|
|
longitude,
|
|
</if>
|
|
<if test="#{status} != null">
|
|
status,
|
|
</if>
|
|
<if test="#{createat} != null">
|
|
create_time,
|
|
</if>
|
|
<if test="#{updateat} != null">
|
|
update_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="#{item.lineid} != null">
|
|
#{item.lineid},
|
|
</if>
|
|
<if test="#{item.towerid} != null">
|
|
#{item.towerid},
|
|
</if>
|
|
<if test="#{item.cmdid} != null">
|
|
#{item.cmdid},
|
|
</if>
|
|
<if test="#{item.orgId} != null">
|
|
#{item.orgId},
|
|
</if>
|
|
<if test="#{item.equipName} != null">
|
|
#{item.equipName},
|
|
</if>
|
|
<if test="#{item.displayName} != null">
|
|
#{item.displayName},
|
|
</if>
|
|
<if test="#{item.model} != null">
|
|
#{item.model},
|
|
</if>
|
|
<if test="#{item.essentialInfoVersion} != null">
|
|
#{item.essentialInfoVersion},
|
|
</if>
|
|
<if test="#{item.hasPan} != null">
|
|
#{item.hasPan},
|
|
</if>
|
|
<if test="#{item.bsManufacturer} != null">
|
|
#{item.bsManufacturer},
|
|
</if>
|
|
<if test="#{item.bsProductionDate} != null">
|
|
#{item.bsProductionDate},
|
|
</if>
|
|
<if test="#{item.bsIdentifier} != null">
|
|
#{item.bsIdentifier},
|
|
</if>
|
|
<if test="#{item.latitude} != null">
|
|
#{item.latitude},
|
|
</if>
|
|
<if test="#{item.longitude} != null">
|
|
#{item.longitude},
|
|
</if>
|
|
<if test="#{status} != null">
|
|
#{status},
|
|
</if>
|
|
<if test="#{createat} != null">
|
|
#{createat},
|
|
</if>
|
|
<if test="#{updateat} != null">
|
|
#{updateat},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="deleteById">
|
|
update terminals
|
|
set status = #{status},
|
|
update_time = #{updateat}
|
|
where id in
|
|
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item.id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="updateByPrimaryKeySelective">
|
|
update terminals
|
|
<set>
|
|
<if test="data.lineid != null">
|
|
line_id = #{data.lineid},
|
|
</if>
|
|
<if test="data.towerid != null">
|
|
tower_id = #{data.towerid},
|
|
</if>
|
|
<if test="data.cmdid != null">
|
|
cmdid = #{data.cmdid},
|
|
</if>
|
|
<if test="data.orgId != null">
|
|
org_id = #{data.orgId,jdbcType=SMALLINT},
|
|
</if>
|
|
<if test="data.equipName != null">
|
|
equip_name = #{data.equipName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="data.displayName != null">
|
|
display_name = #{data.displayName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="data.model != null">
|
|
model = #{data.model,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="data.essentialInfoVersion != null">
|
|
essential_info_version = #{data.essentialInfoVersion,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="data.hasPan != null">
|
|
has_pan = #{data.hasPan,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="data.bsManufacturer != null">
|
|
bs_manufacturer = #{data.bsManufacturer,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="data.bsProductionDate != null">
|
|
bs_production_date = #{data.bsProductionDate,jdbcType=DATE},
|
|
</if>
|
|
<if test="data.bsIdentifier != null">
|
|
bs_identifier = #{data.bsIdentifier,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="data.latitude != null">
|
|
latitude = #{data.latitude,jdbcType=DOUBLE},
|
|
</if>
|
|
<if test="data.longitude != null">
|
|
longitude = #{data.longitude,jdbcType=DOUBLE},
|
|
</if>
|
|
<if test="updateat != null">
|
|
update_time = #{updateat,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</set>
|
|
where id = #{data.id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.Terminals">
|
|
update terminals
|
|
set cmdid = #{cmdid,jdbcType=VARCHAR},
|
|
org_id = #{orgId,jdbcType=SMALLINT},
|
|
equip_name = #{equipName,jdbcType=VARCHAR},
|
|
display_name = #{displayName,jdbcType=VARCHAR},
|
|
model = #{model,jdbcType=VARCHAR},
|
|
essential_info_version = #{essentialInfoVersion,jdbcType=VARCHAR},
|
|
has_pan = #{hasPan,jdbcType=TINYINT},
|
|
bs_manufacturer = #{bsManufacturer,jdbcType=VARCHAR},
|
|
bs_production_date = #{bsProductionDate,jdbcType=DATE},
|
|
bs_identifier = #{bsIdentifier,jdbcType=VARCHAR},
|
|
latitude = #{latitude,jdbcType=DOUBLE},
|
|
longitude = #{longitude,jdbcType=DOUBLE},
|
|
update_time = #{updateat}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
|
|
<select id="getTerminalInfo" resultType="com.shxy.xymanager_common.dto.TerminalInfoDto">
|
|
select
|
|
ts.term_id termId, ts.battery_voltage batteryVoltage, ts.battery_capacity batteryCapacity, ts.floating_charge floatingCharge, ts.total_working_time totalWorkingTime,
|
|
ts.working_time workingTime, ts.connection_state connectionState, ts.ws_update_time wsUpdateTime,t.cmdid cmId
|
|
from terminal_status ts left join terminals t on ts.term_id = t.id
|
|
where ts.term_id = #{termId,jdbcType=INTEGER}
|
|
</select>
|
|
|
|
<select id="getCmdIdByTermId" resultType="java.lang.String">
|
|
select
|
|
cmdid
|
|
from terminals
|
|
where id = #{termId,jdbcType=INTEGER}
|
|
</select>
|
|
|
|
|
|
<select id="getUpdateTime" resultType="java.math.BigInteger">
|
|
select
|
|
ws_update_time wsUpdateTime
|
|
from terminal_status
|
|
where term_id = #{termId,jdbcType=INTEGER}
|
|
</select>
|
|
|
|
<update id="updateCmd" parameterType="com.shxy.xymanager_common.vo.TerminalIdUpdateVo">
|
|
update terminals
|
|
set cmdid = #{newCmdId,jdbcType=VARCHAR}
|
|
where cmdid = #{cmdId,jdbcType=VARCHAR}
|
|
</update>
|
|
</mapper> |