wl
2022-10-24 9969bea2a8c1eab64c12a51a2d24d65e5b6c0dd0
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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.ycl.mapper.dict.DataDictionaryMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.entity.dict.DataDictionary">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="code" property="code" />
        <result column="type_name" property="typeName" />
        <result column="type_code" property="typeCode" />
        <result column="parent_id" property="parentId" />
        <result column="level" property="level" />
        <result column="remark" property="remark" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, code, type_name,type_code,parent_id,level,remark
    </sql>
 
    <resultMap id="settingsResultMap" type="com.ycl.vo.IllegalBuildingSettingVO">
        <id column="number" property="number" />
        <result column="type" property="type" />
        <result column="typeFirst" property="typeFirst" />
        <result column="typeSecond" property="typeSecond" />
        <result column="typeThird" property="typeThird" />
    </resultMap>
 
 
    <select id="listDataDictionaryPage" resultType="com.ycl.vo.IllegalBuildingSettingVO">
        SELECT
        d1.id AS number,
        d1.`name` AS type,
        d2.`name` AS typeFirst
        FROM
        `ums_data_dictionary` AS d1
        JOIN ums_data_dictionary AS d2 ON d1.parent_id = d2.id
        <where>
            d1.`level` = '2'
            AND d1.type_code = '06'
            <if test="keyWord !=null and keyWord !=''">
                AND (d1.`name` LIKE  '%${keyWord}%'
                or d2.`name` LIKE  '%${keyWord}%')
            </if>
 
        </where>
    </select>
 
    <select id="listViolationPage" resultType="com.ycl.vo.ViolationSettingVO">
        SELECT
        d1.id AS number,
        d1.`name` AS type,
        d2.`name` AS typeFirst,
        d3.`name` AS typeSecond,
        d4.`name` AS typeThird
        FROM `ums_data_dictionary` AS d1
        LEFT JOIN ums_data_dictionary AS d2 ON d1.parent_id = d2.id
        LEFT JOIN ums_data_dictionary AS d3 ON d2.parent_id  = d3.id
        LEFT JOIN ums_data_dictionary AS d4 ON d3.parent_id  = d4.id
        <where>
            d1.`level` = '4'
            AND d1.type_code = '01'
            <if test="keyWord !=null and keyWord !=''">
                AND (d1.`name` LIKE  '%${keyWord}%'
                or d2.`name` LIKE  '%${keyWord}%'
                or d3.`name` LIKE  '%${keyWord}%'
                or d4.`name` LIKE  '%${keyWord}%'
                )
            </if>
 
        </where>
 
        ORDER BY d1.parent_id,d2.parent_id,d3.parent_id,d4.parent_id
    </select>
 
</mapper>