UserResourceFind.xml
1.02 KB
<?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.diligrp.manage.dao.impl.UserResourceDaoImpl">
<resultMap id="UserResourceRM" type="com.diligrp.manage.domain.UserResource">
<id property="userId" column="userId"/>
<result property="resourceName" column="resourceName"/>
<result property="url" column="url"/>
<result property="type" column="type"/>
</resultMap>
<select id="findResourceByUserName" parameterType="String" resultMap="UserResourceRM">
SELECT
distinct(su.id) userId,
sr.resource_name resourceName,
sr.url url,
sr.type,
sr.method
FROM
security_user su
JOIN security_user_role sur ON su.id = sur.user_id
JOIN security_role_permission srp ON sur.role_id = srp.role_id
JOIN security_resource sr ON (srp.resource_id = sr.id and sr.status = 1) or sr.status = 2
WHERE
1 = 1
and su.user_name = #{userName}
</select>
</mapper>