UserBaseMapper.xml 1.48 KB
<?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.yoho.unions.dal.IUserBaseDAO">
	<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UserBase">
		<id column="uid" property="uid" jdbcType="INTEGER" />
		<result column="username" property="username" jdbcType="VARCHAR" />
		<result column="nickname" property="nickname" jdbcType="VARCHAR" />
		<result column="gender" property="gender" jdbcType="CHAR" />
		<result column="birthday" property="birthday" jdbcType="DATE" />
		<result column="char_id" property="charId" jdbcType="VARCHAR" />
		<result column="head_ico" property="headIco" jdbcType="VARCHAR" />
		<result column="income" property="income" jdbcType="TINYINT" />
		<result column="profession" property="profession" jdbcType="TINYINT" />
	</resultMap>
	<sql id="Base_Column_List">
		uid, username, nickname, gender, (case birthday when '0000-00-00' then '1900-01-01' else birthday end) birthday, char_id, head_ico, income,
		profession
	</sql>
	
	<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from user_base
		where uid = #{uid,jdbcType=INTEGER}
	</select>

	<update id="updateBaseInfo" parameterType="com.yoho.unions.dal.model.UserBase">
		update user_base
		set gender = #{gender,jdbcType=CHAR}, birthday=#{birthday}
		where uid = #{uid,jdbcType=INTEGER}
	</update>
</mapper>