32 lines
1.2 KiB
XML
32 lines
1.2 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="io.spring.infrastructure.comment.CommentMapper">
|
||
|
<insert id="insert">
|
||
|
insert into comments(id, body, user_id, article_id, created_at, updated_at)
|
||
|
values (
|
||
|
#{comment.id},
|
||
|
#{comment.body},
|
||
|
#{comment.userId},
|
||
|
#{comment.articleId},
|
||
|
#{comment.createdAt},
|
||
|
#{comment.createdAt}
|
||
|
)
|
||
|
</insert>
|
||
|
<select id="findById" resultMap="comment">
|
||
|
select
|
||
|
id commentId,
|
||
|
body commentBody,
|
||
|
user_id commentUserId,
|
||
|
article_id commentArticleId,
|
||
|
created_at commentCreatedAt
|
||
|
from comments
|
||
|
where id = #{id}
|
||
|
</select>
|
||
|
<resultMap id="comment" type="io.spring.core.comment.Comment">
|
||
|
<id column="commentId" property="id"/>
|
||
|
<result column="commentBody" property="body"/>
|
||
|
<result column="commentUserId" property="userId"/>
|
||
|
<result column="commentArticleId" property="articleId"/>
|
||
|
<result column="commentCreatedAt" property="createdAt"/>
|
||
|
</resultMap>
|
||
|
</mapper>
|