This commit is contained in:
oneao committed 2025-12-27 17:21:38 +08:00
1 parent 2f8a815c62
commit a09fdf0a66
127 files changed
+4518 -1159

No files matched your search

@@ -1,5 +1,8 @@
server:
port: 8084
netty:
port: 8090
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
@@ -36,4 +36,9 @@ mybatis-plus:
use-generated-keys: true
default-executor-type: simple
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
map-underscore-to-camel-case: true
global-config:
db-config:
logic-delete-field: deleted
logic-not-delete-value: 0
logic-delete-value: 1
@@ -15,7 +15,7 @@
b_order AS [order]
</sql>
<select id="listAllArea" resultType="cn.link56.base.model.po.AreaPO">
<select id="listAllArea" resultType="cn.link56.base.model.po.Area">
SELECT <include refid="area_columns"/> FROM b_area_sheng WHERE b_canuse = '1'
UNION ALL
SELECT <include refid="area_columns"/> FROM b_area_shi WHERE b_canuse = '1'
@@ -5,6 +5,7 @@
<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="rootId" column="b_root_id"/>
<result property="fatherId" column="b_father_id"/>
<result property="content" column="b_content"/>
<result property="createTime" column="b_create_time"/>
@@ -28,14 +29,14 @@
<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
pc.b_id AS pub_user_id,pc.b_company_id AS pub_company_id,pc.b_name AS pub_user_name,pc.b_avatar AS pub_user_avatar,
rc.b_id AS rep_user_id,rc.b_company_id AS rep_company_id,rc.b_name AS rep_user_name,rc.b_avatar AS rep_user_avatar
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}
WHERE c.b_post_id = #{postId} AND c.b_deleted = 0
ORDER BY c.b_create_time
</select>
@@ -56,13 +56,12 @@
p.b_publish_time AS publishTime,
p.b_status AS status,
(SELECT COUNT(1) FROM b_post_view v WHERE v.b_post_id = p.b_id) AS viewCount,
(SELECT COUNT(1) FROM b_post_like l WHERE l.b_post_id = p.b_id) AS likeCount,
(SELECT COUNT(1) FROM b_post_favorite f WHERE f.b_post_id = p.b_id) AS favoriteCount,
(SELECT COUNT(1) FROM b_post_comment c WHERE c.b_post_id = p.b_id) AS commentCount,
ISNULL(ps.b_view_count, 0) AS viewCount,
ISNULL(ps.b_comment_count, 0) AS commentCount,
ROW_NUMBER() OVER (ORDER BY p.b_update_time DESC) AS rn
FROM b_post p
LEFT JOIN b_post_stat ps ON ps.b_post_id = p.b_id
<where>
<if test="userId != null">
AND p.b_create_by = #{userId}
@@ -73,7 +72,7 @@
</if>
<if test="title != null and title != ''">
AND p.b_title LIKE '%' + #{title} + '%'
AND p.b_title LIKE CONCAT('%', #{title}, '%')
</if>
<if test="year != null and year != ''">
@@ -88,6 +87,7 @@
WHERE t.rn BETWEEN #{offset} AND #{limit}
</select>
<select id="selectEditorPostTotal" resultType="java.lang.Long">
SELECT COUNT(*)
FROM b_post p
@@ -114,14 +114,18 @@
</where>
</select>
<select id="selectDashboardOverview" resultType="cn.link56.post.model.vo.EditorDashboardVO$Count">
<select id="selectDashboardOverview"
resultType="cn.link56.post.model.vo.EditorDashboardVO$Count">
SELECT
(SELECT COUNT(*) FROM b_post WHERE b_create_by = #{userId}) AS postCount,
(SELECT COUNT(*) FROM b_post_view WHERE b_post_id IN (SELECT b_id FROM b_post WHERE b_create_by = #{userId})) AS viewCount,
(SELECT COUNT(*) FROM b_post_like WHERE b_post_id IN (SELECT b_id FROM b_post WHERE b_create_by = #{userId})) AS likeCount,
(SELECT COUNT(*) FROM b_post_favorite WHERE b_post_id IN (SELECT b_id FROM b_post WHERE b_create_by = #{userId})) AS favoriteCount
COUNT(p.b_id) AS postCount,
ISNULL(SUM(ps.b_view_count), 0) AS viewCount,
ISNULL(SUM(ps.b_like_count), 0) AS likeCount
FROM b_post p
LEFT JOIN b_post_stat ps ON ps.b_post_id = p.b_id
WHERE p.b_create_by = #{userId}
</select>
<select id="selectDashboardViewStats" resultType="cn.link56.post.model.vo.EditorDashboardVO$Chart">
SELECT
CONVERT(VARCHAR(10), v.b_create_time, 120) AS label,
@@ -0,0 +1,33 @@
<?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.PostStatMapper">
<update id="increaseViewCount">
UPDATE b_post_stat
SET
b_view_count = b_view_count + #{count},
b_update_time = GETDATE()
WHERE b_post_id = #{postId}
</update>
<update id="increaseCommentCount">
UPDATE b_post_stat
SET
b_comment_count = b_comment_count + #{count},
b_update_time = GETDATE()
WHERE b_post_id = #{postId}
</update>
<update id="decreaseCommentCount">
UPDATE b_post_stat
SET
b_comment_count = b_comment_count - #{count},
b_update_time = GETDATE()
WHERE b_post_id = #{postId}
AND b_comment_count >= #{count}
</update>
</mapper>