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.
backend/xymanager_dao/src/main/resources/mappers/TerminalStatusDao.xml

259 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.TerminalStatusDao">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalStatus">
<id column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat"/>
<result column="last_frame_no" jdbcType="SMALLINT" property="lastFrameNo"/>
<result column="battery_voltage" jdbcType="REAL" property="batteryVoltage"/>
<result column="op_temperature" jdbcType="REAL" property="opTemperature"/>
<result column="battery_capacity" jdbcType="REAL" property="batteryCapacity"/>
<result column="floating_charge" jdbcType="TINYINT" property="floatingCharge"/>
<result column="total_working_time" jdbcType="INTEGER" property="totalWorkingTime"/>
<result column="working_time" jdbcType="INTEGER" property="workingTime"/>
<result column="gps_status" jdbcType="INTEGER" property="gpsStatus"/>
<result column="connection_state" jdbcType="TINYINT" property="connectionState"/>
<result column="signal_strength_4g" jdbcType="TINYINT" property="signalStrength4g"/>
<result column="signal_strength_2g" jdbcType="TINYINT" property="signalStrength2g"/>
<result column="remaining_ram" jdbcType="TINYINT" property="remainingRam"/>
<result column="remaining_rom" jdbcType="TINYINT" property="remainingRom"/>
<result column="boot_time" jdbcType="BIGINT" property="bootTime"/>
<result column="rs_update_time" jdbcType="BIGINT" property="updateTime"/>
</resultMap>
<resultMap id="heartResultMap" type="com.shxy.xymanager_common.dto.TerminalsWithHeart">
<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="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"/>
</resultMap>
<sql id="Base_Column_List">
term_id, last_heartbeat, last_frame_no, battery_voltage, op_temperature, battery_capacity,
floating_charge, total_working_time, working_time, gps_status,connection_state, signal_strength_4g,
signal_strength_2g, remaining_ram, remaining_rom, boot_time, rs_update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_status
where term_id = #{termId,jdbcType=INTEGER}
</select>
<select id="selectByCmdId" resultMap="heartResultMap">
select
b.id as term_id,
b.tower_id as tower_id,
b.cmdid as cmdid,
b.equip_name as equip_name,
b.display_name as display_name,
b.model as model,
a.last_heartbeat as last_heartbeat
from terminal_status a,
terminals b
where a.term_id = b.id and b.cmdid = #{cmdid}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_status
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from terminal_status
where term_id = #{termId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalStatus">
insert into terminal_status (term_id, last_heartbeat, last_frame_no,
battery_voltage, op_temperature, battery_capacity,
floating_charge, total_working_time, working_time,
connection_state, signal_strength_4g, signal_strength_2g,
remaining_ram, remaining_rom, start_time,
update_time)
values (#{termId,jdbcType=INTEGER}, #{lastHeartbeat,jdbcType=TIMESTAMP}, #{lastFrameNo,jdbcType=SMALLINT},
#{batteryVoltage,jdbcType=REAL}, #{opTemperature,jdbcType=REAL}, #{batteryCapacity,jdbcType=REAL},
#{floatingCharge,jdbcType=TINYINT}, #{totalWorkingTime,jdbcType=INTEGER}, #{workingTime,jdbcType=INTEGER},
#{connectionState,jdbcType=TINYINT}, #{signalStrength4g,jdbcType=TINYINT}, #{signalStrength2g,jdbcType=TINYINT},
#{remainingRam,jdbcType=TINYINT}, #{remainingRom,jdbcType=TINYINT}, #{startTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalStatus">
insert into terminal_status
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="termId != null">
term_id,
</if>
<if test="lastHeartbeat != null">
last_heartbeat,
</if>
<if test="lastFrameNo != null">
last_frame_no,
</if>
<if test="batteryVoltage != null">
battery_voltage,
</if>
<if test="opTemperature != null">
op_temperature,
</if>
<if test="batteryCapacity != null">
battery_capacity,
</if>
<if test="floatingCharge != null">
floating_charge,
</if>
<if test="totalWorkingTime != null">
total_working_time,
</if>
<if test="workingTime != null">
working_time,
</if>
<if test="connectionState != null">
connection_state,
</if>
<if test="signalStrength4g != null">
signal_strength_4g,
</if>
<if test="signalStrength2g != null">
signal_strength_2g,
</if>
<if test="remainingRam != null">
remaining_ram,
</if>
<if test="remainingRom != null">
remaining_rom,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="termId != null">
#{termId,jdbcType=INTEGER},
</if>
<if test="lastHeartbeat != null">
#{lastHeartbeat,jdbcType=TIMESTAMP},
</if>
<if test="lastFrameNo != null">
#{lastFrameNo,jdbcType=SMALLINT},
</if>
<if test="batteryVoltage != null">
#{batteryVoltage,jdbcType=REAL},
</if>
<if test="opTemperature != null">
#{opTemperature,jdbcType=REAL},
</if>
<if test="batteryCapacity != null">
#{batteryCapacity,jdbcType=REAL},
</if>
<if test="floatingCharge != null">
#{floatingCharge,jdbcType=TINYINT},
</if>
<if test="totalWorkingTime != null">
#{totalWorkingTime,jdbcType=INTEGER},
</if>
<if test="workingTime != null">
#{workingTime,jdbcType=INTEGER},
</if>
<if test="connectionState != null">
#{connectionState,jdbcType=TINYINT},
</if>
<if test="signalStrength4g != null">
#{signalStrength4g,jdbcType=TINYINT},
</if>
<if test="signalStrength2g != null">
#{signalStrength2g,jdbcType=TINYINT},
</if>
<if test="remainingRam != null">
#{remainingRam,jdbcType=TINYINT},
</if>
<if test="remainingRom != null">
#{remainingRom,jdbcType=TINYINT},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalStatus">
update terminal_status
<set>
<if test="lastHeartbeat != null">
last_heartbeat = #{lastHeartbeat,jdbcType=TIMESTAMP},
</if>
<if test="lastFrameNo != null">
last_frame_no = #{lastFrameNo,jdbcType=SMALLINT},
</if>
<if test="batteryVoltage != null">
battery_voltage = #{batteryVoltage,jdbcType=REAL},
</if>
<if test="opTemperature != null">
op_temperature = #{opTemperature,jdbcType=REAL},
</if>
<if test="batteryCapacity != null">
battery_capacity = #{batteryCapacity,jdbcType=REAL},
</if>
<if test="floatingCharge != null">
floating_charge = #{floatingCharge,jdbcType=TINYINT},
</if>
<if test="totalWorkingTime != null">
total_working_time = #{totalWorkingTime,jdbcType=INTEGER},
</if>
<if test="workingTime != null">
working_time = #{workingTime,jdbcType=INTEGER},
</if>
<if test="gpsStatus != null">
gps_status = #{gpsStatus},
</if>
<if test="connectionState != null">
connection_state = #{connectionState,jdbcType=TINYINT},
</if>
<if test="signalStrength4g != null">
signal_strength_4g = #{signalStrength4g,jdbcType=TINYINT},
</if>
<if test="signalStrength2g != null">
signal_strength_2g = #{signalStrength2g,jdbcType=TINYINT},
</if>
<if test="remainingRam != null">
remaining_ram = #{remainingRam,jdbcType=TINYINT},
</if>
<if test="remainingRom != null">
remaining_rom = #{remainingRom,jdbcType=TINYINT},
</if>
<if test="bootTime != null">
boot_time = #{bootTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
rs_update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where term_id = #{termId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalStatus">
update terminal_status
set last_heartbeat = #{lastHeartbeat,jdbcType=TIMESTAMP},
last_frame_no = #{lastFrameNo,jdbcType=SMALLINT},
battery_voltage = #{batteryVoltage,jdbcType=REAL},
op_temperature = #{opTemperature,jdbcType=REAL},
battery_capacity = #{batteryCapacity,jdbcType=REAL},
floating_charge = #{floatingCharge,jdbcType=TINYINT},
total_working_time = #{totalWorkingTime,jdbcType=INTEGER},
working_time = #{workingTime,jdbcType=INTEGER},
connection_state = #{connectionState,jdbcType=TINYINT},
signal_strength_4g = #{signalStrength4g,jdbcType=TINYINT},
signal_strength_2g = #{signalStrength2g,jdbcType=TINYINT},
remaining_ram = #{remainingRam,jdbcType=TINYINT},
remaining_rom = #{remainingRom,jdbcType=TINYINT},
start_time = #{startTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where term_id = #{termId,jdbcType=INTEGER}
</update>
</mapper>