提交 | 用户 | 时间
|
1ac2bc
|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
懒 |
2 |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
3 |
<mapper namespace="cn.stylefeng.guns.sys.modular.system.mapper.DictMapper"> |
|
4 |
|
|
5 |
<!-- 通用查询映射结果 --> |
|
6 |
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.sys.modular.system.entity.Dict"> |
|
7 |
<id column="dict_id" property="dictId" /> |
|
8 |
<result column="dict_type_id" property="dictTypeId" /> |
|
9 |
<result column="code" property="code" /> |
|
10 |
<result column="name" property="name" /> |
|
11 |
<result column="parent_id" property="parentId" /> |
|
12 |
<result column="parent_ids" property="parentIds" /> |
|
13 |
<result column="status" property="status" /> |
|
14 |
<result column="sort" property="sort" /> |
|
15 |
<result column="description" property="description" /> |
|
16 |
<result column="create_time" property="createTime" /> |
|
17 |
<result column="update_time" property="updateTime" /> |
|
18 |
<result column="create_user" property="createUser" /> |
|
19 |
<result column="update_user" property="updateUser" /> |
|
20 |
</resultMap> |
|
21 |
|
|
22 |
<!-- 通用查询结果列 --> |
|
23 |
<sql id="Base_Column_List"> |
|
24 |
dict_id AS "dictId", dict_type_id AS "dictTypeId", code AS "code", name AS "name", parent_id AS "parentId", parent_ids AS "parentIds", status AS "status", sort AS "sort", description AS "description", create_time AS "createTime", update_time AS "updateTime", create_user AS "createUser", update_user AS "updateUser" |
|
25 |
</sql> |
|
26 |
|
|
27 |
<select id="dictTree" resultType="cn.stylefeng.guns.base.pojo.node.ZTreeNode"> |
|
28 |
select dict_id AS id, parent_id as "pId", name as name, |
|
29 |
( |
|
30 |
CASE |
|
31 |
WHEN (parent_id = 0 OR parent_id IS NULL) THEN |
|
32 |
'true' |
|
33 |
ELSE |
|
34 |
'false' |
|
35 |
END |
|
36 |
) as "open" from sys_dict where dict_type_id = #{dictTypeId} |
|
37 |
</select> |
|
38 |
|
|
39 |
<select id="dictTree" resultType="cn.stylefeng.guns.base.pojo.node.ZTreeNode" databaseId="pgsql"> |
|
40 |
select dict_id AS id, parent_id as "pId", name as name, |
|
41 |
( |
|
42 |
CASE |
|
43 |
WHEN (parent_id = 0 OR parent_id IS NULL) THEN |
|
44 |
'1' |
|
45 |
ELSE |
|
46 |
'0' |
|
47 |
END |
|
48 |
) as "open" from sys_dict where dict_type_id = #{dictTypeId} |
|
49 |
</select> |
|
50 |
|
|
51 |
<select id="dictTree" resultType="cn.stylefeng.guns.base.pojo.node.ZTreeNode" databaseId="oracle"> |
|
52 |
select dict_id AS id, parent_id as "pId", name as name, |
|
53 |
( |
|
54 |
CASE |
|
55 |
WHEN (parent_id = 0 OR parent_id IS NULL) THEN |
|
56 |
'1' |
|
57 |
ELSE |
|
58 |
'0' |
|
59 |
END |
|
60 |
) as "open" from sys_dict where dict_type_id = #{dictTypeId} |
|
61 |
</select> |
|
62 |
|
|
63 |
<select id="likeParentIds" resultType="cn.stylefeng.guns.sys.modular.system.entity.Dict"> |
|
64 |
select |
|
65 |
<include refid="Base_Column_List"></include> |
|
66 |
from sys_dict where 1 = 1 |
|
67 |
<if test="dictId != null and dictId != ''"> |
|
68 |
and parent_ids LIKE CONCAT('%$[',#{dictId},'$]%') escape '$' |
|
69 |
</if> |
|
70 |
</select> |
|
71 |
|
|
72 |
<select id="likeParentIds" resultType="cn.stylefeng.guns.sys.modular.system.entity.Dict" databaseId="pgsql"> |
|
73 |
select |
|
74 |
<include refid="Base_Column_List"></include> |
|
75 |
from sys_dict where 1 = 1 |
|
76 |
<if test="dictId != null and dictId != ''"> |
|
77 |
and parent_ids LIKE '%$[' || #{dictId} || ']%' |
|
78 |
</if> |
|
79 |
</select> |
|
80 |
|
|
81 |
<select id="likeParentIds" resultType="cn.stylefeng.guns.sys.modular.system.entity.Dict" databaseId="oracle"> |
|
82 |
select |
|
83 |
<include refid="Base_Column_List"></include> |
|
84 |
from sys_dict where 1 = 1 |
|
85 |
<if test="dictId != null and dictId != ''"> |
|
86 |
and parent_ids LIKE '%$[' || #{dictId} || ']%' |
|
87 |
</if> |
|
88 |
</select> |
|
89 |
|
|
90 |
</mapper> |