From acb3762392bfab85249b13bf3eb1a4dd1affcf28 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 01 Dec 2023 17:50:03 +0800
Subject: [PATCH] 圈子

---
 src/main/java/org/springblade/modules/circle/wrapper/CircleCommentWrapper.java          |   50 +++
 src/main/java/org/springblade/modules/circle/mapper/CircleCommentMapper.java            |   63 ++++
 src/main/java/org/springblade/modules/circle/controller/CircleLikeController.java       |   15 
 src/main/java/org/springblade/modules/circle/vo/CircleVO.java                           |    6 
 src/main/java/org/springblade/modules/circle/vo/CircleCommentVO.java                    |   42 +++
 src/main/java/org/springblade/modules/circle/service/ICircleCommentService.java         |   43 +++
 src/main/java/org/springblade/modules/circle/entity/CircleLikeEntity.java               |    2 
 src/main/java/org/springblade/modules/circle/controller/CircleCommentController.java    |  132 ++++++++++
 src/main/java/org/springblade/modules/circle/dto/CircleCommentDTO.java                  |   40 +++
 src/main/java/org/springblade/modules/circle/service/impl/CircleServiceImpl.java        |   26 +
 src/main/java/org/springblade/modules/circle/service/impl/CircleCommentServiceImpl.java |   43 +++
 src/main/java/org/springblade/modules/circle/entity/CircleCommentEntity.java            |  114 ++++++++
 src/main/java/org/springblade/modules/circle/mapper/CircleMapper.java                   |    4 
 src/main/java/org/springblade/modules/circle/controller/CircleController.java           |    1 
 src/main/java/org/springblade/modules/circle/mapper/CircleMapper.xml                    |   28 +
 src/main/java/org/springblade/modules/circle/mapper/CircleCommentMapper.xml             |  147 +++++++++++
 16 files changed, 738 insertions(+), 18 deletions(-)

diff --git a/src/main/java/org/springblade/modules/circle/controller/CircleCommentController.java b/src/main/java/org/springblade/modules/circle/controller/CircleCommentController.java
new file mode 100644
index 0000000..93d4bf6
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/controller/CircleCommentController.java
@@ -0,0 +1,132 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.circle.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.circle.entity.CircleCommentEntity;
+import org.springblade.modules.circle.service.ICircleCommentService;
+import org.springblade.modules.circle.vo.CircleCommentVO;
+import org.springblade.modules.circle.wrapper.CircleCommentWrapper;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 圈子评论表 控制器
+ *
+ * @author BladeX
+ * @since 2023-12-01
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("blade-circleComment/circleComment")
+@Api(value = "圈子评论表", tags = "圈子评论表接口")
+public class CircleCommentController extends BladeController {
+
+	private final ICircleCommentService circleService;
+
+	/**
+	 * 圈子评论表 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入circle")
+	public R<CircleCommentVO> detail(CircleCommentEntity circle) {
+		CircleCommentEntity detail = circleService.getOne(Condition.getQueryWrapper(circle));
+		return R.data(CircleCommentWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 圈子评论表 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入circle")
+	public R<IPage<CircleCommentVO>> list(CircleCommentEntity circle, Query query) {
+		IPage<CircleCommentEntity> pages = circleService.page(Condition.getPage(query), Condition.getQueryWrapper(circle));
+		return R.data(CircleCommentWrapper.build().pageVO(pages));
+	}
+
+	/**
+	 * 圈子评论表 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入circle")
+	public R<IPage<CircleCommentVO>> page(CircleCommentVO circle, Query query) {
+		IPage<CircleCommentVO> pages = circleService.selectCircleCommentPage(Condition.getPage(query), circle);
+		return R.data(pages);
+	}
+
+	/**
+	 * 圈子评论表 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入circle")
+	public R save(@Valid @RequestBody CircleCommentEntity circle) {
+		if (circle.getParentId() == null) {
+			circle.setDepth(1);
+		}
+		circle.setUserId(AuthUtil.getUserId());
+		return R.status(circleService.save(circle));
+	}
+
+	/**
+	 * 圈子评论表 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入circle")
+	public R update(@Valid @RequestBody CircleCommentEntity circle) {
+		return R.status(circleService.updateById(circle));
+	}
+
+	/**
+	 * 圈子评论表 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入circle")
+	public R submit(@Valid @RequestBody CircleCommentEntity circle) {
+		circle.setUserId(AuthUtil.getUserId());
+		return R.status(circleService.saveOrUpdate(circle));
+	}
+
+	/**
+	 * 圈子评论表 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(circleService.removeBatchByIds(Func.toLongList(ids)));
+	}
+
+
+}
diff --git a/src/main/java/org/springblade/modules/circle/controller/CircleController.java b/src/main/java/org/springblade/modules/circle/controller/CircleController.java
index 60e4c1f..288862e 100644
--- a/src/main/java/org/springblade/modules/circle/controller/CircleController.java
+++ b/src/main/java/org/springblade/modules/circle/controller/CircleController.java
@@ -79,6 +79,7 @@
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入circle")
 	public R<IPage<CircleVO>> page(CircleVO circle, Query query) {
+		circle.setUserIds(AuthUtil.getUserId());
 		IPage<CircleVO> pages = circleService.selectCirclePage(Condition.getPage(query), circle);
 		return R.data(pages);
 	}
diff --git a/src/main/java/org/springblade/modules/circle/controller/CircleLikeController.java b/src/main/java/org/springblade/modules/circle/controller/CircleLikeController.java
index 16775da..5e0299b 100644
--- a/src/main/java/org/springblade/modules/circle/controller/CircleLikeController.java
+++ b/src/main/java/org/springblade/modules/circle/controller/CircleLikeController.java
@@ -16,8 +16,8 @@
  */
 package org.springblade.modules.circle.controller;
 
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -29,7 +29,6 @@
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.modules.article.entity.ArticleLikeEntity;
 import org.springblade.modules.circle.entity.CircleLikeEntity;
 import org.springblade.modules.circle.service.ICircleLikeService;
 import org.springblade.modules.circle.vo.CircleLikeVO;
@@ -114,10 +113,14 @@
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "新增或修改", notes = "传入circle")
 	public R submit(@Valid @RequestBody CircleLikeEntity circle) {
-		UpdateWrapper<CircleLikeEntity> objectUpdateWrapper = new UpdateWrapper<>();
-		objectUpdateWrapper.eq("user_id", circle.getUserId());
-		objectUpdateWrapper.eq("circle_id", circle.getCircleId());
-		return R.status(circleService.saveOrUpdate(circle,objectUpdateWrapper));
+		circle.setUserId(AuthUtil.getUserId());
+		CircleLikeEntity one = circleService.getOne(Wrappers.<CircleLikeEntity>lambdaQuery()
+			.eq(CircleLikeEntity::getCircleId, circle.getCircleId())
+			.eq(CircleLikeEntity::getUserId, circle.getUserId()));
+		if (one != null) {
+			circle.setId(one.getId());
+		}
+		return R.status(circleService.saveOrUpdate(circle));
 	}
 
 	/**
diff --git a/src/main/java/org/springblade/modules/circle/dto/CircleCommentDTO.java b/src/main/java/org/springblade/modules/circle/dto/CircleCommentDTO.java
new file mode 100644
index 0000000..9927722
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/dto/CircleCommentDTO.java
@@ -0,0 +1,40 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.circle.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import org.springblade.modules.circle.entity.CircleCommentEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 圈子评论表 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2023-12-01
+ */
+@Data
+public class CircleCommentDTO extends CircleCommentEntity  {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/circle/entity/CircleCommentEntity.java b/src/main/java/org/springblade/modules/circle/entity/CircleCommentEntity.java
new file mode 100644
index 0000000..f5fa5d2
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/entity/CircleCommentEntity.java
@@ -0,0 +1,114 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.circle.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 圈子评论表 实体类
+ *
+ * @author BladeX
+ * @since 2023-12-01
+ */
+@Data
+@TableName("jczz_circle_comment")
+@ApiModel(value = "CircleComment对象", description = "圈子评论表")
+public class CircleCommentEntity {
+
+	@ApiModelProperty(value = "主键ID", example = "")
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+
+	/** 圈子id */
+	@ApiModelProperty(value = "圈子id", example = "")
+	@TableField("circle_id")
+	private Long circleId;
+
+	/** 评论内容 */
+	@ApiModelProperty(value = "评论内容", example = "")
+	@TableField("content")
+	private String content;
+
+	/** 评论人id */
+	@ApiModelProperty(value = "评论人id", example = "")
+	@TableField("user_id")
+	private Long userId;
+
+	/** 父级id(人) */
+	@ApiModelProperty(value = "父级id(人)", example = "")
+	@TableField("parent_id")
+	private Long parentId;
+
+	/** 回复时间 */
+	@ApiModelProperty(value = "回复时间", example = "")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+	@TableField("reply_time")
+	private Date replyTime;
+
+	/** 是否置顶(0:否,1:是) */
+	@ApiModelProperty(value = "是否置顶(0:否,1:是)", example = "")
+	@TableField("topping")
+	private Integer topping;
+
+	/** 是否审核(0:否,1:是) */
+	@ApiModelProperty(value = "是否审核(0:否,1:是)", example = "")
+	@TableField("isexamine")
+	private Integer isexamine;
+
+	/** 审核人 */
+	@ApiModelProperty(value = "审核人", example = "")
+	@TableField("check_user")
+	private Long checkUser;
+
+	/** 审核时间 */
+	@ApiModelProperty(value = "审核时间", example = "")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+	@TableField("check_time")
+	private Date checkTime;
+
+	/** 审核状态 */
+	@ApiModelProperty(value = "审核状态", example = "")
+	@TableField("check_status")
+	private Integer checkStatus;
+
+	/** 审核备注 */
+	@ApiModelProperty(value = "审核备注", example = "")
+	@TableField("check_remark")
+	private String checkRemark;
+
+	/** 创建时间 */
+	@ApiModelProperty(value = "创建时间", example = "")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+	@TableField("create_time")
+	private Date createTime;
+
+	/** 是否删除 0:否  1:是 */
+	@ApiModelProperty(value = "是否删除 0:否  1:是", example = "")
+	@TableField("is_deleted")
+	private Integer isDeleted;
+
+	/** 评论深度 */
+	@ApiModelProperty(value = "评论深度", example = "")
+	@TableField("depth")
+	private Integer depth;
+}
diff --git a/src/main/java/org/springblade/modules/circle/entity/CircleLikeEntity.java b/src/main/java/org/springblade/modules/circle/entity/CircleLikeEntity.java
index d467fdf..28ca77f 100644
--- a/src/main/java/org/springblade/modules/circle/entity/CircleLikeEntity.java
+++ b/src/main/java/org/springblade/modules/circle/entity/CircleLikeEntity.java
@@ -60,7 +60,7 @@
 	/** 0:否 1:是 */
 	@ApiModelProperty(value = "0:否 1:是", example = "")
 	@TableField("delete_flag")
-	@TableLogic
+//	@TableLogic
 	private Integer deleteFlag;
 
 }
diff --git a/src/main/java/org/springblade/modules/circle/mapper/CircleCommentMapper.java b/src/main/java/org/springblade/modules/circle/mapper/CircleCommentMapper.java
new file mode 100644
index 0000000..9cdd3d3
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/mapper/CircleCommentMapper.java
@@ -0,0 +1,63 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.circle.mapper;
+
+import io.lettuce.core.dynamic.annotation.Param;
+import org.springblade.modules.circle.dto.CircleCommentDTO;
+import org.springblade.modules.circle.entity.CircleCommentEntity;
+import org.springblade.modules.circle.vo.CircleCommentVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 圈子评论表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-12-01
+ */
+public interface CircleCommentMapper extends BaseMapper<CircleCommentEntity> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param circle
+	 * @return
+	 */
+	List<CircleCommentVO> selectCircleCommentPage(IPage page, @Param("circle") CircleCommentVO circle);
+
+	/**
+	 * 查询圈子评论表
+	 *
+	 * @param id 圈子评论表ID
+	 * @return 圈子评论表
+	 */
+	public CircleCommentDTO selectCircleCommentById(Integer id);
+
+	public CircleCommentDTO selectCircleCommentByParentId(Integer id);
+
+	/**
+	 * 查询圈子评论表列表
+	 *
+	 * @param circleCommentDTO 圈子评论表
+	 * @return 圈子评论表集合
+	 */
+	public List<CircleCommentDTO> selectCircleCommentList(CircleCommentDTO circleCommentDTO);
+
+
+}
diff --git a/src/main/java/org/springblade/modules/circle/mapper/CircleCommentMapper.xml b/src/main/java/org/springblade/modules/circle/mapper/CircleCommentMapper.xml
new file mode 100644
index 0000000..2366bdf
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/mapper/CircleCommentMapper.xml
@@ -0,0 +1,147 @@
+<?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="org.springblade.modules.circle.mapper.CircleCommentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="circleResultMap" type="org.springblade.modules.circle.vo.CircleCommentVO">
+        <result property="id"    column="id"    />
+        <result property="circleId"    column="circle_id"    />
+        <result property="content"    column="content"    />
+        <result property="userId"    column="user_id"    />
+        <result property="parentId"    column="parent_id"    />
+        <result property="replyTime"    column="reply_time"    />
+        <result property="topping"    column="topping"    />
+        <result property="isexamine"    column="isexamine"    />
+        <result property="checkUser"    column="check_user"    />
+        <result property="checkTime"    column="check_time"    />
+        <result property="checkStatus"    column="check_status"    />
+        <result property="checkRemark"    column="check_remark"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="isDeleted"    column="is_deleted"    />
+        <result property="depth"    column="depth"    />
+
+        <collection property="children" column="id"  javaType="java.util.List"
+                    ofType="org.springblade.modules.circle.vo.CircleCommentVO"
+                    autoMapping="true"
+                    select="selectCircleCommentByParentId">
+
+        </collection>
+
+    </resultMap>
+
+
+    <resultMap type="org.springblade.modules.circle.dto.CircleCommentDTO" id="CircleCommentDTOResult">
+        <result property="id"    column="id"    />
+        <result property="circleId"    column="circle_id"    />
+        <result property="content"    column="content"    />
+        <result property="userId"    column="user_id"    />
+        <result property="parentId"    column="parent_id"    />
+        <result property="replyTime"    column="reply_time"    />
+        <result property="topping"    column="topping"    />
+        <result property="isexamine"    column="isexamine"    />
+        <result property="checkUser"    column="check_user"    />
+        <result property="checkTime"    column="check_time"    />
+        <result property="checkStatus"    column="check_status"    />
+        <result property="checkRemark"    column="check_remark"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="isDeleted"    column="is_deleted"    />
+        <result property="depth"    column="depth"    />
+    </resultMap>
+
+    <sql id="selectCircleComment">
+        select
+            id,
+            circle_id,
+            content,
+            user_id,
+            parent_id,
+            reply_time,
+            topping,
+            isexamine,
+            check_user,
+            check_time,
+            check_status,
+            check_remark,
+            create_time,
+            is_deleted,
+            depth
+        from
+            jczz_circle_comment
+    </sql>
+
+    <select id="selectCircleCommentById" parameterType="int" resultMap="CircleCommentDTOResult">
+        <include refid="selectCircleComment"/>
+        where
+        id = #{id}
+    </select>
+
+    <select id="selectCircleCommentByParentId" parameterType="int" resultMap="CircleCommentDTOResult">
+        <include refid="selectCircleComment"/>
+        where
+        parent_id = #{id}
+    </select>
+
+    <select id="selectCircleCommentList" parameterType="org.springblade.modules.circle.dto.CircleCommentDTO" resultMap="CircleCommentDTOResult">
+        <include refid="selectCircleComment"/>
+        <where>
+            <if test="id != null "> and id = #{id}</if>
+            <if test="circleId != null "> and circle_id = #{circleId}</if>
+            <if test="content != null  and content != ''"> and content = #{content}</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="parentId != null "> and parent_id = #{parentId}</if>
+            <if test="replyTime != null "> and reply_time = #{replyTime}</if>
+            <if test="topping != null "> and topping = #{topping}</if>
+            <if test="isexamine != null "> and isexamine = #{isexamine}</if>
+            <if test="checkUser != null "> and check_user = #{checkUser}</if>
+            <if test="checkTime != null "> and check_time = #{checkTime}</if>
+            <if test="checkStatus != null "> and check_status = #{checkStatus}</if>
+            <if test="checkRemark != null  and checkRemark != ''"> and check_remark = #{checkRemark}</if>
+            <if test="createTime != null "> and create_time = #{createTime}</if>
+            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
+            <if test="depth != null "> and depth = #{depth}</if>
+        </where>
+    </select>
+
+
+    <select id="selectCircleCommentPage" resultMap="circleResultMap">
+        select
+        jcc.id,
+        jcc.circle_id,
+        jcc.content,
+        jcc.user_id,
+        jcc.parent_id,
+        jcc.reply_time,
+        jcc.topping,
+        jcc.isexamine,
+        jcc.check_user,
+        jcc.check_time,
+        jcc.check_status,
+        jcc.check_remark,
+        jcc.create_time,
+        jcc.is_deleted,
+        bu.name,
+        bu.avatar,
+        jcc.depth
+        from
+        jczz_circle_comment  jcc left join blade_user bu on jcc.user_id = bu.id
+        <where>
+            <if test="circle.id != null "> and jcc.id = #{circle.id}</if>
+            <if test="circle.circleId != null "> and jcc.circle_id = #{circle.circleId}</if>
+            <if test="circle.content != null  and circle.content != ''"> and content = #{circle.content}</if>
+            <if test="circle.userId != null "> and jcc.user_id = #{circle.userId}</if>
+            <if test="circle.parentId != null "> and jcc.parent_id = #{circle.parentId}</if>
+            <if test="circle.replyTime != null "> and jcc.reply_time = #{circle.replyTime}</if>
+            <if test="circle.topping != null "> and jcc.topping = #{circle.topping}</if>
+            <if test="circle.isexamine != null "> and jcc.isexamine = #{circle.isexamine}</if>
+            <if test="circle.checkUser != null "> and jcc.check_user = #{circle.checkUser}</if>
+            <if test="circle.checkTime != null "> and jcc.check_time = #{circle.checkTime}</if>
+            <if test="circle.checkStatus != null "> and jcc.check_status = #{circle.checkStatus}</if>
+            <if test="circle.checkRemark != null  and circle.checkRemark != ''"> and jcc.check_remark = #{circle.checkRemark}</if>
+            <if test="circle.createTime != null "> and jcc.create_time = #{circle.createTime}</if>
+            <if test="circle.isDeleted != null "> and jcc.is_deleted = #{circle.isDeleted}</if>
+            <if test="circle.depth != null "> and jcc.depth = #{circle.depth}</if>
+        </where>
+    </select>
+
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/circle/mapper/CircleMapper.java b/src/main/java/org/springblade/modules/circle/mapper/CircleMapper.java
index 79dcd31..9efb051 100644
--- a/src/main/java/org/springblade/modules/circle/mapper/CircleMapper.java
+++ b/src/main/java/org/springblade/modules/circle/mapper/CircleMapper.java
@@ -58,4 +58,8 @@
 	 * @return 圈子表集合
 	 */
 	public List<CircleVO> selectCircleList(CircleDTO circleDTO);
+
+
+
+
 }
diff --git a/src/main/java/org/springblade/modules/circle/mapper/CircleMapper.xml b/src/main/java/org/springblade/modules/circle/mapper/CircleMapper.xml
index 9f02f39..b852820 100644
--- a/src/main/java/org/springblade/modules/circle/mapper/CircleMapper.xml
+++ b/src/main/java/org/springblade/modules/circle/mapper/CircleMapper.xml
@@ -49,7 +49,7 @@
 
 
     <select id="selectCirclePage" resultMap="CircleVOResult">
-        select  jc.id,
+        select jc.id,
         jc.user_id,
         jc.create_time,
         jc.circle_text,
@@ -59,18 +59,26 @@
         bu.name,
         bu.avatar,
         jc.circle_type,
-        (select count(1) from jczz_circle_like jcl where jcl.circle_id = jc.id  and  jcl.user_id  = #{circle.userId}  ) likeFlag
+        (select count(1) from jczz_circle_like jcl where jcl.circle_id = jc.id and jcl.user_id = #{circle.userIds} and
+        jcl.delete_flag = 0 ) likeFlag
         from jczz_circle jc left join blade_user bu on jc.user_id = bu.id
         <where>
-            <if test="circle.id != null "> and id = #{circle.id}</if>
-            <if test="circle.userId != null "> and user_id = #{circle.userId}</if>
-            <if test="circle.createTime != null "> and create_time = #{circle.createTime}</if>
-            <if test="circle.circleText != null  and circle.circleText != ''"> and circle_text = #{circle.circleText}</if>
-            <if test="circle.circleImages != null  and circle.circleImages != ''"> and circle_images = #{circle.circleImages}</if>
-            <if test="circle.circleVideo != null  and circle.circleVideo != ''"> and circle_video = #{circle.circleVideo}</if>
-            <if test="circle.deletedFalg != null "> and deleted_falg = #{circle.deletedFalg}</if>
-            <if test="circle.circleType != null "> and circle_type = #{circle.circleType}</if>
+            <if test="circle.id != null ">and jc.id = #{circle.id}</if>
+            <if test="circle.userId != null ">and jc.user_id = #{circle.userId}</if>
+            <if test="circle.createTime != null ">and jc.create_time = #{circle.createTime}</if>
+            <if test="circle.circleText != null  and circle.circleText != ''">and jc.circle_text like concat
+                ('%',#{circle.circleText},'%')
+            </if>
+            <if test="circle.circleImages != null  and circle.circleImages != ''">and jc.circle_images =
+                #{circle.circleImages}
+            </if>
+            <if test="circle.circleVideo != null  and circle.circleVideo != ''">and jc.circle_video =
+                #{circle.circleVideo}
+            </if>
+            <if test="circle.deletedFalg != null ">and jc.deleted_falg = #{circle.deletedFalg}</if>
+            <if test="circle.circleType != null ">and jc.circle_type = #{circle.circleType}</if>
         </where>
+        order by jc.create_time desc
     </select>
 
 
diff --git a/src/main/java/org/springblade/modules/circle/service/ICircleCommentService.java b/src/main/java/org/springblade/modules/circle/service/ICircleCommentService.java
new file mode 100644
index 0000000..82a9f5c
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/service/ICircleCommentService.java
@@ -0,0 +1,43 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.circle.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.circle.entity.CircleCommentEntity;
+import org.springblade.modules.circle.vo.CircleCommentVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 圈子评论表 服务类
+ *
+ * @author BladeX
+ * @since 2023-12-01
+ */
+public interface ICircleCommentService extends IService<CircleCommentEntity> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param circle
+	 * @return
+	 */
+	IPage<CircleCommentVO> selectCircleCommentPage(IPage<CircleCommentVO> page, CircleCommentVO circle);
+
+
+}
diff --git a/src/main/java/org/springblade/modules/circle/service/impl/CircleCommentServiceImpl.java b/src/main/java/org/springblade/modules/circle/service/impl/CircleCommentServiceImpl.java
new file mode 100644
index 0000000..261ecd8
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/service/impl/CircleCommentServiceImpl.java
@@ -0,0 +1,43 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.circle.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.circle.entity.CircleCommentEntity;
+import org.springblade.modules.circle.vo.CircleCommentVO;
+import org.springblade.modules.circle.mapper.CircleCommentMapper;
+import org.springblade.modules.circle.service.ICircleCommentService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 圈子评论表 服务实现类
+ *
+ * @author BladeX
+ * @since 2023-12-01
+ */
+@Service
+public class CircleCommentServiceImpl extends ServiceImpl<CircleCommentMapper, CircleCommentEntity> implements ICircleCommentService {
+
+	@Override
+	public IPage<CircleCommentVO> selectCircleCommentPage(IPage<CircleCommentVO> page, CircleCommentVO circle) {
+		return page.setRecords(baseMapper.selectCircleCommentPage(page, circle));
+	}
+
+
+}
diff --git a/src/main/java/org/springblade/modules/circle/service/impl/CircleServiceImpl.java b/src/main/java/org/springblade/modules/circle/service/impl/CircleServiceImpl.java
index 0fc9a6c..c31a086 100644
--- a/src/main/java/org/springblade/modules/circle/service/impl/CircleServiceImpl.java
+++ b/src/main/java/org/springblade/modules/circle/service/impl/CircleServiceImpl.java
@@ -16,13 +16,19 @@
  */
 package org.springblade.modules.circle.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springblade.modules.circle.dto.CircleDTO;
+import org.springblade.modules.circle.entity.CircleCommentEntity;
 import org.springblade.modules.circle.entity.CircleEntity;
+import org.springblade.modules.circle.entity.CircleLikeEntity;
+import org.springblade.modules.circle.service.ICircleCommentService;
+import org.springblade.modules.circle.service.ICircleLikeService;
 import org.springblade.modules.circle.vo.CircleVO;
 import org.springblade.modules.circle.mapper.CircleMapper;
 import org.springblade.modules.circle.service.ICircleService;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
@@ -37,9 +43,27 @@
 @Service
 public class CircleServiceImpl extends ServiceImpl<CircleMapper, CircleEntity> implements ICircleService {
 
+	@Autowired
+	private ICircleLikeService iCircleLikeService;
+
+	@Autowired
+	private ICircleCommentService iCircleCommentService;
 	@Override
 	public IPage<CircleVO> selectCirclePage(IPage<CircleVO> page, CircleVO circle) {
-		return page.setRecords(baseMapper.selectCirclePage(page, circle));
+		List<CircleVO> circleVOS = baseMapper.selectCirclePage(page, circle);
+		for (CircleVO circleVO : circleVOS) {
+			// 获取circleVO中circleId的点赞数
+			long count = iCircleLikeService.count(Wrappers.<CircleLikeEntity>lambdaQuery()
+				.eq(CircleLikeEntity::getCircleId, circleVO.getId()));
+			circleVO.setLikeCount(count);
+
+			// 查询circle_comment表中circle_id等于circleVO.getId()的记录数
+			long count2 = iCircleCommentService.count(Wrappers.<CircleCommentEntity>lambdaQuery()
+				.eq(CircleCommentEntity::getCircleId, circleVO.getId())
+				.groupBy(CircleCommentEntity::getCircleId));
+			circleVO.setCommentCount(count2);
+		}
+		return page.setRecords(circleVOS);
 	}
 
 	/**
diff --git a/src/main/java/org/springblade/modules/circle/vo/CircleCommentVO.java b/src/main/java/org/springblade/modules/circle/vo/CircleCommentVO.java
new file mode 100644
index 0000000..440f24d
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/vo/CircleCommentVO.java
@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.circle.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.circle.entity.CircleCommentEntity;
+
+import java.util.List;
+
+/**
+ * 圈子评论表 视图实体类
+ *
+ * @author BladeX
+ * @since 2023-12-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CircleCommentVO extends CircleCommentEntity {
+	private static final long serialVersionUID = 1L;
+
+	private List<CircleCommentVO> children;
+
+	private String name;
+
+	private String avatar;
+
+}
diff --git a/src/main/java/org/springblade/modules/circle/vo/CircleVO.java b/src/main/java/org/springblade/modules/circle/vo/CircleVO.java
index 789f508..34afb2b 100644
--- a/src/main/java/org/springblade/modules/circle/vo/CircleVO.java
+++ b/src/main/java/org/springblade/modules/circle/vo/CircleVO.java
@@ -38,4 +38,10 @@
 
 	private Integer likeFlag;
 
+	private Long userIds;
+
+	private Long commentCount;
+
+	private Long likeCount;
+
 }
diff --git a/src/main/java/org/springblade/modules/circle/wrapper/CircleCommentWrapper.java b/src/main/java/org/springblade/modules/circle/wrapper/CircleCommentWrapper.java
new file mode 100644
index 0000000..4bffcd9
--- /dev/null
+++ b/src/main/java/org/springblade/modules/circle/wrapper/CircleCommentWrapper.java
@@ -0,0 +1,50 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.circle.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.modules.circle.entity.CircleCommentEntity;
+import org.springblade.modules.circle.vo.CircleCommentVO;
+import java.util.Objects;
+
+/**
+ * 圈子评论表 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2023-12-01
+ */
+public class CircleCommentWrapper extends BaseEntityWrapper<CircleCommentEntity, CircleCommentVO>  {
+
+	public static CircleCommentWrapper build() {
+		return new CircleCommentWrapper();
+ 	}
+
+	@Override
+	public CircleCommentVO entityVO(CircleCommentEntity circle) {
+		CircleCommentVO circleVO = Objects.requireNonNull(BeanUtil.copy(circle, CircleCommentVO.class));
+
+		//User createUser = UserCache.getUser(circle.getCreateUser());
+		//User updateUser = UserCache.getUser(circle.getUpdateUser());
+		//circleVO.setCreateUserName(createUser.getName());
+		//circleVO.setUpdateUserName(updateUser.getName());
+
+		return circleVO;
+	}
+
+
+}

--
Gitblit v1.9.3