60 lines
3.8 KiB
XML
60 lines
3.8 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.rymcu.vertical.mapper.ArticleMapper">
|
||
|
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.Article">
|
||
|
<!--
|
||
|
WARNING - @mbg.generated
|
||
|
-->
|
||
|
<id column="id" jdbcType="INTEGER" property="idArticle"/>
|
||
|
<result column="article_title" property="articleTitle"></result>
|
||
|
<result column="article_thumbnail_url" property="articleThumbnailUrl"></result>
|
||
|
<result column="article_author_id" property="articleAuthorId"></result>
|
||
|
<result column="article_type" property="articleType"></result>
|
||
|
<result column="article_tags" property="articleTags"></result>
|
||
|
<result column="article_view_count" property="articleViewCount"></result>
|
||
|
<result column="article_preview_content" property="articlePreviewContent"></result>
|
||
|
<result column="comment_count" property="commentCount"></result>
|
||
|
<result column="article_permalink" property="articlePermalink"></result>
|
||
|
<result column="article_link" property="articleLink"></result>
|
||
|
<result column="created_time" property="createdTime"></result>
|
||
|
<result column="updated_time" property="updatedTime"></result>
|
||
|
</resultMap>
|
||
|
<resultMap id="DTOResultMap" type="com.rymcu.vertical.dto.ArticleDTO">
|
||
|
<result column="id" property="idArticle"></result>
|
||
|
<result column="article_title" property="articleTitle"></result>
|
||
|
<result column="article_thumbnail_url" property="articleThumbnailUrl"></result>
|
||
|
<result column="article_author_id" property="articleAuthorId"></result>
|
||
|
<result column="nickname" property="articleAuthorName"></result>
|
||
|
<result column="avatar_url" property="articleAuthorAvatarUrl"></result>
|
||
|
<result column="article_type" property="articleType"></result>
|
||
|
<result column="article_tags" property="articleTags"></result>
|
||
|
<result column="article_view_count" property="articleViewCount"></result>
|
||
|
<result column="article_preview_content" property="articlePreviewContent"></result>
|
||
|
<result column="comment_count" property="commentCount"></result>
|
||
|
<result column="time_ago" property="timeAgo"></result>
|
||
|
<result column="article_permalink" property="articlePermalink"></result>
|
||
|
<result column="article_link" property="articleLink"></result>
|
||
|
<result column="updated_time" property="updatedTime"></result>
|
||
|
</resultMap>
|
||
|
<resultMap id="AuthorResultMap" type="com.rymcu.vertical.dto.Author">
|
||
|
<result column="id" jdbcType="VARCHAR" property="idUser"/>
|
||
|
<result column="nickname" jdbcType="VARCHAR" property="userNickname"/>
|
||
|
<result column="avatar_url" jdbcType="VARCHAR" property="userAvatarURL"/>
|
||
|
</resultMap>
|
||
|
<insert id="insertArticleContent">
|
||
|
insert into article_content (id_article,article_content,article_content_html,created_time,updated_time)
|
||
|
values (#{idArticle},#{articleContent},#{articleContentHtml},sysdate(),sysdate())
|
||
|
</insert>
|
||
|
<update id="updateArticleContent">
|
||
|
update article_content set article_content = #{articleContent},article_content_html = #{articleContentHtml},updated_time = sysdate() where id_article = #{idArticle}
|
||
|
</update>
|
||
|
<select id="selectArticles" resultMap="DTOResultMap">
|
||
|
select art.*,su.nickname,su.avatar_url from article art left join sys_user su on art.article_author_id = su.id
|
||
|
</select>
|
||
|
<select id="selectAuthor" resultMap="AuthorResultMap">
|
||
|
select * from sys_user where id = #{id}
|
||
|
</select>
|
||
|
<select id="selectArticleDTOById" resultMap="DTOResultMap">
|
||
|
select art.*,su.nickname,su.avatar_url from article art left join sys_user su on art.article_author_id = su.id where art.id = #{id}
|
||
|
</select>
|
||
|
</mapper>
|