pet/com.datang.pet.mapper/target/classes/mapper/UserAttentionRecordMapper.xml

196 lines
7.2 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.datang.pet.mapper.UserAttentionRecordMapper">
<resultMap id="BaseResultMap" type="com.datang.pet.pojo.UserAttentionRecord">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="fans_id" jdbcType="VARCHAR" property="fansId" />
<result column="attention_date" jdbcType="TIMESTAMP" property="attentionDate" />
</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="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.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, user_id, fans_id, attention_date
</sql>
<select id="selectByExample" parameterType="com.datang.pet.pojo.UserAttentionRecordExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user_attention_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_attention_record
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from user_attention_record
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.datang.pet.pojo.UserAttentionRecordExample">
delete from user_attention_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.datang.pet.pojo.UserAttentionRecord">
insert into user_attention_record (id, user_id, fans_id,
attention_date)
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{fansId,jdbcType=VARCHAR},
#{attentionDate,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.datang.pet.pojo.UserAttentionRecord">
insert into user_attention_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="fansId != null">
fans_id,
</if>
<if test="attentionDate != null">
attention_date,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="fansId != null">
#{fansId,jdbcType=VARCHAR},
</if>
<if test="attentionDate != null">
#{attentionDate,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.datang.pet.pojo.UserAttentionRecordExample" resultType="java.lang.Long">
select count(*) from user_attention_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user_attention_record
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.fansId != null">
fans_id = #{record.fansId,jdbcType=VARCHAR},
</if>
<if test="record.attentionDate != null">
attention_date = #{record.attentionDate,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update user_attention_record
set id = #{record.id,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
fans_id = #{record.fansId,jdbcType=VARCHAR},
attention_date = #{record.attentionDate,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.datang.pet.pojo.UserAttentionRecord">
update user_attention_record
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="fansId != null">
fans_id = #{fansId,jdbcType=VARCHAR},
</if>
<if test="attentionDate != null">
attention_date = #{attentionDate,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.datang.pet.pojo.UserAttentionRecord">
update user_attention_record
set user_id = #{userId,jdbcType=VARCHAR},
fans_id = #{fansId,jdbcType=VARCHAR},
attention_date = #{attentionDate,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>