...
|
...
|
@@ -15,22 +15,14 @@ |
|
|
<result column="iconCls" property="iconCls" jdbcType="VARCHAR" />
|
|
|
<result column="component" property="component" jdbcType="VARCHAR" />
|
|
|
</resultMap>
|
|
|
<resultMap id="treeResultMap" type="com.tianbo.warehouse.model.PERMISSION" >
|
|
|
<id column="permission_id" property="permissionId" jdbcType="INTEGER" />
|
|
|
<result column="name" property="name" jdbcType="VARCHAR" />
|
|
|
<result column="permission_order" property="permissionOrder" jdbcType="VARCHAR" />
|
|
|
<result column="description" property="description" jdbcType="VARCHAR" />
|
|
|
<result column="ismenu" property="ismenu" jdbcType="BOOLEAN" />
|
|
|
<result column="hidden" property="hidden" jdbcType="BOOLEAN" />
|
|
|
<result column="parent_id" property="parentId" jdbcType="INTEGER" />
|
|
|
<result column="path" property="path" jdbcType="VARCHAR" />
|
|
|
<result column="url" property="url" jdbcType="VARCHAR" />
|
|
|
<result column="method" property="method" jdbcType="VARCHAR" />
|
|
|
<result column="iconCls" property="iconCls" jdbcType="VARCHAR" />
|
|
|
<result column="component" property="component" jdbcType="VARCHAR" />
|
|
|
<resultMap id="treeResultMap" type="com.tianbo.warehouse.model.PERMISSION" extends="BaseResultMap">
|
|
|
<collection property="children" column="permission_id" javaType="java.util.ArrayList" ofType="com.tianbo.warehouse.model.PERMISSION" select="selectByParentId">
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
<resultMap id="treeMap" type="com.tianbo.warehouse.model.PERMISSION" extends="BaseResultMap">
|
|
|
<collection property="children" column="permission_id" javaType="java.util.ArrayList" ofType="com.tianbo.warehouse.model.PERMISSION" select="getChildMenu">
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List" >
|
|
|
permission_id, name, permission_order, description, ismenu,hidden,parent_id,
|
|
|
path, url, method, iconCls, component
|
...
|
...
|
@@ -332,4 +324,52 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order |
|
|
component = #{component,jdbcType=VARCHAR}
|
|
|
where permission_id = #{permissionId,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
<select id="getUserMenuTreeByUserId" parameterType="java.lang.Integer" resultMap="treeMap">
|
|
|
SELECT
|
|
|
P.*
|
|
|
FROM
|
|
|
permission P
|
|
|
WHERE
|
|
|
parent_id = 0
|
|
|
AND
|
|
|
ismenu = 1
|
|
|
AND
|
|
|
P.permission_id IN (
|
|
|
SELECT
|
|
|
RP.permission_id
|
|
|
FROM
|
|
|
role_permission RP
|
|
|
WHERE
|
|
|
RP.role_id IN (
|
|
|
SELECT
|
|
|
R.role_id
|
|
|
FROM
|
|
|
role R
|
|
|
WHERE
|
|
|
R.role_id IN (
|
|
|
SELECT
|
|
|
UR.role_id
|
|
|
FROM
|
|
|
user_role UR
|
|
|
WHERE
|
|
|
UR.user_id = #{userId,jdbcType=INTEGER}
|
|
|
)
|
|
|
)
|
|
|
)
|
|
|
ORDER BY
|
|
|
permission_order
|
|
|
</select>
|
|
|
<select id="getChildMenu" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
*
|
|
|
FROM
|
|
|
permission
|
|
|
WHERE
|
|
|
ismenu = 1
|
|
|
AND
|
|
|
parent_id = #{parentId,jdbcType=INTEGER}
|
|
|
ORDER BY
|
|
|
permission_order
|
|
|
</select>
|
|
|
</mapper> |
...
|
...
|
|