|
@@ -9,14 +9,14 @@
|
|
|
<result property="userId" column="user_id"/>
|
|
|
<result property="title" column="title"/>
|
|
|
<result property="content" column="content"/>
|
|
|
- <result property="imageId" column="image_id"/>
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
<result property="remark" column="remark"/>
|
|
|
<collection property="imageList" javaType="java.util.List" resultMap="CommunityArticleImagesResult"/>
|
|
|
- <collection property="communityUser" resultMap="CommunityUserResult"/>
|
|
|
+ <collection property="sysUsers" resultMap="SysUserResult"/>
|
|
|
+ <collection property="comments" resultMap="CommunityCommentsResult"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="CommunityArticleImages" id="CommunityArticleImagesResult">
|
|
@@ -30,12 +30,17 @@
|
|
|
<result property="remark" column="remark"/>
|
|
|
</resultMap>
|
|
|
|
|
|
- <resultMap type="CommunityUser" id="CommunityUserResult">
|
|
|
+ <resultMap type="SysUser" id="SysUserResult">
|
|
|
<id property="userId" column="user_id"/>
|
|
|
- <result property="username" column="username"/>
|
|
|
+ <result property="deptId" column="dept_id"/>
|
|
|
+ <result property="phonenumber" column="phonenumber"/>
|
|
|
+ <result property="userName" column="user_name"/>
|
|
|
+ <result property="nickName" column="nick_name"/>
|
|
|
+ <result property="sex" column="sex"/>
|
|
|
<result property="password" column="password"/>
|
|
|
<result property="email" column="email"/>
|
|
|
- <result property="pictureUrl" column="picture_url"/>
|
|
|
+ <result property="avatar" column="avatar"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
<result property="updateBy" column="update_by"/>
|
|
@@ -43,12 +48,43 @@
|
|
|
<result property="remark" column="remark"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap type="com.ruoyi.generator.vo.CommunityArticleCommentVo" id="CommunityCommentsResult">
|
|
|
+ <id property="commentId" column="comment_id"/>
|
|
|
+ <result property="articleId" column="article_id"/>
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
+ <result property="content" column="comment_content"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="remark" column="remark"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="CommunityCollectResult" type="CommunityArticleCollect">
|
|
|
+ <id property="collectId" column="collect_id"/>
|
|
|
+ <result property="articleId" column="article_id"/>
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="CommunityLikeResult" type="CommunityLike">
|
|
|
+ <id property="likeId" column="like_id"/>
|
|
|
+ <result property="articleId" column="article_id"/>
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<sql id="selectCommunityArticleVo">
|
|
|
select article_id,
|
|
|
user_id,
|
|
|
title,
|
|
|
content,
|
|
|
- image_id,
|
|
|
create_by,
|
|
|
create_time,
|
|
|
update_by,
|
|
@@ -58,11 +94,12 @@
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectCommunityArticleList" parameterType="CommunityArticle" resultMap="CommunityArticleVoResult">
|
|
|
- select a.article_id,
|
|
|
+ select
|
|
|
+ a.article_id,
|
|
|
a.user_id,
|
|
|
a.title,
|
|
|
+ a.is_comment,
|
|
|
a.content,
|
|
|
- a.image_id,
|
|
|
a.create_by,
|
|
|
a.create_time,
|
|
|
a.update_by,
|
|
@@ -76,15 +113,52 @@
|
|
|
b.update_by,
|
|
|
b.update_time,
|
|
|
b.remark,
|
|
|
- c.username,
|
|
|
+ c.user_name,
|
|
|
+ c.nick_name,
|
|
|
c.email,
|
|
|
- c.picture_url from
|
|
|
+ c.avatar,
|
|
|
+ d.comment_id,
|
|
|
+ d.article_id,
|
|
|
+ d.user_id,
|
|
|
+ d.content as comment_content,
|
|
|
+ d.create_by,
|
|
|
+ d.create_time,
|
|
|
+ d.update_by,
|
|
|
+ d.update_time
|
|
|
+ from
|
|
|
community_article a
|
|
|
left join community_article_images b on a.article_id = b.article_id
|
|
|
- left join community_user c on a.user_id = c.user_id
|
|
|
+ left join sys_user c on a.user_id = c.user_id
|
|
|
+ left join community_article_comment d on d.article_id = a.article_id
|
|
|
<where>
|
|
|
<if test="title != null and title != ''">
|
|
|
- AND title like concat('%', #{title}, '%')
|
|
|
+ AND a.title like concat('%', #{title}, '%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCommunityArticleCollectById" resultMap="CommunityCollectResult">
|
|
|
+ select collect_id, article_id, user_id, create_by, create_time, update_by, update_time from
|
|
|
+ community_article_collect
|
|
|
+ <where>
|
|
|
+ <if test="user_id != null and user_id != '">
|
|
|
+ user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="article_id != null and article_id != '">
|
|
|
+ and article_id = #{articleId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCommunityArticleLikeById" resultMap="CommunityLikeResult">
|
|
|
+ select like_id, article_id, user_id, create_by, create_time, update_by, update_time from
|
|
|
+ community_like
|
|
|
+ <where>
|
|
|
+ <if test="user_id != null and user_id != '">
|
|
|
+ user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="article_id != null and article_id != '">
|
|
|
+ and article_id = #{articleId}
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|