Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

165 строки
5.4 KiB

  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.iformall.mapper.MallUserInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.MallUserInfo">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="username" jdbcType="VARCHAR" property="username"/>
  8. <result column="name" jdbcType="VARCHAR" property="name"/>
  9. <result column="password" jdbcType="VARCHAR" property="password"/>
  10. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  11. <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime"/>
  12. <result column="status" jdbcType="INTEGER" property="status"/>
  13. <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/>
  14. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  15. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  16. <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/>
  17. <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/>
  18. <result column="flow_permission" property="flowPermission"/>
  19. </resultMap>
  20. <sql id="allColumns">
  21. `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`bopen_id`,`web_open_id`,`flow_permission`
  22. </sql>
  23. <sql id="dynamicWhereConditions">
  24. where 1 = 1
  25. <if test=" null != id ">
  26. and `id` = #{id}
  27. </if>
  28. <if test=" null != tenantId ">
  29. and `tenant_id` = #{tenantId}
  30. </if>
  31. <if test=" null != username ">
  32. and `username` like concat('%', #{username},'%')
  33. </if>
  34. <if test=" null != nickName ">
  35. and `nick_name` like concat('%', #{nickName},'%')
  36. </if>
  37. <if test=" null != name ">
  38. and `name` like concat('%', #{name},'%')
  39. </if>
  40. <if test=" null != password ">
  41. and `password` like concat('%', #{password},'%')
  42. </if>
  43. <if test=" null != createTime ">
  44. and `create_time` = #{createTime}
  45. </if>
  46. <if test=" null != lastLoginTime ">
  47. and `last_login_time` = #{lastLoginTime}
  48. </if>
  49. <if test=" null != status ">
  50. and `status` = #{status}
  51. </if>
  52. <if test=" null != isAdmin ">
  53. and `is_admin` = #{isAdmin}
  54. </if>
  55. <if test=" null != phone ">
  56. and `phone` = #{phone}
  57. </if>
  58. <if test=" null != bopenId ">
  59. and `bopen_id` = #{bopenId}
  60. </if>
  61. <if test=" null != webOpenId ">
  62. and `web_open_id` = #{webOpenId}
  63. </if>
  64. <if test=" null != flowPermission ">
  65. and JSON_CONTAINS(flow_permission->'$[*]', #{flowPermission}, '$')
  66. </if>
  67. <if test=" null != ids ">
  68. and id in
  69. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  70. #{idItem}
  71. </foreach>
  72. </if>
  73. <if test=" null != sortColumns">order by ${sortColumns}</if>
  74. </sql>
  75. <select id="findList" parameterType="com.iformall.domain.po.MallUserInfo" resultMap="BaseResultMap">
  76. select
  77. <include refid="allColumns"/>
  78. from mall_user_info
  79. <include refid="dynamicWhereConditions"/>
  80. </select>
  81. <select id="selectByUserName" resultMap="BaseResultMap">
  82. select
  83. <include refid="allColumns"/>
  84. from mall_user_info
  85. where 1=1
  86. <if test=" null != username ">
  87. and username=#{username}
  88. </if>
  89. </select>
  90. <select id="selectByBOpenId" resultMap="BaseResultMap">
  91. select
  92. <include refid="allColumns"/>
  93. from mall_user_info
  94. where 1=1
  95. <if test=" null != tenantId ">
  96. and `tenant_id`=#{tenantId}
  97. </if>
  98. <if test=" null != bopenId ">
  99. and `bopen_id`=#{bopenId}
  100. </if>
  101. </select>
  102. <select id="selectByWebOpenId" resultMap="BaseResultMap">
  103. select
  104. <include refid="allColumns"/>
  105. from mall_user_info
  106. where 1=1
  107. <if test=" null != webOpenId ">
  108. and `web_open_id`=#{webOpenId}
  109. </if>
  110. </select>
  111. <select id="selectByPhone" resultMap="BaseResultMap">
  112. select
  113. <include refid="allColumns"/>
  114. from mall_user_info
  115. where 1=1
  116. <if test=" null != tenantId ">
  117. and `tenant_id`=#{tenantId}
  118. </if>
  119. <if test=" null != phone ">
  120. and `phone`=#{phone}
  121. </if>
  122. </select>
  123. <select id="hasButtonPermission" resultType="java.lang.Integer">
  124. SELECT 1
  125. FROM mall_user_role ur, mall_user_role_permission rp, mall_permission p
  126. WHERE rp.role_id = ur.role_id
  127. AND rp.permission_id = p.id
  128. AND p.resource_type = 1
  129. AND ur.uid = #{userId}
  130. AND p.permission = #{permission}
  131. </select>
  132. <select id="cntByUserName" resultType="java.lang.Long">
  133. select count(*) from mall_user_info where 1=1
  134. <if test=" null != username ">
  135. and username=#{username}
  136. </if>
  137. <if test=" null != phone ">
  138. and `phone` = #{phone}
  139. </if>
  140. <if test=" null != id ">
  141. and `id` != #{id}
  142. </if>
  143. </select>
  144. </mapper>