‘liusuyi’
2023-07-07 85446b5b526ac53af9add7c83cfd72f39ec39611
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?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.ard.alarm.external.mapper.ArdEquipExternalMapper">
 
    <resultMap type="ArdEquipExternal" id="ArdEquipExternalResult">
        <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"/>
    </resultMap>
 
    <sql id="selectArdEquipExternalVo">
        select c.id,
               c.name,
               c.type,
               c.factory,
               c.ip,
               c.port,
               c.username,
               c.password,
               c.longitude,
               c.latitude,
               c.altitude
        from ard_equip_external c
    </sql>
 
    <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="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>
        </where>
    </select>
 
    <select id="selectArdEquipExternalById" parameterType="String" resultMap="ArdEquipExternalResult">
        <include refid="selectArdEquipExternalVo"/>
        where id = #{id}
    </select>
</mapper>