196 lines
6.7 KiB
XML
196 lines
6.7 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.LabelMapper">
|
|
<resultMap id="BaseResultMap" type="com.datang.pet.pojo.Label">
|
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
|
<result column="content" jdbcType="VARCHAR" property="content" />
|
|
<result column="date" jdbcType="TIMESTAMP" property="date" />
|
|
</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, content, date
|
|
</sql>
|
|
<select id="selectByExample" parameterType="com.datang.pet.pojo.LabelExample" resultMap="BaseResultMap">
|
|
select
|
|
<if test="distinct">
|
|
distinct
|
|
</if>
|
|
<include refid="Base_Column_List" />
|
|
from label
|
|
<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 label
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
delete from label
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
</delete>
|
|
<delete id="deleteByExample" parameterType="com.datang.pet.pojo.LabelExample">
|
|
delete from label
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
</delete>
|
|
<insert id="insert" parameterType="com.datang.pet.pojo.Label">
|
|
insert into label (id, user_id, content,
|
|
date)
|
|
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
|
|
#{date,jdbcType=TIMESTAMP})
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.datang.pet.pojo.Label">
|
|
insert into label
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="userId != null">
|
|
user_id,
|
|
</if>
|
|
<if test="content != null">
|
|
content,
|
|
</if>
|
|
<if test="date != null">
|
|
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="content != null">
|
|
#{content,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="date != null">
|
|
#{date,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<select id="countByExample" parameterType="com.datang.pet.pojo.LabelExample" resultType="java.lang.Long">
|
|
select count(*) from label
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
</select>
|
|
<update id="updateByExampleSelective" parameterType="map">
|
|
update label
|
|
<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.content != null">
|
|
content = #{record.content,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.date != null">
|
|
date = #{record.date,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</set>
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
</if>
|
|
</update>
|
|
<update id="updateByExample" parameterType="map">
|
|
update label
|
|
set id = #{record.id,jdbcType=VARCHAR},
|
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
|
content = #{record.content,jdbcType=VARCHAR},
|
|
date = #{record.date,jdbcType=TIMESTAMP}
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
</if>
|
|
</update>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.datang.pet.pojo.Label">
|
|
update label
|
|
<set>
|
|
<if test="userId != null">
|
|
user_id = #{userId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="content != null">
|
|
content = #{content,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="date != null">
|
|
date = #{date,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.datang.pet.pojo.Label">
|
|
update label
|
|
set user_id = #{userId,jdbcType=VARCHAR},
|
|
content = #{content,jdbcType=VARCHAR},
|
|
date = #{date,jdbcType=TIMESTAMP}
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
</update>
|
|
</mapper> |