拓恒统一认证授权服务
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

102 lines
3.3KB

  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.tuoheng.mapper.ClientUserMapper">
  4. <insert id="insertClientUser" parameterType="com.tuoheng.model.po.UserPo" keyProperty="id" useGeneratedKeys="true">
  5. insert into users (username, password, create_user, tenant_id, is_tenant, role_id)
  6. values (#{username}, #{password}, #{createUser}, #{tenantId}, #{isTenant}, #{roleId})
  7. </insert>
  8. <select id="judgeCreateByUserName" parameterType="java.lang.String" resultType="int">
  9. select count(1)
  10. from users
  11. where username = #{username}
  12. and enabled = 1
  13. </select>
  14. <select id="getUserByUserName" parameterType="java.lang.String" resultType="com.tuoheng.model.po.UserPo">
  15. select *
  16. from users
  17. where username = #{username}
  18. and enabled = 1
  19. </select>
  20. <select id="getUserRoleIdByUserName" parameterType="java.lang.String" resultType="int">
  21. select role_id
  22. from users
  23. where username = #{username}
  24. and enabled = 1
  25. </select>
  26. <select id="selectByUserId" resultType="com.tuoheng.model.po.UserPo">
  27. SELECT id,
  28. username,
  29. `password`,
  30. enabled,
  31. tenant_id,
  32. is_tenant,
  33. role_id,
  34. is_expire,
  35. is_able
  36. FROM users
  37. WHERE id = #{userId}
  38. </select>
  39. <select id="selectByTenantId" resultType="com.tuoheng.model.po.UserPo">
  40. SELECT *
  41. FROM users
  42. WHERE tenant_id = #{tenantId}
  43. # 用户没有被删除
  44. and enabled = 1
  45. </select>
  46. <select id="selectByTenantIdAndPage" resultType="com.tuoheng.model.vo.UserVo">
  47. SELECT
  48. u.username,
  49. u.create_time,
  50. u.update_time,
  51. a.authority platformCode
  52. FROM
  53. users u,
  54. authorities a
  55. WHERE
  56. u.tenant_id = #{query.tenantId}
  57. <if test="query.username != null and query.username != ''">
  58. and u.username LIKE concat('%',#{query.username},'%')
  59. </if>
  60. <if test="query.platformCode != null and query.platformCode != ''">
  61. and a.authority LIKE concat('%',#{query.platformCode},'%')
  62. </if>
  63. AND a.user_id = u.id
  64. AND u.enabled = 1
  65. GROUP BY u.username
  66. </select>
  67. <select id="getUserByRoleId" resultType="com.tuoheng.model.po.UserPo">
  68. SELECT *
  69. FROM users
  70. WHERE role_id = #{roleId}
  71. # 用户没有被删除
  72. and enabled = 1
  73. </select>
  74. <update id="updatePass" parameterType="com.tuoheng.model.po.UserPo">
  75. update users
  76. <set>
  77. <if test="password != null and password != ''">
  78. password = #{password},
  79. </if>
  80. <if test="updateUser != null">
  81. update_user = #{updateUser},
  82. </if>
  83. <if test="enabled != null">
  84. enabled = #{enabled},
  85. </if>
  86. <if test="isAble != null">
  87. is_able = #{isAble},
  88. </if>
  89. <if test="isExpire != null">
  90. is_expire = #{isExpire},
  91. </if>
  92. </set>
  93. where username = #{username,jdbcType=VARCHAR}
  94. </update>
  95. </mapper>