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

188 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.ChatMapper">
<resultMap id="BaseResultMap" type="com.datang.pet.pojo.Chat">
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="sender_id" jdbcType="VARCHAR" property="senderId" />
<result column="consignee_id" jdbcType="VARCHAR" property="consigneeId" />
<result column="message" jdbcType="VARCHAR" property="message" />
<result column="message_date" jdbcType="TIMESTAMP" property="messageDate" />
<result column="is_read" jdbcType="CHAR" property="isRead" />
</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, sender_id, consignee_id, message, message_date, is_read
</sql>
<select id="selectByExample" parameterType="com.datang.pet.pojo.ChatExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from chat
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="com.datang.pet.pojo.ChatExample">
delete from chat
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.datang.pet.pojo.Chat">
insert into chat (id, sender_id, consignee_id,
message, message_date, is_read
)
values (#{id,jdbcType=VARCHAR}, #{senderId,jdbcType=VARCHAR}, #{consigneeId,jdbcType=VARCHAR},
#{message,jdbcType=VARCHAR}, #{messageDate,jdbcType=TIMESTAMP}, #{isRead,jdbcType=CHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.datang.pet.pojo.Chat">
insert into chat
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="senderId != null">
sender_id,
</if>
<if test="consigneeId != null">
consignee_id,
</if>
<if test="message != null">
message,
</if>
<if test="messageDate != null">
message_date,
</if>
<if test="isRead != null">
is_read,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="senderId != null">
#{senderId,jdbcType=VARCHAR},
</if>
<if test="consigneeId != null">
#{consigneeId,jdbcType=VARCHAR},
</if>
<if test="message != null">
#{message,jdbcType=VARCHAR},
</if>
<if test="messageDate != null">
#{messageDate,jdbcType=TIMESTAMP},
</if>
<if test="isRead != null">
#{isRead,jdbcType=CHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.datang.pet.pojo.ChatExample" resultType="java.lang.Long">
select count(*) from chat
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update chat
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.senderId != null">
sender_id = #{record.senderId,jdbcType=VARCHAR},
</if>
<if test="record.consigneeId != null">
consignee_id = #{record.consigneeId,jdbcType=VARCHAR},
</if>
<if test="record.message != null">
message = #{record.message,jdbcType=VARCHAR},
</if>
<if test="record.messageDate != null">
message_date = #{record.messageDate,jdbcType=TIMESTAMP},
</if>
<if test="record.isRead != null">
is_read = #{record.isRead,jdbcType=CHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update chat
set id = #{record.id,jdbcType=VARCHAR},
sender_id = #{record.senderId,jdbcType=VARCHAR},
consignee_id = #{record.consigneeId,jdbcType=VARCHAR},
message = #{record.message,jdbcType=VARCHAR},
message_date = #{record.messageDate,jdbcType=TIMESTAMP},
is_read = #{record.isRead,jdbcType=CHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>