Authored by Amos_sdy

userOpenidMapper

<?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.message.dal.IUserOpenidDAO">
<resultMap id="BaseResultMap" type="com.yoho.message.dal.model.UserOpenid">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="open_id" property="openId" jdbcType="VARCHAR" />
<result column="refer_id" property="referId" jdbcType="SMALLINT" />
<result column="bind_time" property="bindTime" jdbcType="INTEGER" />
<result column="share_bind" property="shareBind" jdbcType="CHAR" />
<result column="nickname" property="nickname" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, uid, open_id, refer_id, bind_time, share_bind, nickname
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from user_openid
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectOpenUserByOpenAndRefer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_openid
where open_id=#{0} and refer_id=#{1} limit 1
</select>
<select id="selectByUid" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from user_openid
where uid = #{uid,jdbcType=INTEGER}
</select>
<select id="selectOpenUserByUidAndRefer" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from user_openid
where uid=#{0} and refer_id=#{1} limit 1
</select>
<insert id="insert" parameterType="com.yoho.wechat.dal.model.UserOpenid">
insert into user_openid (uid, open_id,
refer_id, bind_time,
nickname)
values (#{uid,jdbcType=INTEGER},
#{openId,jdbcType=VARCHAR},
#{referId,jdbcType=SMALLINT}, #{bindTime,jdbcType=INTEGER},
#{nickname,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.yoho.wechat.dal.model.UserOpenid">
insert into user_openid
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="uid != null">
uid,
</if>
<if test="openId != null">
open_id,
</if>
<if test="referId != null">
refer_id,
</if>
<if test="bindTime != null">
bind_time,
</if>
<if test="shareBind != null">
share_bind,
</if>
<if test="nickname != null">
nickname,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="openId != null">
#{openId,jdbcType=VARCHAR},
</if>
<if test="referId != null">
#{referId,jdbcType=SMALLINT},
</if>
<if test="bindTime != null">
#{bindTime,jdbcType=INTEGER},
</if>
<if test="shareBind != null">
#{shareBind,jdbcType=CHAR},
</if>
<if test="nickname != null">
#{nickname,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.wechat.dal.model.UserOpenid">
update user_openid
<set>
<if test="uid != null">
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="openId != null">
open_id = #{openId,jdbcType=VARCHAR},
</if>
<if test="referId != null">
refer_id = #{referId,jdbcType=SMALLINT},
</if>
<if test="bindTime != null">
bind_time = #{bindTime,jdbcType=INTEGER},
</if>
<if test="shareBind != null">
share_bind = #{shareBind,jdbcType=CHAR},
</if>
<if test="nickname != null">
nickname = #{nickname,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.wechat.dal.model.UserOpenid">
update user_openid
set uid = #{uid,jdbcType=INTEGER},
open_id = #{openId,jdbcType=VARCHAR},
refer_id = #{referId,jdbcType=SMALLINT},
bind_time = #{bindTime,jdbcType=INTEGER},
share_bind = #{shareBind,jdbcType=CHAR},
nickname = #{nickname,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateUserOpenID">
update user_openid set
open_id = #{0}
where open_id = #{1}
</update>
<update id="updateUserOpenIDByUid" parameterType="com.yoho.wechat.dal.model.UserOpenid">
update user_openid set open_id=#{openId} where uid=#{uid} and refer_id=#{referId}
</update>
</mapper>
\ No newline at end of file
... ...