|
@@ -0,0 +1,45 @@
|
|
|
+<?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.flow.dao.MenuDao">
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMap" type="com.flow.entity.Menu">
|
|
|
+ <id property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="pid" column="pid" jdbcType="INTEGER"/>
|
|
|
+ <result property="type" column="type" jdbcType="VARCHAR"/>
|
|
|
+ <result property="name" column="name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="sort" column="sort" jdbcType="INTEGER"/>
|
|
|
+ <result property="path" column="path" jdbcType="VARCHAR"/>
|
|
|
+ <result property="component" column="component" jdbcType="VARCHAR"/>
|
|
|
+ <result property="redirect" column="redirect" jdbcType="VARCHAR"/>
|
|
|
+ <result property="title" column="title" jdbcType="VARCHAR"/>
|
|
|
+ <result property="icon" column="icon" jdbcType="VARCHAR"/>
|
|
|
+ <result property="cache" column="keep_alive" jdbcType="BOOLEAN"/>
|
|
|
+ <result property="hidden" column="hidden" jdbcType="BOOLEAN"/>
|
|
|
+ <result property="affix" column="affix" jdbcType="BOOLEAN"/>
|
|
|
+ <result property="activeMenu" column="active_menu" jdbcType="VARCHAR"/>
|
|
|
+ <result property="permission" column="permission" jdbcType="VARCHAR"/>
|
|
|
+ <result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
|
|
+ <result property="updatedBy" column="updated_by" jdbcType="VARCHAR"/>
|
|
|
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="getTree" resultMap="BaseResultMap">
|
|
|
+ with recursive cte as (
|
|
|
+ select * from sys_menu
|
|
|
+ <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>
|
|
|
+ </where>
|
|
|
+ UNION
|
|
|
+ select sm.* from sys_menu sm, cte where sm.id = cte.pid
|
|
|
+ )
|
|
|
+ select * from cte order by sort asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|