- 在 Device 实体类中新增 deviceName 字段及其 getter/setter 方法 - 更新 DeviceMapper.xml,支持 device_name 字段的查询、插入和更新操作 - 修改 InspectionTask 实体类,增加 deviceIp 字段用于联查返回设备 IP - 调整 InspectionTaskMapper.xml,通过左连接获取设备名称与 IP 信息- 移除冗余的 device_name 插入与更新逻辑 - 注释掉旧有的设备信息设置代码,避免重复赋值 - 更新 toString 方法以包含新的 deviceName 属性
121 lines
6.4 KiB
XML
121 lines
6.4 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.ruoyi.video.mapper.DeviceMapper">
|
|
|
|
<resultMap type="Device" id="DeviceResult">
|
|
<result property="deviceId" column="device_id" />
|
|
<result property="deviceName" column="device_name" />
|
|
<result property="ip" column="ip" />
|
|
<result property="type" column="type" />
|
|
<result property="userName" column="user_name" />
|
|
<result property="password" column="password" />
|
|
<result property="url" column="url" />
|
|
<result property="mediaKey" column="mediaKey" />
|
|
<result property="enabledFlv" column="enabledFlv" />
|
|
<result property="enabledHls" column="enabledHls" />
|
|
<result property="mode" column="mode" />
|
|
<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" />
|
|
</resultMap>
|
|
|
|
<sql id="selectDeviceVo">
|
|
select device_id, device_name, ip, type, user_name, password, url, mediaKey, enabledFlv, enabledHls, mode, create_by, create_time, update_by, update_time, remark from v_device
|
|
</sql>
|
|
|
|
<select id="selectDeviceList" parameterType="Device" resultMap="DeviceResult">
|
|
<include refid="selectDeviceVo"/>
|
|
<where>
|
|
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
|
<if test="ip != null and ip != ''"> and ip = #{ip}</if>
|
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
<if test="password != null and password != ''"> and password = #{password}</if>
|
|
<if test="url != null and url != ''"> and url = #{url}</if>
|
|
<if test="mediaKey != null and mediaKey != ''"> and mediaKey = #{mediaKey}</if>
|
|
<if test="enabledFlv != null and enabledFlv != ''"> and enabledFlv = #{enabledFlv}</if>
|
|
<if test="enabledHls != null and enabledHls != ''"> and enabledHls = #{enabledHls}</if>
|
|
<if test="mode != null and mode != ''"> and mode = #{mode}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
|
<include refid="selectDeviceVo"/>
|
|
where device_id = #{deviceId}
|
|
</select>
|
|
|
|
<insert id="insertDevice" parameterType="Device" useGeneratedKeys="true" keyProperty="deviceId">
|
|
insert into v_device
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="deviceName != null and deviceName != ''">device_name,</if>
|
|
<if test="ip != null and ip != ''">ip,</if>
|
|
<if test="type != null and type != ''">type,</if>
|
|
<if test="userName != null and userName != ''">user_name,</if>
|
|
<if test="password != null and password != ''">password,</if>
|
|
<if test="url != null">url,</if>
|
|
<if test="mediaKey != null">mediaKey,</if>
|
|
<if test="enabledFlv != null">enabledFlv,</if>
|
|
<if test="enabledHls != null">enabledHls,</if>
|
|
<if test="mode != null">mode,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
|
<if test="ip != null and ip != ''">#{ip},</if>
|
|
<if test="type != null and type != ''">#{type},</if>
|
|
<if test="userName != null and userName != ''">#{userName},</if>
|
|
<if test="password != null and password != ''">#{password},</if>
|
|
<if test="url != null">#{url},</if>
|
|
<if test="mediaKey != null">#{mediaKey},</if>
|
|
<if test="enabledFlv != null">#{enabledFlv},</if>
|
|
<if test="enabledHls != null">#{enabledHls},</if>
|
|
<if test="mode != null">#{mode},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateDevice" parameterType="Device">
|
|
update v_device
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
|
|
<if test="ip != null and ip != ''">ip = #{ip},</if>
|
|
<if test="type != null and type != ''">type = #{type},</if>
|
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
|
<if test="password != null and password != ''">password = #{password},</if>
|
|
<if test="url != null">url = #{url},</if>
|
|
<if test="mediaKey != null">mediaKey = #{mediaKey},</if>
|
|
<if test="enabledFlv != null">enabledFlv = #{enabledFlv},</if>
|
|
<if test="enabledHls != null">enabledHls = #{enabledHls},</if>
|
|
<if test="mode != null">mode = #{mode},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where device_id = #{deviceId}
|
|
</update>
|
|
|
|
<delete id="deleteDeviceByDeviceId" parameterType="Long">
|
|
delete from v_device where device_id = #{deviceId}
|
|
</delete>
|
|
|
|
<delete id="deleteDeviceByDeviceIds" parameterType="String">
|
|
delete from v_device where device_id in
|
|
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
|
#{deviceId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |