<?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.ruoyi.system.mapper.TDetectionCabinetMapper">
|
|
<resultMap type="TDetectionCabinet" id="TDetectionCabinetResult">
|
<id property="cabinetId" column="cabinet_id" />
|
<result property="cabinetCode" column="cabinet_code" />
|
<result property="cabinetName" column="cabinet_name" />
|
<result property="ipAddress" column="ip_address" />
|
<result property="macAddress" column="mac_address" />
|
<result property="manufacturer" column="manufacturer" />
|
<result property="model" column="model" />
|
<result property="capacity" column="capacity" />
|
<result property="channelCount" column="channel_count" />
|
<result property="onlineStatus" column="online_status" />
|
<result property="testStatus" column="test_status" />
|
<result property="currentTest" column="current_test" />
|
<result property="status" column="status" />
|
<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="remark" column="remark" />
|
<result property="delFlag" column="del_flag" />
|
</resultMap>
|
|
<sql id="selectDetectionCabinetVo">
|
select cabinet_id, cabinet_code, cabinet_name, ip_address, mac_address,
|
manufacturer, model, capacity, channel_count, online_status, test_status,
|
current_test, status, create_by, create_time, update_by, update_time,
|
remark, del_flag
|
from t_detection_cabinet
|
</sql>
|
|
<select id="selectDetectionCabinetList" parameterType="TDetectionCabinet" resultMap="TDetectionCabinetResult">
|
<include refid="selectDetectionCabinetVo"/>
|
<where>
|
del_flag = '0'
|
<if test="device != null and device != ''">
|
and (
|
ip_address like concat('%', #{device}, '%')
|
or cabinet_code like concat('%', #{device}, '%')
|
or mac_address like concat('%', #{device}, '%')
|
or cabinet_name like concat('%', #{device}, '%')
|
)
|
</if>
|
<if test="beginCreateTime != null">
|
and create_time >= #{beginCreateTime}
|
</if>
|
<if test="endCreateTime != null">
|
and create_time <= #{endCreateTime}
|
</if>
|
<if test="cabinetCode != null and cabinetCode != ''">
|
and cabinet_code like concat('%', #{cabinetCode}, '%')
|
</if>
|
<if test="cabinetName != null and cabinetName != ''">
|
and cabinet_name like concat('%', #{cabinetName}, '%')
|
</if>
|
<if test="ipAddress != null and ipAddress != ''">
|
and ip_address = #{ipAddress}
|
</if>
|
<if test="macAddress != null and macAddress != ''">
|
and mac_address = #{macAddress}
|
</if>
|
<if test="onlineStatus != null and onlineStatus != ''">
|
and online_status = #{onlineStatus}
|
</if>
|
<if test="testStatus != null and testStatus != ''">
|
and test_status = #{testStatus}
|
</if>
|
<if test="status != null and status != ''">
|
and status = #{status}
|
</if>
|
</where>
|
order by create_time desc, cabinet_id desc
|
</select>
|
|
<select id="selectDetectionCabinetById" parameterType="Long" resultMap="TDetectionCabinetResult">
|
<include refid="selectDetectionCabinetVo"/>
|
where cabinet_id = #{cabinetId} and del_flag = '0'
|
</select>
|
|
<select id="selectByCabinetCode" parameterType="String" resultMap="TDetectionCabinetResult">
|
<include refid="selectDetectionCabinetVo"/>
|
where cabinet_code = #{cabinetCode} and del_flag = '0' limit 1
|
</select>
|
|
<select id="selectByMacAddress" parameterType="String" resultMap="TDetectionCabinetResult">
|
<include refid="selectDetectionCabinetVo"/>
|
where mac_address = #{macAddress} and del_flag = '0' limit 1
|
</select>
|
|
<insert id="insertDetectionCabinet" parameterType="TDetectionCabinet" useGeneratedKeys="true" keyProperty="cabinetId">
|
insert into t_detection_cabinet(
|
cabinet_code, cabinet_name, ip_address, mac_address, manufacturer, model, capacity,
|
channel_count, online_status, test_status, current_test, status,
|
create_by, create_time, remark, del_flag
|
) values (
|
#{cabinetCode}, #{cabinetName}, #{ipAddress}, #{macAddress}, #{manufacturer}, #{model}, #{capacity},
|
#{channelCount}, #{onlineStatus}, #{testStatus}, #{currentTest}, #{status},
|
#{createBy}, sysdate(), #{remark}, #{delFlag}
|
)
|
</insert>
|
|
<update id="updateDetectionCabinet" parameterType="TDetectionCabinet">
|
update t_detection_cabinet
|
<set>
|
<if test="cabinetCode != null and cabinetCode != ''">cabinet_code = #{cabinetCode},</if>
|
<if test="cabinetName != null and cabinetName != ''">cabinet_name = #{cabinetName},</if>
|
<if test="ipAddress != null and ipAddress != ''">ip_address = #{ipAddress},</if>
|
<if test="macAddress != null and macAddress != ''">mac_address = #{macAddress},</if>
|
<if test="manufacturer != null">manufacturer = #{manufacturer},</if>
|
<if test="model != null">model = #{model},</if>
|
<if test="capacity != null">capacity = #{capacity},</if>
|
<if test="channelCount != null">channel_count = #{channelCount},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
update_by = #{updateBy},
|
update_time = sysdate()
|
</set>
|
where cabinet_id = #{cabinetId} and del_flag = '0'
|
</update>
|
|
<update id="updateDetectionCabinetStatus" parameterType="TDetectionCabinet">
|
update t_detection_cabinet
|
set status = #{status}, update_by = #{updateBy}, update_time = sysdate()
|
where cabinet_id = #{cabinetId} and del_flag = '0'
|
</update>
|
|
<update id="deleteDetectionCabinetById">
|
update t_detection_cabinet
|
set del_flag = cast(cabinet_id as char), update_by = #{updateBy}, update_time = sysdate()
|
where cabinet_id = #{cabinetId} and del_flag = '0'
|
</update>
|
|
</mapper>
|