201 lines
7.0 KiB
XML
201 lines
7.0 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="cn.wepact.dfm.training.mapper.TUserMapper">
|
|
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TUser">
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
<result column="username" jdbcType="VARCHAR" property="username" />
|
|
<result column="password" jdbcType="VARCHAR" property="password" />
|
|
<result column="user_avatar" jdbcType="VARCHAR" property="userAvatar" />
|
|
<result column="email" jdbcType="VARCHAR" property="email" />
|
|
<result column="user_no" jdbcType="INTEGER" property="userNo" />
|
|
<result column="show_tip" jdbcType="VARCHAR" property="showTip" />
|
|
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
|
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
|
|
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
|
|
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, username, `password`, user_avatar, user_no, show_tip, updated_at, updated_by, created_at,
|
|
created_by, del_flag, email
|
|
</sql>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from t_user
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
|
delete from t_user
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</delete>
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TUser" useGeneratedKeys="true">
|
|
insert into t_user (username, `password`, user_avatar,
|
|
user_no, updated_at, updated_by,
|
|
created_at, created_by, del_flag
|
|
)
|
|
values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{userAvatar,jdbcType=VARCHAR},
|
|
#{userNo,jdbcType=INTEGER}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR},
|
|
#{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR}
|
|
)
|
|
</insert>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TUser" useGeneratedKeys="true">
|
|
insert into t_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="username != null">
|
|
username,
|
|
</if>
|
|
<if test="password != null">
|
|
`password`,
|
|
</if>
|
|
<if test="userAvatar != null">
|
|
user_avatar,
|
|
</if>
|
|
<if test="userNo != null">
|
|
user_no,
|
|
</if>
|
|
<if test="email != null">
|
|
email,
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
updated_at,
|
|
</if>
|
|
<if test="updatedBy != null">
|
|
updated_by,
|
|
</if>
|
|
<if test="createdAt != null">
|
|
created_at,
|
|
</if>
|
|
<if test="createdBy != null">
|
|
created_by,
|
|
</if>
|
|
<if test="delFlag != null">
|
|
del_flag,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="username != null">
|
|
#{username,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="password != null">
|
|
#{password,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userAvatar != null">
|
|
#{userAvatar,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userNo != null">
|
|
#{userNo,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="email != null">
|
|
#{email,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
#{updatedAt,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updatedBy != null">
|
|
#{updatedBy,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createdAt != null">
|
|
#{createdAt,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="createdBy != null">
|
|
#{createdBy,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="delFlag != null">
|
|
#{delFlag,jdbcType=VARCHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TUser">
|
|
update t_user
|
|
<set>
|
|
<if test="username != null">
|
|
username = #{username,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="password != null">
|
|
`password` = #{password,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userAvatar != null">
|
|
user_avatar = #{userAvatar,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="email != null">
|
|
email = #{email,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userNo != null">
|
|
user_no = #{userNo,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="showTip != null">
|
|
show_tip = #{showTip,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updatedBy != null">
|
|
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createdAt != null">
|
|
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="createdBy != null">
|
|
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="delFlag != null">
|
|
del_flag = #{delFlag,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TUser">
|
|
update t_user
|
|
set username = #{username,jdbcType=VARCHAR},
|
|
`password` = #{password,jdbcType=VARCHAR},
|
|
user_avatar = #{userAvatar,jdbcType=VARCHAR},
|
|
user_no = #{userNo,jdbcType=INTEGER},
|
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
del_flag = #{delFlag,jdbcType=VARCHAR}
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</update>
|
|
|
|
<!-- 根据用户名查询用户信息 -->
|
|
<select id="selectByUserNo" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
SELECT <include refid="Base_Column_List" />
|
|
FROM t_user
|
|
WHERE user_no = #{userNo}
|
|
and del_flag='0'
|
|
</select>
|
|
<select id="selectByConditions" resultType="cn.wepact.dfm.training.dto.entity.TUser">
|
|
SELECT
|
|
a.user_no as userNo,
|
|
a.show_tip as showTip,
|
|
a.username,
|
|
a.`password`,
|
|
a.id,
|
|
b.user_type as userType,
|
|
b.pre_type as preType,
|
|
b.org_code as `orgCode`,
|
|
a.email
|
|
FROM t_user a,
|
|
t_user_permission b
|
|
WHERE
|
|
a.id = b.user_id
|
|
and a.user_no = #{userNo}
|
|
and b.org_code = #{orgCode}
|
|
and a.del_flag = '0'
|
|
and b.del_flag ='0'
|
|
</select>
|
|
|
|
<select id="findUserIdByUsername" resultType="java.lang.Long">
|
|
SELECT id FROM t_user WHERE user_no = #{username}
|
|
</select>
|
|
|
|
<select id="batchFindUserIdByUsernames" resultType="cn.wepact.dfm.training.dto.entity.TUser">
|
|
SELECT id, user_no AS userNo FROM t_user WHERE user_no IN
|
|
<foreach collection="usernames" item="username" open="(" separator="," close=")">
|
|
#{username}
|
|
</foreach>
|
|
</select>
|
|
</mapper>
|