|
- <?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.tuoheng.mapper.ClientUserMapper">
-
- <insert id="insertClientUser" parameterType="com.tuoheng.model.po.UserPo" keyProperty="id" useGeneratedKeys="true">
- insert into users (username, password, create_user, tenant_id, is_tenant, role_id)
- values (#{username}, #{password}, #{createUser}, #{tenantId}, #{isTenant}, #{roleId})
- </insert>
-
- <select id="judgeCreateByUserName" parameterType="java.lang.String" resultType="int">
- select count(1)
- from users
- where username = #{username}
- and enabled = 1
- </select>
-
- <select id="getUserByUserName" parameterType="java.lang.String" resultType="com.tuoheng.model.po.UserPo">
- select *
- from users
- where username = #{username}
- and enabled = 1
- </select>
- <select id="getUserRoleIdByUserName" parameterType="java.lang.String" resultType="int">
- select role_id
- from users
- where username = #{username}
- and enabled = 1
- </select>
- <select id="selectByUserId" resultType="com.tuoheng.model.po.UserPo">
- SELECT id,
- username,
- `password`,
- enabled,
- tenant_id,
- is_tenant,
- role_id,
- is_expire,
- is_able
- FROM users
- WHERE id = #{userId}
- </select>
- <select id="selectByTenantId" resultType="com.tuoheng.model.po.UserPo">
- SELECT *
- FROM users
- WHERE tenant_id = #{tenantId}
- # 用户没有被删除
- and enabled = 1
- </select>
- <select id="selectByTenantIdAndPage" resultType="com.tuoheng.model.vo.UserVo">
- SELECT
- u.username,
- u.create_time,
- u.update_time,
- a.authority platformCode
- FROM
- users u,
- authorities a
- WHERE
- u.tenant_id = #{query.tenantId}
- <if test="query.username != null and query.username != ''">
- and u.username LIKE concat('%',#{query.username},'%')
- </if>
- <if test="query.platformCode != null and query.platformCode != ''">
- and a.authority LIKE concat('%',#{query.platformCode},'%')
- </if>
- AND a.user_id = u.id
- AND u.enabled = 1
- GROUP BY u.username
- </select>
- <select id="getUserByRoleId" resultType="com.tuoheng.model.po.UserPo">
- SELECT *
- FROM users
- WHERE role_id = #{roleId}
- # 用户没有被删除
- and enabled = 1
- </select>
-
- <update id="updatePass" parameterType="com.tuoheng.model.po.UserPo">
- update users
- <set>
- <if test="password != null and password != ''">
- password = #{password},
- </if>
- <if test="updateUser != null">
- update_user = #{updateUser},
- </if>
- <if test="enabled != null">
- enabled = #{enabled},
- </if>
- <if test="isAble != null">
- is_able = #{isAble},
- </if>
- <if test="isExpire != null">
- is_expire = #{isExpire},
- </if>
- </set>
- where username = #{username,jdbcType=VARCHAR}
- </update>
-
-
- </mapper>
|