济菏高速数据中心代码
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.
 
 
 
 
 

94 lines
3.8 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.zc.business.mapper.StatusMapper">
<resultMap id="BaseResultMap" type="com.zc.business.domain.Status">
<result column="id" jdbcType="BIGINT" property="id"/>
<result column="device_no" jdbcType="VARCHAR" property="deviceNo"/>
<result column="device_name" jdbcType="VARCHAR" property="deviceName"/>
<result column="device_status" jdbcType="INTEGER" property="deviceStatus"/>
<result column="device_ip" jdbcType="VARCHAR" property="deviceIp"/>
<result column="success_rate" jdbcType="VARCHAR" property="successRate"/>
<result column="lost_rate" jdbcType="VARCHAR" property="lostRate"/>
<result column="direction" jdbcType="VARCHAR" property="direction"/>
<result column="production" jdbcType="VARCHAR" property="production"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="network" jdbcType="VARCHAR" property="network"/>
<result column="content" jdbcType="VARCHAR" property="content"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
</resultMap>
<insert id="Add" parameterType="com.zc.business.domain.Status">
INSERT INTO status
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="status.deviceNo != null">
device_no,
</if>
<if test="status.deviceName != null">
device_name,
</if>
<if test="status.deviceStatus != null">
device_status,
</if>
<if test="status.time != null">
time,
</if>
<if test="status.successRate != null">
success_rate,
</if>
<if test="status.lostRate != null">
lost_rate,
</if>
<if test="status.deviceIp != null">
device_ip,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="status.deviceNo != null">
#{status.deviceNo,jdbcType=VARCHAR},
</if>
<if test="status.deviceName != null">
#{status.deviceName,jdbcType=VARCHAR},
</if>
<if test="status.deviceStatus != null">
#{status.deviceStatus,jdbcType=INTEGER},
</if>
<if test="status.time != null">
#{status.time,jdbcType=DATE},
</if>
<if test="status.successRate != null">
#{status.successRate,jdbcType=VARCHAR},
</if>
<if test="status.lostRate != null">
#{status.lostRate,jdbcType=VARCHAR},
</if>
<if test="status.deviceIp != null">
#{status.deviceIp,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<sql id="selectStatus">
select id, device_no, device_name, device_status, time from status
</sql>
<select id="listStatus" parameterType="com.zc.business.domain.Status" resultMap="BaseResultMap">
select s.id, s.device_no, s.device_name, s.device_status,s.time, d.device_ip,s.success_rate,s.lost_rate,d.direction,d.production,d.model,d.network,d.content,d.type
from status s
LEFT JOIN device d on s.device_ip = d.device_ip
<where>
<if test="status.time != null">
AND s.time BETWEEN #{status.startTime,jdbcType=DATE} AND #{status.time,jdbcType=DATE}
</if>
<if test="status.deviceNo != null">
AND s.device_no = #{status.deviceNo}
</if>
</where>
</select>
</mapper>