Files
zhwl/zhwl-device/zhwl-device-gate/target/classes/mapper/gate/ZdyDeviceGateMapper.xml
2025-07-01 17:54:58 +08:00

610 lines
22 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.zhwl.gate.mapper.ZdyDeviceGateMapper">
<resultMap type="ZdyDeviceGate" id="ZdyDeviceGateResult">
<result property="id" column="id"/>
<result property="boardModel" column="board_model"/>
<result property="serialNo" column="serial_no"/>
<result property="mac" column="mac"/>
<result property="imei" column="imei"/>
<result property="productModel" column="product_model"/>
<result property="ip" column="ip"/>
<result property="deviceId" column="device_id"/>
<result property="deviceName" column="device_name"/>
<result property="type" column="type"/>
<result property="maker" column="maker"/>
<result property="ipv6" column="ipv6"/>
<result property="address" column="address"/>
<result property="status" column="status"/>
<result property="useStatus" column="use_status"/>
<result property="systemType" column="system_type"/>
<result property="systemName" column="system_name"/>
<result property="systemVersion" column="system_version"/>
<result property="appVersion" column="app_version"/>
<result property="areaCode" column="area_code"/>
<result property="cameraName" column="camera_name"/>
<result property="cameraMaker" column="camera_maker"/>
<result property="cameraSn" column="camera_sn"/>
<result property="cameraIp" column="camera_ip"/>
<result property="cameraPort" column="camera_port"/>
<result property="cameraUsername" column="camera_username"/>
<result property="cameraPassword" column="camera_password"/>
<result property="cameraMac" column="camera_mac"/>
<result property="cameraStatus" column="camera_status"/>
<result property="cameraUseStatus" column="camera_use_status"/>
<result property="preserveTime" column="preserve_time"/>
<result property="installTime" column="install_time"/>
<result property="syncTime" column="sync_time"/>
<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="encryption" column="encryption"/>
<result property="secretKey" column="secret_key"/>
<result property="reader" column="reader"/>
<result property="statusName" column="statusName"/>
<result property="useStatusName" column="useStatusName"/>
<result property="systemTypeName" column="systemTypeName"/>
<result property="cameraStatusName" column="cameraStatusName"/>
<result property="cameraUseStatusName" column="cameraUseStatusName"/>
<result property="typeName" column="typeName"/>
<result property="pointName" column="pointName"/>
<result property="deptId" column="dept_id"/>
<result property="scenicId" column="scenic_id"/>
<result property="scenicName" column="scenic_name"/>
</resultMap>
<sql id="selectZdyDeviceGateVo">
select gate.id,
gate.board_model,
gate.serial_no,
gate.mac,
gate.imei,
gate.product_model,
gate.ip,
gate.device_id,
gate.device_name,
gate.type,
gate.maker,
gate.ipv6,
gate.address,
gate.status,
gate.use_status,
gate.system_type,
gate.system_name,
gate.system_version,
gate.app_version,
gate.area_code,
gate.camera_name,
gate.camera_maker,
gate.camera_sn,
gate.camera_ip,
gate.camera_port,
gate.camera_username,
gate.camera_password,
gate.camera_mac,
gate.camera_status,
gate.camera_use_status,
gate.preserve_time,
gate.install_time,
gate.sync_time,
gate.create_by,
gate.create_time,
gate.update_by,
gate.update_time,
gate.remark,
gate.encryption,
gate.secret_key,
gate.reader,
gate.dept_id,
gate.scenic_id,
zs.scenic_name
from zdy_device_gate gate
</sql>
<sql id="selectZdyDeviceGateVoParam">
select gate.id,
gate.board_model,
gate.serial_no,
gate.mac,
gate.imei,
gate.product_model,
gate.ip,
gate.device_id,
gate.device_name,
gate.type,
gate.maker,
gate.ipv6,
gate.address,
gate.status,
gate.use_status,
gate.system_type,
gate.system_name,
gate.system_version,
gate.app_version,
gate.area_code,
gate.camera_name,
gate.camera_maker,
gate.camera_sn,
gate.camera_ip,
gate.camera_port,
gate.camera_username,
gate.camera_password,
gate.camera_mac,
gate.camera_status,
gate.camera_use_status,
gate.preserve_time,
gate.install_time,
gate.sync_time,
gate.create_by,
gate.create_time,
gate.update_by,
gate.update_time,
gate.remark,
gate.encryption,
gate.secret_key,
gate.reader,
gate.dept_id
</sql>
<select id="selectZdyDeviceGateList" parameterType="ZdyDeviceGate" resultMap="ZdyDeviceGateResult">
<include refid="selectZdyDeviceGateVoParam"/>
,sdd1.dict_label as statusName
,sdd2.dict_label as useStatusName
,sdd3.dict_label as systemTypeName
,sdd4.dict_label as cameraStatusName
,sdd5.dict_label as cameraUseStatusName
,sdd6.dict_label as typeName,
gate.scenic_id,
zs.scenic_name
from zdy_device_gate gate
left join sys_dict_data sdd1 on sdd1.dict_value = gate.status and sdd1.dict_type = 'device_online_status'
left join sys_dict_data sdd2 on sdd2.dict_value = gate.use_status and sdd2.dict_type = 'device_use_status'
left join sys_dict_data sdd3 on sdd3.dict_value = gate.system_type and sdd3.dict_type = 'device_system_type'
left join sys_dict_data sdd4 on sdd4.dict_value = gate.camera_status and sdd4.dict_type = 'device_online_status'
left join sys_dict_data sdd5 on sdd5.dict_value = gate.camera_use_status and sdd5.dict_type = 'device_use_status'
left join sys_dict_data sdd6 on sdd6.dict_value = gate.type and sdd6.dict_type = 'device_gate_type'
left join sys_dept d on d.dept_id = gate.dept_id
left join zdy_scenic zs on zs.id = gate.scenic_id
<where>
and gate.del_flag != 1
<if test="boardModel != null and boardModel != ''">
and board_model = #{boardModel}
</if>
<if test="serialNo != null and serialNo != ''">
and serial_no = #{serialNo}
</if>
<if test="mac != null and mac != ''">
and mac = #{mac}
</if>
<if test="imei != null and imei != ''">
and imei = #{imei}
</if>
<if test="ip != null and ip != ''">
and ip = #{ip}
</if>
<if test="deviceName != null and deviceName != ''">
and device_name like concat('%', #{deviceName}, '%')
</if>
<if test="type != null ">
and type = #{type}
</if>
<if test="address != null and address != ''">
and address = #{address}
</if>
<if test="status != null ">
and gate.status = #{status}
</if>
<if test="useStatus != null ">
and use_status = #{useStatus}
</if>
<if test="systemType != null ">
and system_type = #{systemType}
</if>
<if test="areaCode != null and areaCode != ''">
and area_code = #{areaCode}
</if>
<if test="cameraIp != null and cameraIp != ''">
and camera_ip = #{cameraIp}
</if>
<if test="cameraPort != null and cameraPort != ''">
and camera_port = #{cameraPort}
</if>
<if test="cameraStatus != null">
and camera_status = #{cameraStatus}
</if>
<if test="cameraUseStatus != null">
and camera_use_status = #{cameraUseStatus}
</if>
<if test="reader != null">
and reader = #{reader}
</if>
${params.dataScope}
</where>
</select>
<select id="selectSysDeviceGateList" resultMap="ZdyDeviceGateResult">
<include refid="selectZdyDeviceGateVo"/>
left join zdy_scenic zs on zs.id = gate.scenic_id
<where>
<if test="status != null ">and gate.status = #{status}</if>
</where>
</select>
<select id="selectZdyDeviceGateById" parameterType="Long"
resultMap="ZdyDeviceGateResult">
<include refid="selectZdyDeviceGateVo"/>
left join zdy_scenic zs on zs.id = gate.scenic_id
where gate.id = #{id}
</select>
<insert id="insertZdyDeviceGate" parameterType="ZdyDeviceGate" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_device_gate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="boardModel != null">board_model,
</if>
<if test="serialNo != null">serial_no,
</if>
<if test="mac != null">mac,
</if>
<if test="imei != null">imei,
</if>
<if test="productModel != null">product_model,
</if>
<if test="ip != null">ip,
</if>
<if test="deviceId != null">device_id,
</if>
<if test="deviceName != null">device_name,
</if>
<if test="type != null">type,
</if>
<if test="maker != null">maker,
</if>
<if test="ipv6 != null">ipv6,
</if>
<if test="address != null">address,
</if>
<if test="status != null">status,
</if>
<if test="useStatus != null">use_status,
</if>
<if test="systemType != null">system_type,
</if>
<if test="systemName != null">system_name,
</if>
<if test="systemVersion != null">system_version,
</if>
<if test="appVersion != null">app_version,
</if>
<if test="areaCode != null">area_code,
</if>
<if test="cameraName != null">camera_name,
</if>
<if test="cameraMaker != null">camera_maker,
</if>
<if test="cameraSn != null">camera_sn,
</if>
<if test="cameraIp != null">camera_ip,
</if>
<if test="cameraPort != null">camera_port,
</if>
<if test="cameraUsername != null">camera_username,
</if>
<if test="cameraPassword != null">camera_password,
</if>
<if test="cameraMac != null">camera_mac,
</if>
<if test="cameraStatus != null">camera_status,
</if>
<if test="cameraUseStatus != null">camera_use_status,
</if>
<if test="preserveTime != null">preserve_time,
</if>
<if test="installTime != null">install_time,
</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>
<if test="encryption != null">encryption,
</if>
<if test="secretKey != null">secret_key,
</if>
<if test="reader != null">reader,
</if>
<if test="deptId != null">dept_id,
</if>
<if test="scenicId != null">scenic_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="boardModel != null">#{boardModel},
</if>
<if test="serialNo != null">#{serialNo},
</if>
<if test="mac != null">#{mac},
</if>
<if test="imei != null">#{imei},
</if>
<if test="productModel != null">#{productModel},
</if>
<if test="ip != null">#{ip},
</if>
<if test="deviceId != null">#{deviceId},
</if>
<if test="deviceName != null">#{deviceName},
</if>
<if test="type != null">#{type},
</if>
<if test="maker != null">#{maker},
</if>
<if test="ipv6 != null">#{ipv6},
</if>
<if test="address != null">#{address},
</if>
<if test="status != null">#{status},
</if>
<if test="useStatus != null">#{useStatus},
</if>
<if test="systemType != null">#{systemType},
</if>
<if test="systemName != null">#{systemName},
</if>
<if test="systemVersion != null">#{systemVersion},
</if>
<if test="appVersion != null">#{appVersion},
</if>
<if test="areaCode != null">#{areaCode},
</if>
<if test="cameraName != null">#{cameraName},
</if>
<if test="cameraMaker != null">#{cameraMaker},
</if>
<if test="cameraSn != null">#{cameraSn},
</if>
<if test="cameraIp != null">#{cameraIp},
</if>
<if test="cameraPort != null">#{cameraPort},
</if>
<if test="cameraUsername != null">#{cameraUsername},
</if>
<if test="cameraPassword != null">#{cameraPassword},
</if>
<if test="cameraMac != null">#{cameraMac},
</if>
<if test="cameraStatus != null">#{cameraStatus},
</if>
<if test="cameraUseStatus != null">#{cameraUseStatus},
</if>
<if test="preserveTime != null">#{preserveTime},
</if>
<if test="installTime != null">#{installTime},
</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>
<if test="encryption != null">#{encryption},
</if>
<if test="secretKey != null">#{secretKey},
</if>
<if test="reader != null">#{reader},
</if>
<if test="deptId != null">#{deptId},
</if>
<if test="scenicId != null">#{scenicId},
</if>
</trim>
</insert>
<update id="updateZdyDeviceGate" parameterType="ZdyDeviceGate">
update zdy_device_gate
<trim prefix="SET" suffixOverrides=",">
<if test="boardModel != null">board_model =
#{boardModel},
</if>
<if test="serialNo != null">serial_no =
#{serialNo},
</if>
<if test="mac != null">mac =
#{mac},
</if>
<if test="imei != null">imei =
#{imei},
</if>
<if test="productModel != null">product_model =
#{productModel},
</if>
<if test="ip != null">ip =
#{ip},
</if>
<if test="deviceId != null">device_id =
#{deviceId},
</if>
<if test="deviceName != null">device_name =
#{deviceName},
</if>
<if test="type != null">type =
#{type},
</if>
<if test="maker != null">maker =
#{maker},
</if>
<if test="ipv6 != null">ipv6 =
#{ipv6},
</if>
<if test="address != null">address =
#{address},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="useStatus != null">use_status =
#{useStatus},
</if>
<if test="systemType != null">system_type =
#{systemType},
</if>
<if test="systemName != null">system_name =
#{systemName},
</if>
<if test="systemVersion != null">system_version =
#{systemVersion},
</if>
<if test="appVersion != null">app_version =
#{appVersion},
</if>
<if test="areaCode != null">area_code =
#{areaCode},
</if>
<if test="cameraName != null">camera_name =
#{cameraName},
</if>
<if test="cameraMaker != null">camera_maker =
#{cameraMaker},
</if>
<if test="cameraSn != null">camera_sn =
#{cameraSn},
</if>
<if test="cameraIp != null">camera_ip =
#{cameraIp},
</if>
<if test="cameraPort != null">camera_port =
#{cameraPort},
</if>
<if test="cameraUsername != null">camera_username =
#{cameraUsername},
</if>
<if test="cameraPassword != null">camera_password =
#{cameraPassword},
</if>
<if test="cameraMac != null">camera_mac =
#{cameraMac},
</if>
<if test="cameraStatus != null">camera_status =
#{cameraStatus},
</if>
<if test="cameraUseStatus != null">camera_use_status =
#{cameraUseStatus},
</if>
<if test="preserveTime != null">preserve_time =
#{preserveTime},
</if>
<if test="installTime != null">install_time =
#{installTime},
</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>
<if test="encryption != null">encryption =
#{encryption},
</if>
<if test="secretKey != null">secret_key =
#{secretKey},
</if>
<if test="reader != null">reader =
#{reader},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="scenicId != null">scenic_id =
#{scenicId},
</if>
</trim>
where id = #{id}
</update>
<update id="deleteZdyDeviceGateById" parameterType="Long">
update zdy_device_gate set del_flag = 1,update_time = now(),update_by =#{currentUserId} where id = #{id}
</update>
<update id="deleteZdyDeviceGateByIds" parameterType="String">
update zdy_device_gate set del_flag = 1,
update_time = now()
,update_by =#{currentUserId}
where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<!-- <delete id="deleteZdyDeviceGateById" parameterType="Long">-->
<!-- delete-->
<!-- from zdy_device_gate-->
<!-- where id = #{id}-->
<!-- </delete>-->
<!-- <delete id="deleteZdyDeviceGateByIds" parameterType="String">-->
<!-- delete from zdy_device_gate where id in-->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </delete>-->
<update id="updateDeviceStatusBySerialNo" parameterType="ZdyDeviceGate">
update zdy_device_gate
<trim prefix="SET" suffixOverrides=",">
<if test="status != null">status =
#{status},
</if>
<if test="syncTime != null">sync_time =
#{syncTime},
</if>
update_time = now()
</trim>
where serial_no = #{serialNo}
</update>
<update id="updateBatchStatus">
update zdy_device_gate set status = #{status}, update_time = #{currentTime}, sync_time = #{currentTime}
where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="selectZdyDeviceGateBySerialNo" parameterType="String"
resultMap="ZdyDeviceGateResult">
<include refid="selectZdyDeviceGateVo"/>
left join zdy_scenic zs on zs.id = gate.scenic_id
where gate.del_flag != 1 and gate.serial_no = #{serialNo}
</select>
<select id="countDeviceGateQuantity" resultType="int">
select count(1) from zdy_device_gate where del_flag != 1
</select>
</mapper>