提交 | 用户 | 时间
|
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.RestDeptMapper"> |
|
4 |
|
|
5 |
<!-- 通用查询映射结果 --> |
|
6 |
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.sys.modular.rest.entity.RestDept"> |
|
7 |
<id column="dept_id" property="deptId"/> |
|
8 |
<result column="pid" property="pid"/> |
|
9 |
<result column="pids" property="pids"/> |
|
10 |
<result column="simple_name" property="simpleName"/> |
|
11 |
<result column="full_name" property="fullName"/> |
|
12 |
<result column="description" property="description"/> |
|
13 |
<result column="version" property="version"/> |
|
14 |
<result column="sort" property="sort"/> |
|
15 |
<result column="create_time" property="createTime"/> |
|
16 |
<result column="update_time" property="updateTime"/> |
|
17 |
<result column="create_user" property="createUser"/> |
|
18 |
<result column="update_user" property="updateUser"/> |
|
19 |
</resultMap> |
|
20 |
|
|
21 |
<!-- 通用查询结果列 --> |
|
22 |
<sql id="Base_Column_List"> |
|
23 |
dept_id AS "deptId", pid AS "pid", pids AS "pids", simple_name AS "simpleName", full_name AS "fullName", description AS "description", version AS "version", sort AS "sort", create_time AS "createTime", update_time AS "updateTime", create_user AS "createUser", update_user AS "updateUser" |
|
24 |
</sql> |
|
25 |
|
|
26 |
<select id="tree" resultType="cn.stylefeng.guns.base.pojo.node.ZTreeNode"> |
|
27 |
select dept_id AS id, pid as "pId", simple_name as name, |
|
28 |
( |
|
29 |
CASE |
|
30 |
WHEN (pid = 0 OR pid IS NULL) THEN |
|
31 |
'true' |
|
32 |
ELSE |
|
33 |
'false' |
|
34 |
END |
|
35 |
) as "open" from sys_dept |
|
36 |
</select> |
|
37 |
|
|
38 |
<select id="tree" resultType="cn.stylefeng.guns.base.pojo.node.ZTreeNode" databaseId="oracle"> |
|
39 |
select dept_id AS id, pid as "pId", simple_name as name, |
|
40 |
( |
|
41 |
CASE |
|
42 |
WHEN (pid = 0 OR pid IS NULL) THEN |
|
43 |
'1' |
|
44 |
ELSE |
|
45 |
'0' |
|
46 |
END |
|
47 |
) as "open" from sys_dept |
|
48 |
</select> |
|
49 |
|
|
50 |
<select id="list" resultType="map"> |
|
51 |
select |
|
52 |
<include refid="Base_Column_List"/> |
|
53 |
from sys_dept where 1 = 1 |
|
54 |
<if test="condition != null and condition != ''"> |
|
55 |
and simple_name like CONCAT('%',#{condition},'%') or full_name like CONCAT('%',#{condition},'%') |
|
56 |
</if> |
|
57 |
<if test="deptId != null and deptId != ''"> |
|
58 |
and (dept_id = #{deptId} or dept_id in ( select dept_id from sys_dept where pids like CONCAT('%$[', #{deptId}, '$]%') escape '$' )) |
|
59 |
</if> |
|
60 |
order by sort ASC |
|
61 |
</select> |
|
62 |
|
|
63 |
<select id="listNotPage" resultType="map"> |
|
64 |
select |
|
65 |
<include refid="Base_Column_List"/> |
|
66 |
from sys_dept where 1 = 1 |
|
67 |
<if test="condition != null and condition != ''"> |
|
68 |
and simple_name like CONCAT('%',#{condition},'%') or full_name like CONCAT('%',#{condition},'%') |
|
69 |
</if> |
|
70 |
<if test="deptId != null and deptId != ''"> |
|
71 |
and (dept_id = #{deptId} or dept_id in ( select dept_id from sys_dept where pids like CONCAT('%$[', #{deptId}, '$]%') escape '$' )) |
|
72 |
</if> |
|
73 |
order by sort ASC |
|
74 |
</select> |
|
75 |
|
|
76 |
<select id="list" resultType="map" databaseId="oracle"> |
|
77 |
select |
|
78 |
<include refid="Base_Column_List"/> |
|
79 |
from sys_dept where 1 = 1 |
|
80 |
<if test="condition != null and condition != ''"> |
|
81 |
and simple_name like ('%' || #{condition} || '%') or full_name like ('%' || #{condition} || '%') |
|
82 |
</if> |
|
83 |
<if test="deptId != null and deptId != ''"> |
|
84 |
and (dept_id = #{deptId} or dept_id in ( select dept_id from sys_dept where pids like '%[' || #{deptId} || ']%' )) |
|
85 |
</if> |
|
86 |
order by sort ASC |
|
87 |
</select> |
|
88 |
|
|
89 |
<select id="treeviewNodes" resultType="cn.stylefeng.guns.base.pojo.node.TreeviewNode"> |
|
90 |
select dept_id AS tags, pid as "parentId", simple_name as text from sys_dept |
|
91 |
</select> |
|
92 |
|
|
93 |
<select id="likePids" resultType="cn.stylefeng.guns.sys.modular.rest.entity.RestDept"> |
|
94 |
select |
|
95 |
<include refid="Base_Column_List"/> |
|
96 |
from sys_dept where 1 = 1 |
|
97 |
<if test="deptId != null and deptId != ''"> |
|
98 |
and pids LIKE CONCAT('%$[',#{deptId},'$]%') escape '$' |
|
99 |
</if> |
|
100 |
</select> |
|
101 |
|
|
102 |
<select id="likePids" resultType="cn.stylefeng.guns.sys.modular.rest.entity.RestDept" databaseId="oracle"> |
|
103 |
select |
|
104 |
<include refid="Base_Column_List"/> |
|
105 |
from sys_dept where 1 = 1 |
|
106 |
<if test="deptId != null and deptId != ''"> |
|
107 |
and pids LIKE '%[' || #{deptId} || ']%' |
|
108 |
</if> |
|
109 |
</select> |
|
110 |
|
|
111 |
</mapper> |