提交 | 用户 | 时间
|
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.rest.mapper.RestDictMapper"> |
|
4 |
|
|
5 |
<!-- 通用查询映射结果 --> |
|
6 |
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.sys.modular.rest.entity.RestDict"> |
|
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="oracle"> |
|
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="likeParentIds" resultType="cn.stylefeng.guns.sys.modular.rest.entity.RestDict"> |
|
52 |
select |
|
53 |
<include refid="Base_Column_List"></include> |
|
54 |
from sys_dict where 1 = 1 |
|
55 |
<if test="dictId != null and dictId != ''"> |
|
56 |
and parent_ids LIKE CONCAT('%$[',#{dictId},'$]%') escape '$' |
|
57 |
</if> |
|
58 |
</select> |
|
59 |
|
|
60 |
<select id="likeParentIds" resultType="cn.stylefeng.guns.sys.modular.rest.entity.RestDict" databaseId="oracle"> |
|
61 |
select |
|
62 |
<include refid="Base_Column_List"></include> |
|
63 |
from sys_dict where 1 = 1 |
|
64 |
<if test="dictId != null and dictId != ''"> |
|
65 |
and parent_ids LIKE '%$[' || #{dictId} || ']%' |
|
66 |
</if> |
|
67 |
</select> |
|
68 |
|
|
69 |
</mapper> |