rt-sim-training-service/src/main/resources/mybatis/mapper/LearnMessageDAO.xml

329 lines
12 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="club.joylink.rtss.dao.LearnMessageDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.LearnMessage">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="post_id" jdbcType="BIGINT" property="postId" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="picture_urls" jdbcType="VARCHAR" property="pictureUrls" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="topping" jdbcType="BIT" property="topping" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.LearnMessageWithBLOBs">
<result column="like" jdbcType="LONGVARCHAR" property="like" />
<result column="unlike" jdbcType="LONGVARCHAR" property="unlike" />
</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, post_id, content, picture_urls, creator_id, create_time, topping
</sql>
<sql id="Blob_Column_List">
`like`, unlike
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.LearnMessageExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from learn_message
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.LearnMessageExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from learn_message
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from learn_message
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from learn_message
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.LearnMessageExample">
delete from learn_message
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.LearnMessageWithBLOBs" useGeneratedKeys="true">
insert into learn_message (post_id, content, picture_urls,
creator_id, create_time, topping,
`like`, unlike)
values (#{postId,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{pictureUrls,jdbcType=VARCHAR},
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{topping,jdbcType=BIT},
#{like,jdbcType=LONGVARCHAR}, #{unlike,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.LearnMessageWithBLOBs" useGeneratedKeys="true">
insert into learn_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="postId != null">
post_id,
</if>
<if test="content != null">
content,
</if>
<if test="pictureUrls != null">
picture_urls,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="topping != null">
topping,
</if>
<if test="like != null">
`like`,
</if>
<if test="unlike != null">
unlike,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="postId != null">
#{postId,jdbcType=BIGINT},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="pictureUrls != null">
#{pictureUrls,jdbcType=VARCHAR},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="topping != null">
#{topping,jdbcType=BIT},
</if>
<if test="like != null">
#{like,jdbcType=LONGVARCHAR},
</if>
<if test="unlike != null">
#{unlike,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.LearnMessageExample" resultType="java.lang.Long">
select count(*) from learn_message
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update learn_message
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.postId != null">
post_id = #{record.postId,jdbcType=BIGINT},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.pictureUrls != null">
picture_urls = #{record.pictureUrls,jdbcType=VARCHAR},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.topping != null">
topping = #{record.topping,jdbcType=BIT},
</if>
<if test="record.like != null">
`like` = #{record.like,jdbcType=LONGVARCHAR},
</if>
<if test="record.unlike != null">
unlike = #{record.unlike,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update learn_message
set id = #{record.id,jdbcType=BIGINT},
post_id = #{record.postId,jdbcType=BIGINT},
content = #{record.content,jdbcType=VARCHAR},
picture_urls = #{record.pictureUrls,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
topping = #{record.topping,jdbcType=BIT},
`like` = #{record.like,jdbcType=LONGVARCHAR},
unlike = #{record.unlike,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update learn_message
set id = #{record.id,jdbcType=BIGINT},
post_id = #{record.postId,jdbcType=BIGINT},
content = #{record.content,jdbcType=VARCHAR},
picture_urls = #{record.pictureUrls,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
topping = #{record.topping,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.LearnMessageWithBLOBs">
update learn_message
<set>
<if test="postId != null">
post_id = #{postId,jdbcType=BIGINT},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="pictureUrls != null">
picture_urls = #{pictureUrls,jdbcType=VARCHAR},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="topping != null">
topping = #{topping,jdbcType=BIT},
</if>
<if test="like != null">
`like` = #{like,jdbcType=LONGVARCHAR},
</if>
<if test="unlike != null">
unlike = #{unlike,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.LearnMessageWithBLOBs">
update learn_message
set post_id = #{postId,jdbcType=BIGINT},
content = #{content,jdbcType=VARCHAR},
picture_urls = #{pictureUrls,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
topping = #{topping,jdbcType=BIT},
`like` = #{like,jdbcType=LONGVARCHAR},
unlike = #{unlike,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.LearnMessage">
update learn_message
set post_id = #{postId,jdbcType=BIGINT},
content = #{content,jdbcType=VARCHAR},
picture_urls = #{pictureUrls,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
topping = #{topping,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>