TsysPremissionMapper.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.gyee.frame.mapper.custom.PermissionDao">
  4. <resultMap id="BaseResultMap" type="com.gyee.frame.model.auto.TsysPermission">
  5. <id column="id" jdbcType="VARCHAR" property="id" />
  6. <result column="name" jdbcType="VARCHAR" property="name" />
  7. <result column="descripion" jdbcType="VARCHAR" property="descripion" />
  8. <result column="url" jdbcType="VARCHAR" property="url" />
  9. <result column="is_blank" jdbcType="INTEGER" property="isBlank" />
  10. <result column="pid" jdbcType="VARCHAR" property="pid" />
  11. <result column="perms" jdbcType="VARCHAR" property="perms" />
  12. <result column="type" jdbcType="INTEGER" property="type" />
  13. <result column="icon" jdbcType="VARCHAR" property="icon" />
  14. <result column="order_num" jdbcType="INTEGER" property="orderNum" />
  15. <result column="visible" jdbcType="INTEGER" property="visible" />
  16. <result column="childcount" jdbcType="INTEGER" property="childCount"/>
  17. </resultMap>
  18. <sql id="Base_Column_List">
  19. id, name, descripion, url, pid, perms, type, icon, order_num
  20. </sql>
  21. <select id="findAll" resultMap="BaseResultMap">
  22. select *,(select count(1) from t_sys_permission where pid=a.id) childcount from t_sys_permission a
  23. </select>
  24. <select id="findByAdminUserId" parameterType="String" resultMap="BaseResultMap">
  25. select distinct p.*,(select count(1) from t_sys_permission where pid=p.id) childcount
  26. from t_sys_permission_role spr,t_sys_role_user sru,t_sys_permission p
  27. where spr.role_id = sru.sys_role_id AND spr.permission_id = p.id AND sru.sys_user_id=#{userId}
  28. ORDER BY order_num ASC,order_num ASC
  29. </select>
  30. <select id="queryRoleId" parameterType="String" resultMap="BaseResultMap">
  31. select p.* from t_sys_permission p
  32. left join t_sys_permission_role pr on p.id=pr.permission_id
  33. where pr.role_id=#{roleid}
  34. </select>
  35. </mapper>