147 lines
5.3 KiB
XML
147 lines
5.3 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.lovenav.mapper.UserDao">
|
|
<resultMap id="BaseResultMap" type="com.lovenav.entity.User">
|
|
<id column="id" jdbcType="INTEGER" property="id" />
|
|
<result column="user_login" jdbcType="VARCHAR" property="userLogin" />
|
|
<result column="user_password" jdbcType="VARCHAR" property="userPassword" />
|
|
<result column="phone" jdbcType="BIGINT" property="phone" />
|
|
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
|
|
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
|
|
<result column="user_email" jdbcType="VARCHAR" property="userEmail" />
|
|
<result column="user_status" jdbcType="TINYINT" property="userStatus" />
|
|
<result column="user_registered" jdbcType="TIMESTAMP" property="userRegistered" />
|
|
<result column="role_id" jdbcType="TINYINT" property="roleId" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, user_login, user_password, phone, avatar, nickname, user_email, user_status,
|
|
user_registered, role_id
|
|
</sql>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from ln_user
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
delete from ln_user
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.User" useGeneratedKeys="true">
|
|
insert into ln_user (user_login, user_password, phone,
|
|
avatar, nickname, user_email,
|
|
user_status, user_registered, role_id
|
|
)
|
|
values (#{userLogin,jdbcType=VARCHAR}, #{userPassword,jdbcType=VARCHAR}, #{phone,jdbcType=BIGINT},
|
|
#{avatar,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, #{userEmail,jdbcType=VARCHAR},
|
|
#{userStatus,jdbcType=TINYINT}, #{userRegistered,jdbcType=TIMESTAMP}, #{roleId,jdbcType=TINYINT}
|
|
)
|
|
</insert>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.User" useGeneratedKeys="true">
|
|
insert into ln_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userLogin != null">
|
|
user_login,
|
|
</if>
|
|
<if test="userPassword != null">
|
|
user_password,
|
|
</if>
|
|
<if test="phone != null">
|
|
phone,
|
|
</if>
|
|
<if test="avatar != null">
|
|
avatar,
|
|
</if>
|
|
<if test="nickname != null">
|
|
nickname,
|
|
</if>
|
|
<if test="userEmail != null">
|
|
user_email,
|
|
</if>
|
|
<if test="userStatus != null">
|
|
user_status,
|
|
</if>
|
|
<if test="userRegistered != null">
|
|
user_registered,
|
|
</if>
|
|
<if test="roleId != null">
|
|
role_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userLogin != null">
|
|
#{userLogin,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userPassword != null">
|
|
#{userPassword,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="phone != null">
|
|
#{phone,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="avatar != null">
|
|
#{avatar,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="nickname != null">
|
|
#{nickname,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userEmail != null">
|
|
#{userEmail,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userStatus != null">
|
|
#{userStatus,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="userRegistered != null">
|
|
#{userRegistered,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="roleId != null">
|
|
#{roleId,jdbcType=TINYINT},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.lovenav.entity.User">
|
|
update ln_user
|
|
<set>
|
|
<if test="userLogin != null">
|
|
user_login = #{userLogin,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userPassword != null">
|
|
user_password = #{userPassword,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="phone != null">
|
|
phone = #{phone,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="avatar != null">
|
|
avatar = #{avatar,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="nickname != null">
|
|
nickname = #{nickname,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userEmail != null">
|
|
user_email = #{userEmail,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userStatus != null">
|
|
user_status = #{userStatus,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="userRegistered != null">
|
|
user_registered = #{userRegistered,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="roleId != null">
|
|
role_id = #{roleId,jdbcType=TINYINT},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.lovenav.entity.User">
|
|
update ln_user
|
|
set user_login = #{userLogin,jdbcType=VARCHAR},
|
|
user_password = #{userPassword,jdbcType=VARCHAR},
|
|
phone = #{phone,jdbcType=BIGINT},
|
|
avatar = #{avatar,jdbcType=VARCHAR},
|
|
nickname = #{nickname,jdbcType=VARCHAR},
|
|
user_email = #{userEmail,jdbcType=VARCHAR},
|
|
user_status = #{userStatus,jdbcType=TINYINT},
|
|
user_registered = #{userRegistered,jdbcType=TIMESTAMP},
|
|
role_id = #{roleId,jdbcType=TINYINT}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
</mapper> |