This commit is contained in:
oneao committed 2025-12-26 17:30:43 +08:00
1 parent 4f5218c892
commit 2f8a815c62
32 files changed
+1915 -1738

No files matched your search

@@ -0,0 +1,42 @@
<?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="cn.link56.post.mapper.PostCommentMapper">
<resultMap id="CommentListMap" type="cn.link56.post.model.vo.PostCommentVO">
<id property="id" column="b_id"/>
<result property="fatherId" column="b_father_id"/>
<result property="content" column="b_content"/>
<result property="createTime" column="b_create_time"/>
<!-- 映射发布公司 -->
<association property="publishUser" javaType="cn.link56.post.model.vo.PostCommentVO$User">
<result property="id" column="pub_user_id"/>
<result property="companyId" column="pub_company_id"/>
<result property="name" column="pub_user_name"/>
<result property="avatar" column="pub_user_avatar"/>
</association>
<!-- 映射回复公司 -->
<association property="replyUser" javaType="cn.link56.post.model.vo.PostCommentVO$User">
<result property="id" column="rep_user_id"/>
<result property="companyId" column="rep_company_id"/>
<result property="name" column="rep_user_name"/>
<result property="avatar" column="rep_user_avatar"/>
</association>
</resultMap>
<select id="selectComments" resultMap="CommentListMap">
SELECT c.*,
pc.b_id AS pub_user_id,pc.b_company_id AS pub_company_id,pc.b_name AS pub_user_name,
rc.b_id AS rep_user_id,rc.b_company_id AS rep_company_id,rc.b_name AS rep_company_id
FROM b_post_comment c
LEFT JOIN b_company_user pc ON c.b_create_by = pc.b_id
LEFT JOIN b_company_user rc ON (
SELECT b_create_by FROM b_post_comment WHERE b_id = c.b_father_id
) = rc.b_id
WHERE c.b_post_id = #{postId}
ORDER BY c.b_create_time
</select>
</mapper>
@@ -163,7 +163,7 @@
p.b_id AS id,
p.b_title AS title,
p.b_tag AS tagsString,
p.company_id AS companyId,
p.b_company_id AS companyId,
bc.b_name AS companyName,
ISNULL(pv.viewCount, 0) AS viewCount,
@@ -173,10 +173,10 @@
ISNULL(pc.lastCommentTime, p.b_update_time) AS activeTime,
ROW_NUMBER() OVER (
ORDER BY ISNULL(pc.lastCommentTime, p.b_update_time) DESC
ORDER BY ISNULL(pc.lastCommentTime, p.b_update_time) DESC
) AS rn
FROM b_post p
LEFT JOIN b_company bc ON bc.b_id = p.company_id
LEFT JOIN b_company bc ON bc.b_id = p.b_company_id
LEFT JOIN (
SELECT
b_post_id,
@@ -193,10 +193,11 @@
GROUP BY b_post_id
) pc ON pc.b_post_id = p.b_id
<where>
AND p.b_status = 1
<if test="title != null and title != ''">
AND p.b_title LIKE '%' + #{title} + '%'
</if>
<if test="tag != null and tag != -1">
<if test="tag != null and tag != ''">
AND p.b_tag LIKE '%' + #{tag} + '%'
</if>
</where>
@@ -204,4 +205,19 @@
WHERE t.rn BETWEEN #{offset} AND #{limit}
</select>
<select id="selectPublicPostTotal" resultType="java.lang.Long">
SELECT COUNT(1)
FROM b_post p
<where>
AND p.b_status = 1
<if test="title != null and title != ''">
AND p.b_title LIKE '%' + #{title} + '%'
</if>
<if test="tag != null and tag != ''">
AND p.b_tag LIKE '%' + #{tag} + '%'
</if>
</where>
</select>
</mapper>