|
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.iformall.mapper.MallUserInfoMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.MallUserInfo">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="username" jdbcType="VARCHAR" property="username"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="password" jdbcType="VARCHAR" property="password"/>
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/>
- <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
- <result column="phone" jdbcType="VARCHAR" property="phone"/>
- <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/>
- <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/>
- <result column="flow_permission" property="flowPermission"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`bopen_id`,`web_open_id`,`flow_permission`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != tenantId ">
- and `tenant_id` = #{tenantId}
- </if>
-
- <if test=" null != username ">
- and `username` like concat('%', #{username},'%')
- </if>
-
- <if test=" null != nickName ">
- and `nick_name` like concat('%', #{nickName},'%')
- </if>
-
- <if test=" null != name ">
- and `name` like concat('%', #{name},'%')
- </if>
-
- <if test=" null != password ">
- and `password` like concat('%', #{password},'%')
- </if>
-
- <if test=" null != createTime ">
- and `create_time` = #{createTime}
- </if>
-
- <if test=" null != lastLoginTime ">
- and `last_login_time` = #{lastLoginTime}
- </if>
-
- <if test=" null != status ">
- and `status` = #{status}
- </if>
-
- <if test=" null != isAdmin ">
- and `is_admin` = #{isAdmin}
- </if>
- <if test=" null != phone ">
- and `phone` = #{phone}
- </if>
- <if test=" null != bopenId ">
- and `bopen_id` = #{bopenId}
- </if>
- <if test=" null != webOpenId ">
- and `web_open_id` = #{webOpenId}
- </if>
- <if test=" null != flowPermission ">
- and JSON_CONTAINS(flow_permission->'$[*]', #{flowPermission}, '$')
- </if>
-
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.MallUserInfo" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_user_info
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectByUserName" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_user_info
- where 1=1
- <if test=" null != username ">
- and username=#{username}
- </if>
- </select>
-
- <select id="selectByBOpenId" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_user_info
- where 1=1
- <if test=" null != tenantId ">
- and `tenant_id`=#{tenantId}
- </if>
- <if test=" null != bopenId ">
- and `bopen_id`=#{bopenId}
- </if>
- </select>
-
- <select id="selectByWebOpenId" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_user_info
- where 1=1
- <if test=" null != webOpenId ">
- and `web_open_id`=#{webOpenId}
- </if>
- </select>
-
- <select id="selectByPhone" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_user_info
- where 1=1
- <if test=" null != tenantId ">
- and `tenant_id`=#{tenantId}
- </if>
- <if test=" null != phone ">
- and `phone`=#{phone}
- </if>
- </select>
-
- <select id="hasButtonPermission" resultType="java.lang.Integer">
- SELECT 1
- FROM mall_user_role ur, mall_user_role_permission rp, mall_permission p
- WHERE rp.role_id = ur.role_id
- AND rp.permission_id = p.id
- AND p.resource_type = 1
- AND ur.uid = #{userId}
- AND p.permission = #{permission}
- </select>
-
- <select id="cntByUserName" resultType="java.lang.Long">
- select count(*) from mall_user_info where 1=1
- <if test=" null != username ">
- and username=#{username}
- </if>
- <if test=" null != phone ">
- and `phone` = #{phone}
- </if>
- <if test=" null != id ">
- and `id` != #{id}
- </if>
- </select>
-
- </mapper>
|