<?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.example.erp.mapper.userInfo.PermissionBasicMapper">
|
<select id="getPermission">
|
select a.*,
|
CASE
|
WHEN b.id IS NULL THEN 0
|
ELSE 1
|
END
|
from permission_basic as a
|
left join permission_role as b
|
on a.id = b.permission_id
|
left join user_role as c
|
on b.role_id = c.role_id
|
left join user as d
|
on c.user_id = d.id
|
and d.id = #{userId}
|
where a.id!=1 and a.state=1
|
group by a.id
|
</select>
|
|
<select id="selectOneLevel">
|
select *
|
from permission_basic
|
where id!=1 and state=1
|
group by menu
|
|
</select>
|
|
<select id="selectTowLevel">
|
select
|
id as value,
|
page as label
|
from permission_basic
|
where id!=1 and state=1
|
group by menu
|
|
</select>
|
|
</mapper>
|