mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
125 lines
4.6 KiB
XML
125 lines
4.6 KiB
XML
<?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.tencent.supersonic.auth.authentication.persistence.mapper.UserDOMapper">
|
|
<resultMap id="BaseResultMap" type="com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDO">
|
|
<result column="id" jdbcType="BIGINT" property="id" />
|
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
|
<result column="password" jdbcType="VARCHAR" property="password" />
|
|
<result column="salt" jdbcType="VARCHAR" property="salt" />
|
|
<result column="display_name" jdbcType="VARCHAR" property="displayName" />
|
|
<result column="email" jdbcType="VARCHAR" property="email" />
|
|
<result column="is_admin" jdbcType="INTEGER" property="isAdmin" />
|
|
</resultMap>
|
|
<sql id="Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Base_Column_List">
|
|
id, name, password, salt, display_name, email, is_admin
|
|
</sql>
|
|
<select id="selectByExample" parameterType="com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDOExample" resultMap="BaseResultMap">
|
|
select
|
|
<if test="distinct">
|
|
distinct
|
|
</if>
|
|
<include refid="Base_Column_List" />
|
|
from s2_user
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
<if test="orderByClause != null">
|
|
order by ${orderByClause}
|
|
</if>
|
|
<if test="limitStart != null and limitStart>=0">
|
|
limit #{limitStart} , #{limitEnd}
|
|
</if>
|
|
</select>
|
|
<insert id="insert" parameterType="com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDO">
|
|
insert into s2_user (id, name, password, salt,
|
|
display_name, email, is_admin
|
|
)
|
|
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR},
|
|
#{displayName,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{isAdmin,jdbcType=INTEGER}
|
|
)
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDO">
|
|
insert into s2_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="name != null">
|
|
name,
|
|
</if>
|
|
<if test="password != null">
|
|
password,
|
|
</if>
|
|
<if test="password != null">
|
|
salt,
|
|
</if>
|
|
<if test="displayName != null">
|
|
display_name,
|
|
</if>
|
|
<if test="email != null">
|
|
email,
|
|
</if>
|
|
<if test="isAdmin != null">
|
|
is_admin,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="name != null">
|
|
#{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="password != null">
|
|
#{password,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="salt != null">
|
|
#{salt,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="displayName != null">
|
|
#{displayName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="email != null">
|
|
#{email,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isAdmin != null">
|
|
#{isAdmin,jdbcType=INTEGER},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<select id="countByExample" parameterType="com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDOExample" resultType="java.lang.Long">
|
|
select count(*) from s2_user
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
</select>
|
|
</mapper> |