2025-05-12 08:39:57 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
2025-07-10 08:40:36 +08:00
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2025-05-30 16:13:27 +08:00
|
|
|
<mapper namespace="com.zg.project.information.mapper.DeviceInfoMapper">
|
2025-07-10 08:40:36 +08:00
|
|
|
|
2025-05-12 08:39:57 +08:00
|
|
|
<resultMap type="DeviceInfo" id="DeviceInfoResult">
|
2025-07-10 08:40:36 +08:00
|
|
|
<result property="deviceId" column="device_id" />
|
|
|
|
|
<result property="ipAddress" column="ip_address" />
|
|
|
|
|
<result property="port" column="port" />
|
|
|
|
|
<result property="warehouseId" column="warehouse_id" />
|
|
|
|
|
<result property="sceneId" column="scene_id" />
|
|
|
|
|
<result property="warehouseName" column="warehouse_name" />
|
|
|
|
|
<result property="sceneName" column="scene_name" />
|
|
|
|
|
<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="isDelete" column="is_delete" />
|
2025-05-12 08:39:57 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectDeviceInfoVo">
|
2025-07-10 08:40:36 +08:00
|
|
|
SELECT
|
|
|
|
|
d.device_id,
|
|
|
|
|
d.ip_address,
|
|
|
|
|
d.port,
|
|
|
|
|
d.warehouse_id,
|
|
|
|
|
d.scene_id,
|
|
|
|
|
w.warehouse_name AS warehouse_name,
|
|
|
|
|
s.scene_name AS scene_name,
|
|
|
|
|
d.create_by,
|
|
|
|
|
d.create_time,
|
|
|
|
|
d.update_by,
|
|
|
|
|
d.update_time,
|
|
|
|
|
d.is_delete
|
|
|
|
|
FROM device_info d
|
|
|
|
|
LEFT JOIN warehouse_info w ON d.warehouse_id = w.warehouse_code
|
|
|
|
|
LEFT JOIN scene_mapping s ON d.scene_id = s.scene_code
|
2025-05-12 08:39:57 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectDeviceInfoList" parameterType="DeviceInfo" resultMap="DeviceInfoResult">
|
|
|
|
|
<include refid="selectDeviceInfoVo"/>
|
2025-07-10 08:40:36 +08:00
|
|
|
<where>
|
|
|
|
|
<if test="ipAddress != null and ipAddress != ''"> and d.ip_address = #{ipAddress}</if>
|
|
|
|
|
<if test="port != null "> and d.port = #{port}</if>
|
|
|
|
|
<if test="warehouseId != null "> and d.warehouse_id = #{warehouseId}</if>
|
|
|
|
|
<if test="sceneId != null "> and d.scene_id = #{sceneId}</if>
|
|
|
|
|
<if test="isDelete != null and isDelete != ''"> and d.is_delete = #{isDelete}</if>
|
2025-05-12 08:39:57 +08:00
|
|
|
</where>
|
|
|
|
|
</select>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
2025-05-12 08:39:57 +08:00
|
|
|
<select id="selectDeviceInfoByDeviceId" parameterType="Long" resultMap="DeviceInfoResult">
|
|
|
|
|
<include refid="selectDeviceInfoVo"/>
|
2025-07-10 08:40:36 +08:00
|
|
|
WHERE d.device_id = #{deviceId}
|
2025-05-12 08:39:57 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertDeviceInfo" parameterType="DeviceInfo">
|
|
|
|
|
insert into device_info
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="deviceId != null">device_id,</if>
|
|
|
|
|
<if test="ipAddress != null">ip_address,</if>
|
|
|
|
|
<if test="port != null">port,</if>
|
|
|
|
|
<if test="warehouseId != null">warehouse_id,</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
<if test="sceneId != null">scene_id,</if>
|
2025-05-12 08:39:57 +08:00
|
|
|
<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="isDelete != null">is_delete,</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
</trim>
|
2025-05-12 08:39:57 +08:00
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="deviceId != null">#{deviceId},</if>
|
|
|
|
|
<if test="ipAddress != null">#{ipAddress},</if>
|
|
|
|
|
<if test="port != null">#{port},</if>
|
|
|
|
|
<if test="warehouseId != null">#{warehouseId},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
<if test="sceneId != null">#{sceneId},</if>
|
2025-05-12 08:39:57 +08:00
|
|
|
<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="isDelete != null">#{isDelete},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
</trim>
|
2025-05-12 08:39:57 +08:00
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateDeviceInfo" parameterType="DeviceInfo">
|
|
|
|
|
update device_info
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
|
|
|
|
|
<if test="port != null">port = #{port},</if>
|
|
|
|
|
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
<if test="sceneId != null">scene_id = #{sceneId},</if>
|
2025-05-12 08:39:57 +08:00
|
|
|
<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="isDelete != null">is_delete = #{isDelete},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where device_id = #{deviceId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteDeviceInfoByDeviceId" parameterType="Long">
|
|
|
|
|
delete from device_info where device_id = #{deviceId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteDeviceInfoByDeviceIds" parameterType="String">
|
2025-07-10 08:40:36 +08:00
|
|
|
delete from device_info where device_id in
|
2025-05-12 08:39:57 +08:00
|
|
|
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{deviceId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2025-07-10 08:40:36 +08:00
|
|
|
</mapper>
|