update
This commit is contained in:
147
src/main/resources/mybatis/CommentDao.xml
Normal file
147
src/main/resources/mybatis/CommentDao.xml
Normal file
@@ -0,0 +1,147 @@
|
||||
<?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.lovenav.dao.CommentDao">
|
||||
<resultMap id="BaseResultMap" type="com.lovenav.entity.Comment">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="url_id" jdbcType="INTEGER" property="urlId" />
|
||||
<result column="user_id" jdbcType="INTEGER" property="userId" />
|
||||
<result column="content" jdbcType="VARCHAR" property="content" />
|
||||
<result column="root_comment_id" jdbcType="INTEGER" property="rootCommentId" />
|
||||
<result column="like_count" jdbcType="BIGINT" property="likeCount" />
|
||||
<result column="comment_time" jdbcType="TIMESTAMP" property="commentTime" />
|
||||
<result column="comment_status" jdbcType="TINYINT" property="commentStatus" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="rating" jdbcType="INTEGER" property="rating" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, url_id, user_id, content, root_comment_id, like_count, comment_time, comment_status,
|
||||
update_time, rating
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from ln_comment
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from ln_comment
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Comment" useGeneratedKeys="true">
|
||||
insert into ln_comment (url_id, user_id, content,
|
||||
root_comment_id, like_count, comment_time,
|
||||
comment_status, update_time, rating
|
||||
)
|
||||
values (#{urlId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR},
|
||||
#{rootCommentId,jdbcType=INTEGER}, #{likeCount,jdbcType=BIGINT}, #{commentTime,jdbcType=TIMESTAMP},
|
||||
#{commentStatus,jdbcType=TINYINT}, #{updateTime,jdbcType=TIMESTAMP}, #{rating,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Comment" useGeneratedKeys="true">
|
||||
insert into ln_comment
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="urlId != null">
|
||||
url_id,
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="content != null">
|
||||
content,
|
||||
</if>
|
||||
<if test="rootCommentId != null">
|
||||
root_comment_id,
|
||||
</if>
|
||||
<if test="likeCount != null">
|
||||
like_count,
|
||||
</if>
|
||||
<if test="commentTime != null">
|
||||
comment_time,
|
||||
</if>
|
||||
<if test="commentStatus != null">
|
||||
comment_status,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="rating != null">
|
||||
rating,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="urlId != null">
|
||||
#{urlId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="content != null">
|
||||
#{content,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="rootCommentId != null">
|
||||
#{rootCommentId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="likeCount != null">
|
||||
#{likeCount,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="commentTime != null">
|
||||
#{commentTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="commentStatus != null">
|
||||
#{commentStatus,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="rating != null">
|
||||
#{rating,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.lovenav.entity.Comment">
|
||||
update ln_comment
|
||||
<set>
|
||||
<if test="urlId != null">
|
||||
url_id = #{urlId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="content != null">
|
||||
content = #{content,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="rootCommentId != null">
|
||||
root_comment_id = #{rootCommentId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="likeCount != null">
|
||||
like_count = #{likeCount,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="commentTime != null">
|
||||
comment_time = #{commentTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="commentStatus != null">
|
||||
comment_status = #{commentStatus,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="rating != null">
|
||||
rating = #{rating,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.lovenav.entity.Comment">
|
||||
update ln_comment
|
||||
set url_id = #{urlId,jdbcType=INTEGER},
|
||||
user_id = #{userId,jdbcType=INTEGER},
|
||||
content = #{content,jdbcType=VARCHAR},
|
||||
root_comment_id = #{rootCommentId,jdbcType=INTEGER},
|
||||
like_count = #{likeCount,jdbcType=BIGINT},
|
||||
comment_time = #{commentTime,jdbcType=TIMESTAMP},
|
||||
comment_status = #{commentStatus,jdbcType=TINYINT},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
rating = #{rating,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
Reference in New Issue
Block a user