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

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