RoleDao.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="platform.modules.sys.dao.RoleDao">
  6. <!--根据用户ID查询角色对象信息-->
  7. <select id="findByUserId" parameterType="java.lang.Long" resultType="platform.modules.sys.entity.Role">
  8. SELECT * FROM sys_role r where r.id IN
  9. (
  10. SELECT ur.role_id FROM user_role ur where ur.user_id=#{userId}
  11. )
  12. </select>
  13. <select id="findByRoleName" resultType="platform.modules.sys.entity.Role">
  14. select * from sys_role where name=#{name}
  15. <if test="id!=null and id!=''">
  16. and id!=#{id}
  17. </if>
  18. </select>
  19. <select id="findByQuery" resultType="platform.modules.sys.entity.Role">
  20. select * from sys_role WHERE del_flag = 0
  21. <if test="query.user_type != null and query.user_type != ''">
  22. user_type = #{query.user_type}
  23. </if>
  24. <if test="query.street_id != null and query.street_id != ''">
  25. user_type = #{query.street_id}
  26. </if>
  27. <if test="query.street_id != null and query.street_id != ''">
  28. user_type = #{query.street_id}
  29. </if>
  30. </select>
  31. <select id="getStreetCompanyRole" resultType="platform.modules.sys.entity.Role">
  32. select * from sys_role WHERE del_flag = 0 and street_id = #{street_id} and company_id is not null
  33. </select>
  34. </mapper>