|
@@ -24,21 +24,36 @@
|
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
- <select id="getTree" resultMap="BaseResultMap">
|
|
|
|
|
|
+ <sql id="menuWheres">
|
|
|
|
+ <if test="menuQuery.pid != null and menuQuery.pid != ''">
|
|
|
|
+ and pid = #{menuQuery.pid}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="menuQuery.title != null and menuQuery.title != ''">
|
|
|
|
+ and title like concat('%',#{menuQuery.title},'%')
|
|
|
|
+ </if>
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <sql id="getTree_mysql">
|
|
with recursive cte as (
|
|
with recursive cte as (
|
|
select * from sys_menu
|
|
select * from sys_menu
|
|
<where>
|
|
<where>
|
|
- <if test="menuQuery.pid != null and menuQuery.pid != ''">
|
|
|
|
- and pid = #{menuQuery.pid}
|
|
|
|
- </if>
|
|
|
|
- <if test="menuQuery.title != null and menuQuery.title != ''">
|
|
|
|
- and title like concat('%',#{menuQuery.title},'%')
|
|
|
|
- </if>
|
|
|
|
|
|
+ <include refid="menuWheres"></include>
|
|
</where>
|
|
</where>
|
|
UNION
|
|
UNION
|
|
select sm.* from sys_menu sm, cte where sm.id = cte.pid
|
|
select sm.* from sys_menu sm, cte where sm.id = cte.pid
|
|
)
|
|
)
|
|
select * from cte order by sort asc
|
|
select * from cte order by sort asc
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <sql id="getTree_oracle">
|
|
|
|
+ SELECT * FROM SYS_MENU
|
|
|
|
+ START WITH
|
|
|
|
+ <include refid="menuWheres"></include>
|
|
|
|
+ CONNECT BY PRIOR pid = id
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <select id="getTree" resultMap="BaseResultMap">
|
|
|
|
+ <include refid="getTree_mysql"></include>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|