Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

96 wiersze
2.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.simple.mapper.MallUserInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.simple.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. </resultMap>
  15. <sql id="allColumns">
  16. `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`
  17. </sql>
  18. <sql id="dynamicWhereConditions">
  19. where 1 = 1
  20. <if test=" null != id ">
  21. and `id` = #{id}
  22. </if>
  23. <if test=" null != tenantId ">
  24. and `tenant_id` like concat('%', #{tenantId},'%')
  25. </if>
  26. <if test=" null != username ">
  27. and `username` like concat('%', #{username},'%')
  28. </if>
  29. <if test=" null != name ">
  30. and `name` like concat('%', #{name},'%')
  31. </if>
  32. <if test=" null != password ">
  33. and `password` like concat('%', #{password},'%')
  34. </if>
  35. <if test=" null != createTime ">
  36. and `create_time` = #{createTime}
  37. </if>
  38. <if test=" null != lastLoginTime ">
  39. and `last_login_time` = #{lastLoginTime}
  40. </if>
  41. <if test=" null != status ">
  42. and `status` = #{status}
  43. </if>
  44. <if test=" null != isAdmin ">
  45. and `is_admin` = #{isAdmin}
  46. </if>
  47. <if test=" null != ids ">
  48. and id in
  49. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  50. #{idItem}
  51. </foreach>
  52. </if>
  53. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  54. </sql>
  55. <select id="findList" parameterType="com.simple.domain.po.MallUserInfo" resultMap="BaseResultMap">
  56. select <include refid="allColumns" /> from mall_user_info
  57. <include refid="dynamicWhereConditions" />
  58. </select>
  59. <select id="hasButtonPermission" resultType="java.lang.Integer">
  60. SELECT 1
  61. FROM mall_user_role ur, mall_user_role_permission rp, mall_permission p
  62. WHERE rp.role_id = ur.role_id
  63. AND rp.permission_id = p.id
  64. AND p.resource_type = 1
  65. AND ur.uid = #{userId}
  66. AND p.permission = #{permission}
  67. </select>
  68. </mapper>