UserAuthoricationMapper.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.fuzamei.mapperInterface.UserAuthoricationMapper">
  4. <!-- 查询出一个userId号下的用户所有详细信息包括基本信息,还有角色,权限信息 -->
  5. <select id="queryUserDetailInformation" resultMap="UserDetailRM">
  6. select
  7. tu.id,
  8. tu.user_id,
  9. tu.account,
  10. tu.password,
  11. tu.random,
  12. tu.public_key,
  13. tu.private_key,
  14. tu.organization_name,
  15. tu.person_name,
  16. tu.account_balance,
  17. tu.update_time,
  18. tu.create_time,
  19. tr.role_name,
  20. tp.authority_name,
  21. ai.id as id2,
  22. ai.account_id,
  23. ai.account_name,
  24. ai.account_type,
  25. ai.money
  26. from
  27. (select
  28. *
  29. from
  30. t_user
  31. where
  32. user_id=#{userId}) tu
  33. left join
  34. user_role ur
  35. on
  36. tu.user_id=ur.user_id
  37. left join
  38. t_role tr
  39. on
  40. ur.role_id=tr.role_id
  41. left join
  42. role_permission rp
  43. on
  44. rp.role_id = tr.role_id
  45. left join
  46. t_permission tp
  47. on
  48. tp.authority_id=rp.authority_id
  49. left join
  50. user_account ua
  51. on
  52. tu.user_id=ua.user_id
  53. left join
  54. account_info ai
  55. on
  56. ai.account_id=ua.account_id
  57. </select>
  58. <!-- 专门针对queryUserDetailInformation返回值结果用的 -->
  59. <resultMap type="com.fuzamei.entity.UserDetail" id="UserDetailRM" autoMapping="true">
  60. <id column="id" property="id"/>
  61. <collection property="role_name" ofType="java.lang.String" javaType="java.util.ArrayList">
  62. <constructor>
  63. <arg column="role_name"/>
  64. </constructor>
  65. </collection>
  66. <collection property="authority_name" ofType="java.lang.String" javaType="java.util.ArrayList">
  67. <constructor>
  68. <arg column="authority_name"/>
  69. </constructor>
  70. </collection>
  71. <collection property="account_info_list" resultMap="AccountInfoRM"></collection>
  72. </resultMap>
  73. <resultMap type="com.fuzamei.entity.AccountInfo" id="AccountInfoRM" autoMapping="true">
  74. <id column="id2" property="id"/>
  75. </resultMap>
  76. </mapper>