<?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.mzl.flower.mapper.film.CommentPoMapper">
|
<resultMap id="BaseResultMap" type="com.mzl.flower.entity.film.CommentPo">
|
<id column="id" jdbcType="INTEGER" property="id" />
|
<result column="parent_id" jdbcType="INTEGER" property="parentId" />
|
<result column="content" jdbcType="VARCHAR" property="content" />
|
<result column="film_id" jdbcType="INTEGER" property="filmId" />
|
<result column="state" jdbcType="BIT" property="state" />
|
<result column="deleted" jdbcType="BIT" property="deleted" />
|
<result column="create_by" jdbcType="BIGINT" property="createBy" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
</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, parent_id, content, film_id, `state`, deleted, create_by, create_time,
|
update_time
|
</sql>
|
<select id="selectByExample" parameterType="com.mzl.flower.entity.film.CommentPoExample" resultMap="BaseResultMap">
|
select
|
<if test="distinct">
|
distinct
|
</if>
|
<include refid="Base_Column_List" />
|
from film_comments
|
<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.Integer" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from film_comments
|
where id = #{id,jdbcType=INTEGER}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
delete from film_comments
|
where id = #{id,jdbcType=INTEGER}
|
</delete>
|
<delete id="deleteByExample" parameterType="com.mzl.flower.entity.film.CommentPoExample">
|
delete from film_comments
|
<if test="_parameter != null">
|
<include refid="Example_Where_Clause" />
|
</if>
|
</delete>
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mzl.flower.entity.film.CommentPo" useGeneratedKeys="true">
|
insert into film_comments (parent_id, content, film_id,
|
`state`, deleted, create_by,
|
create_time, update_time)
|
values (#{parentId,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{filmId,jdbcType=INTEGER},
|
#{state,jdbcType=BIT}, #{deleted,jdbcType=BIT}, #{createBy,jdbcType=BIGINT},
|
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
|
</insert>
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mzl.flower.entity.film.CommentPo" useGeneratedKeys="true">
|
insert into film_comments
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="parentId != null">
|
parent_id,
|
</if>
|
<if test="content != null">
|
content,
|
</if>
|
<if test="filmId != null">
|
film_id,
|
</if>
|
<if test="state != null">
|
`state`,
|
</if>
|
<if test="deleted != null">
|
deleted,
|
</if>
|
<if test="createBy != null">
|
create_by,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="updateTime != null">
|
update_time,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="parentId != null">
|
#{parentId,jdbcType=INTEGER},
|
</if>
|
<if test="content != null">
|
#{content,jdbcType=VARCHAR},
|
</if>
|
<if test="filmId != null">
|
#{filmId,jdbcType=INTEGER},
|
</if>
|
<if test="state != null">
|
#{state,jdbcType=BIT},
|
</if>
|
<if test="deleted != null">
|
#{deleted,jdbcType=BIT},
|
</if>
|
<if test="createBy != null">
|
#{createBy,jdbcType=BIGINT},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateTime != null">
|
#{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
</trim>
|
</insert>
|
<select id="countByExample" parameterType="com.mzl.flower.entity.film.CommentPoExample" resultType="java.lang.Long">
|
select count(*) from film_comments
|
<if test="_parameter != null">
|
<include refid="Example_Where_Clause" />
|
</if>
|
</select>
|
<update id="updateByExampleSelective" parameterType="map">
|
update film_comments
|
<set>
|
<if test="record.id != null">
|
id = #{record.id,jdbcType=INTEGER},
|
</if>
|
<if test="record.parentId != null">
|
parent_id = #{record.parentId,jdbcType=INTEGER},
|
</if>
|
<if test="record.content != null">
|
content = #{record.content,jdbcType=VARCHAR},
|
</if>
|
<if test="record.filmId != null">
|
film_id = #{record.filmId,jdbcType=INTEGER},
|
</if>
|
<if test="record.state != null">
|
`state` = #{record.state,jdbcType=BIT},
|
</if>
|
<if test="record.deleted != null">
|
deleted = #{record.deleted,jdbcType=BIT},
|
</if>
|
<if test="record.createBy != null">
|
create_by = #{record.createBy,jdbcType=BIGINT},
|
</if>
|
<if test="record.createTime != null">
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="record.updateTime != null">
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
</if>
|
</set>
|
<if test="_parameter != null">
|
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
</update>
|
<update id="updateByExample" parameterType="map">
|
update film_comments
|
set id = #{record.id,jdbcType=INTEGER},
|
parent_id = #{record.parentId,jdbcType=INTEGER},
|
content = #{record.content,jdbcType=VARCHAR},
|
film_id = #{record.filmId,jdbcType=INTEGER},
|
`state` = #{record.state,jdbcType=BIT},
|
deleted = #{record.deleted,jdbcType=BIT},
|
create_by = #{record.createBy,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
|
<if test="_parameter != null">
|
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.mzl.flower.entity.film.CommentPo">
|
update film_comments
|
<set>
|
<if test="parentId != null">
|
parent_id = #{parentId,jdbcType=INTEGER},
|
</if>
|
<if test="content != null">
|
content = #{content,jdbcType=VARCHAR},
|
</if>
|
<if test="filmId != null">
|
film_id = #{filmId,jdbcType=INTEGER},
|
</if>
|
<if test="state != null">
|
`state` = #{state,jdbcType=BIT},
|
</if>
|
<if test="deleted != null">
|
deleted = #{deleted,jdbcType=BIT},
|
</if>
|
<if test="createBy != null">
|
create_by = #{createBy,jdbcType=BIGINT},
|
</if>
|
<if test="createTime != null">
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateTime != null">
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
</set>
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.mzl.flower.entity.film.CommentPo">
|
update film_comments
|
set parent_id = #{parentId,jdbcType=INTEGER},
|
content = #{content,jdbcType=VARCHAR},
|
film_id = #{filmId,jdbcType=INTEGER},
|
`state` = #{state,jdbcType=BIT},
|
deleted = #{deleted,jdbcType=BIT},
|
create_by = #{createBy,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
|
<!-- CommentPoMapper.xml -->
|
<select id="selectByArticleId" resultType="com.mzl.flower.entity.film.CommentPo">
|
SELECT *
|
FROM film_comments
|
WHERE film_id = #{filmId}
|
AND deleted = false
|
AND state = true
|
</select>
|
|
|
</mapper>
|