|  |  |  | 
|---|
|  |  |  | <?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"> | 
|---|
|  |  |  | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | 
|---|
|  |  |  | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
|---|
|  |  |  | <mapper namespace="com.ruoyi.device.external.mapper.ArdEquipExternalMapper"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap type="ArdEquipExternal" id="ArdEquipExternalResult"> | 
|---|
|  |  |  | <result property="id"    column="id"    /> | 
|---|
|  |  |  | <result property="updateTime"    column="update_time"    /> | 
|---|
|  |  |  | <result property="name"    column="name"    /> | 
|---|
|  |  |  | <result property="type"    column="type"    /> | 
|---|
|  |  |  | <result property="factory"    column="factory"    /> | 
|---|
|  |  |  | <result property="region"    column="region"    /> | 
|---|
|  |  |  | <result property="ip"    column="ip"    /> | 
|---|
|  |  |  | <result property="createBy"    column="create_by"    /> | 
|---|
|  |  |  | <result property="createTime"    column="create_time"    /> | 
|---|
|  |  |  | <result property="updateBy"    column="update_by"    /> | 
|---|
|  |  |  | <result property="altitude"    column="altitude"    /> | 
|---|
|  |  |  | <result property="username"    column="username"    /> | 
|---|
|  |  |  | <result property="password"    column="password"    /> | 
|---|
|  |  |  | <result property="deptId"    column="dept_id"    /> | 
|---|
|  |  |  | <result property="userId"    column="user_id"    /> | 
|---|
|  |  |  | <result property="port"    column="port"    /> | 
|---|
|  |  |  | <result property="longitude"    column="longitude"    /> | 
|---|
|  |  |  | <result property="latitude"    column="latitude"    /> | 
|---|
|  |  |  | <result property="id" column="id"/> | 
|---|
|  |  |  | <result property="name" column="name"/> | 
|---|
|  |  |  | <result property="type" column="type"/> | 
|---|
|  |  |  | <result property="factory" column="factory"/> | 
|---|
|  |  |  | <result property="ip" column="ip"/> | 
|---|
|  |  |  | <result property="port" column="port"/> | 
|---|
|  |  |  | <result property="username" column="username"/> | 
|---|
|  |  |  | <result property="password" column="password"/> | 
|---|
|  |  |  | <result property="longitude" column="longitude"/> | 
|---|
|  |  |  | <result property="latitude" column="latitude"/> | 
|---|
|  |  |  | <result property="altitude" column="altitude"/> | 
|---|
|  |  |  | <result property="deptId" column="dept_id"/> | 
|---|
|  |  |  | <result property="userId" column="user_id"/> | 
|---|
|  |  |  | <result property="createBy" column="create_by"/> | 
|---|
|  |  |  | <result property="createTime" column="create_time"/> | 
|---|
|  |  |  | <result property="updateBy" column="update_by"/> | 
|---|
|  |  |  | <result property="updateTime" column="update_time"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="selectArdEquipExternalVo"> | 
|---|
|  |  |  | select c.id, | 
|---|
|  |  |  | c.update_time, | 
|---|
|  |  |  | c.name, | 
|---|
|  |  |  | c.type, | 
|---|
|  |  |  | c.factory, | 
|---|
|  |  |  | c.region, | 
|---|
|  |  |  | c.ip, | 
|---|
|  |  |  | c.port, | 
|---|
|  |  |  | c.username, | 
|---|
|  |  |  | c.password, | 
|---|
|  |  |  | c.longitude, | 
|---|
|  |  |  | c.latitude, | 
|---|
|  |  |  | c.altitude, | 
|---|
|  |  |  | d.dept_id, | 
|---|
|  |  |  | u.user_id, | 
|---|
|  |  |  | c.create_by, | 
|---|
|  |  |  | c.create_time, | 
|---|
|  |  |  | c.update_by, | 
|---|
|  |  |  | c.altitude, | 
|---|
|  |  |  | c.username, | 
|---|
|  |  |  | c.password, | 
|---|
|  |  |  | d.dept_id, | 
|---|
|  |  |  | u.user_id, | 
|---|
|  |  |  | c.port, | 
|---|
|  |  |  | c.longitude, | 
|---|
|  |  |  | c.latitude | 
|---|
|  |  |  | c.update_time | 
|---|
|  |  |  | from ard_equip_external c | 
|---|
|  |  |  | left join sys_dept d on d.dept_id = c.dept_id | 
|---|
|  |  |  | left join sys_user u on u.user_id = c.user_id | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectArdEquipExternalList" parameterType="ArdEquipExternal" resultMap="ArdEquipExternalResult"> | 
|---|
|  |  |  | <include refid="selectArdEquipExternalVo"/> | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="name != null  and name != ''"> and c.name like '%'||#{name}||'%'</if> | 
|---|
|  |  |  | <if test="type != null  and type != ''"> and c.type = #{type}</if> | 
|---|
|  |  |  | <if test="factory != null  and factory != ''"> and c.factory = #{factory}</if> | 
|---|
|  |  |  | <if test="region != null  and region != ''"> and c.region = #{region}</if> | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="name != null  and name != ''">and c.name like '%'||#{name}||'%'</if> | 
|---|
|  |  |  | <if test="ip != null  and ip != ''">and c.ip = #{ip}</if> | 
|---|
|  |  |  | <if test="type != null  and type != ''">and c.type = #{type}</if> | 
|---|
|  |  |  | <if test="factory != null  and factory != ''">and c.factory = #{factory}</if> | 
|---|
|  |  |  | <if test="deptId != null ">and (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t | 
|---|
|  |  |  | WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) )) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="userId != null  and userId != ''"> and c.user_id = #{userId}</if> | 
|---|
|  |  |  | <if test="userId != null  and userId != ''">and c.user_id = #{userId}</if> | 
|---|
|  |  |  | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> | 
|---|
|  |  |  | and create_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | 
|---|
|  |  |  | ${params.dataScope} | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectArdEquipExternalById" parameterType="String" resultMap="ArdEquipExternalResult"> | 
|---|
|  |  |  | <include refid="selectArdEquipExternalVo"/> | 
|---|
|  |  |  | where id = #{id} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insertArdEquipExternal" parameterType="ArdEquipExternal"> | 
|---|
|  |  |  | insert into ard_equip_external | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null">id,</if> | 
|---|
|  |  |  | <if test="updateTime != null">update_time,</if> | 
|---|
|  |  |  | <if test="name != null">name,</if> | 
|---|
|  |  |  | <if test="type != null">type,</if> | 
|---|
|  |  |  | <if test="factory != null">factory,</if> | 
|---|
|  |  |  | <if test="region != null">region,</if> | 
|---|
|  |  |  | <if test="ip != null">ip,</if> | 
|---|
|  |  |  | <if test="port != null">port,</if> | 
|---|
|  |  |  | <if test="username != null">username,</if> | 
|---|
|  |  |  | <if test="password != null">password,</if> | 
|---|
|  |  |  | <if test="longitude != null">longitude,</if> | 
|---|
|  |  |  | <if test="latitude != null">latitude,</if> | 
|---|
|  |  |  | <if test="altitude != null">altitude,</if> | 
|---|
|  |  |  | <if test="deptId != null">dept_id,</if> | 
|---|
|  |  |  | <if test="userId != null">user_id,</if> | 
|---|
|  |  |  | <if test="createBy != null">create_by,</if> | 
|---|
|  |  |  | <if test="createTime != null">create_time,</if> | 
|---|
|  |  |  | <if test="updateBy != null">update_by,</if> | 
|---|
|  |  |  | <if test="altitude != null">altitude,</if> | 
|---|
|  |  |  | <if test="username != null">username,</if> | 
|---|
|  |  |  | <if test="password != null">password,</if> | 
|---|
|  |  |  | <if test="deptId != null">dept_id,</if> | 
|---|
|  |  |  | <if test="userId != null">user_id,</if> | 
|---|
|  |  |  | <if test="port != null">port,</if> | 
|---|
|  |  |  | <if test="longitude != null">longitude,</if> | 
|---|
|  |  |  | <if test="latitude != null">latitude,</if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <if test="updateTime != null">update_time,</if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null">#{id},</if> | 
|---|
|  |  |  | <if test="updateTime != null">#{updateTime},</if> | 
|---|
|  |  |  | <if test="name != null">#{name},</if> | 
|---|
|  |  |  | <if test="type != null">#{type},</if> | 
|---|
|  |  |  | <if test="factory != null">#{factory},</if> | 
|---|
|  |  |  | <if test="region != null">#{region},</if> | 
|---|
|  |  |  | <if test="ip != null">#{ip},</if> | 
|---|
|  |  |  | <if test="port != null">#{port},</if> | 
|---|
|  |  |  | <if test="username != null">#{username},</if> | 
|---|
|  |  |  | <if test="password != null">#{password},</if> | 
|---|
|  |  |  | <if test="longitude != null">#{longitude},</if> | 
|---|
|  |  |  | <if test="latitude != null">#{latitude},</if> | 
|---|
|  |  |  | <if test="altitude != null">#{altitude},</if> | 
|---|
|  |  |  | <if test="deptId != null">#{deptId},</if> | 
|---|
|  |  |  | <if test="userId != null">#{userId},</if> | 
|---|
|  |  |  | <if test="createBy != null">#{createBy},</if> | 
|---|
|  |  |  | <if test="createTime != null">#{createTime},</if> | 
|---|
|  |  |  | <if test="updateBy != null">#{updateBy},</if> | 
|---|
|  |  |  | <if test="altitude != null">#{altitude},</if> | 
|---|
|  |  |  | <if test="username != null">#{username},</if> | 
|---|
|  |  |  | <if test="password != null">#{password},</if> | 
|---|
|  |  |  | <if test="deptId != null">#{deptId},</if> | 
|---|
|  |  |  | <if test="userId != null">#{userId},</if> | 
|---|
|  |  |  | <if test="port != null">#{port},</if> | 
|---|
|  |  |  | <if test="longitude != null">#{longitude},</if> | 
|---|
|  |  |  | <if test="latitude != null">#{latitude},</if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <if test="updateTime != null">#{updateTime},</if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="updateArdEquipExternal" parameterType="ArdEquipExternal"> | 
|---|
|  |  |  | update ard_equip_external | 
|---|
|  |  |  | <trim prefix="SET" suffixOverrides=","> | 
|---|
|  |  |  | <if test="updateTime != null">update_time = #{updateTime},</if> | 
|---|
|  |  |  | <if test="name != null">name = #{name},</if> | 
|---|
|  |  |  | <if test="type != null">type = #{type},</if> | 
|---|
|  |  |  | <if test="factory != null">factory = #{factory},</if> | 
|---|
|  |  |  | <if test="region != null">region = #{region},</if> | 
|---|
|  |  |  | <if test="ip != null">ip = #{ip},</if> | 
|---|
|  |  |  | <if test="port != null">port = #{port},</if> | 
|---|
|  |  |  | <if test="username != null">username = #{username},</if> | 
|---|
|  |  |  | <if test="password != null">password = #{password},</if> | 
|---|
|  |  |  | <if test="longitude != null">longitude = #{longitude},</if> | 
|---|
|  |  |  | <if test="latitude != null">latitude = #{latitude},</if> | 
|---|
|  |  |  | <if test="altitude != null">altitude = #{altitude},</if> | 
|---|
|  |  |  | <if test="deptId != null">dept_id = #{deptId},</if> | 
|---|
|  |  |  | <if test="userId != null">user_id = #{userId},</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="altitude != null">altitude = #{altitude},</if> | 
|---|
|  |  |  | <if test="username != null">username = #{username},</if> | 
|---|
|  |  |  | <if test="password != null">password = #{password},</if> | 
|---|
|  |  |  | <if test="deptId != null">dept_id = #{deptId},</if> | 
|---|
|  |  |  | <if test="userId != null">user_id = #{userId},</if> | 
|---|
|  |  |  | <if test="port != null">port = #{port},</if> | 
|---|
|  |  |  | <if test="longitude != null">longitude = #{longitude},</if> | 
|---|
|  |  |  | <if test="latitude != null">latitude = #{latitude},</if> | 
|---|
|  |  |  | <if test="updateTime != null">update_time = #{updateTime},</if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | where id = #{id} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteArdEquipExternalById" parameterType="String"> | 
|---|
|  |  |  | delete from ard_equip_external where id = #{id} | 
|---|
|  |  |  | delete | 
|---|
|  |  |  | from ard_equip_external | 
|---|
|  |  |  | where id = #{id} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteArdEquipExternalByIds" parameterType="String"> | 
|---|
|  |  |  | delete from ard_equip_external where id in | 
|---|
|  |  |  | delete from ard_equip_external where id in | 
|---|
|  |  |  | <foreach item="id" collection="array" open="(" separator="," close=")"> | 
|---|
|  |  |  | #{id} | 
|---|
|  |  |  | </foreach> | 
|---|