From ed0dc655e6732f15d30f399c0d460ad7b9fe42da Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期三, 04 六月 2025 16:55:42 +0800
Subject: [PATCH] add:影视作品点赞和评论点赞
---
src/main/java/com/mzl/flower/service/film/CommentLikesService.java | 4
src/main/java/com/mzl/flower/mapper/film/CommentPoMapper.java | 102 ++
src/main/java/com/mzl/flower/mapper/film/LikeCommentPoMapper.java | 97 ++
src/main/java/com/mzl/flower/dto/request/film/CommentLikesDTO.java | 97 --
pom.xml | 75 +
src/main/java/com/mzl/flower/service/film/FilmLikesService.java | 2
src/main/java/com/mzl/flower/service/film/impl/CommentLikesServiceImpl.java | 31
src/main/java/com/mzl/flower/service/film/impl/FilmLikesServiceImpl.java | 28
src/main/java/com/mzl/flower/web/film/CommentController.java | 56 +
src/main/java/com/mzl/flower/mapper/film/CommentPoExMapper.java | 41
src/main/java/com/mzl/flower/entity/film/CommentPo.java | 37
src/main/java/com/mzl/flower/service/film/CommentService.java | 105 ++
src/main/resources/mapper/film/CommentPoExMapper.xml | 54 +
src/main/java/com/mzl/flower/dto/response/film/CommentDTO.java | 99 ++
src/main/java/com/mzl/flower/mapper/film/LikeCommentPoExMapper.java | 22
src/main/java/com/mzl/flower/service/system/UserService.java | 4
src/main/java/com/mzl/flower/mapper/film/CommentLikesMapper.java | 29
src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java | 297 ++++++
src/main/resources/mapper/film/CommentPoMapper.xml | 279 ++++++
src/main/java/com/mzl/flower/mapper/film/FilmLikesMapper.java | 2
src/main/java/com/mzl/flower/entity/film/CommentPoExample.java | 809 +++++++++++++++++
src/main/java/com/mzl/flower/mapper/film/CommonMS.java | 52 +
src/main/java/com/mzl/flower/utils/CommentTreeUtils.java | 53 +
src/main/resources/mapper/film/LikeCommentPoExMapper.xml | 27
src/main/java/com/mzl/flower/enums/SortRuleEnum.java | 24
src/main/java/com/mzl/flower/entity/film/CommentLikes.java | 2
src/main/resources/mapper/system/UserMapper.xml | 11
src/main/resources/mapper/film/LikeCommentPoMapper.xml | 220 ++++
src/main/java/com/mzl/flower/dto/request/film/FilmLikesDTO.java | 2
src/main/java/com/mzl/flower/mapper/film/CommentMS.java | 15
src/main/java/com/mzl/flower/dto/request/film/CommentSearchDTO.java | 51 +
src/main/java/com/mzl/flower/web/film/CommentLikesController.java | 10
32 files changed, 2,627 insertions(+), 110 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2702f56..c38859f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,6 +22,10 @@
<io.swagger.version>1.5.22</io.swagger.version>
<base.version>1.0-SNAPSHOT</base.version>
<mybatis-plus.version>3.4.1</mybatis-plus.version>
+ <pagehelper-spring-boot-starter.version>1.3.0</pagehelper-spring-boot-starter.version>
+ <mapstruct.version>1.4.2.Final</mapstruct.version>
+ <lombok.version>1.18.20</lombok.version>
+ <lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
</properties>
<dependencies>
@@ -322,6 +326,50 @@
<version>${tomcat.version}</version> <!-- 通常由Spring Boot管理 -->
</dependency>
+ <!-- pagehelper分页-start -->
+ <dependency>
+ <groupId>com.github.pagehelper</groupId>
+ <artifactId>pagehelper-spring-boot-starter</artifactId>
+ <version>${pagehelper-spring-boot-starter.version}</version>
+<!-- <exclusions>-->
+<!-- <exclusion>-->
+<!-- <groupId>org.mybatis.spring.boot</groupId>-->
+<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
+<!-- </exclusion>-->
+<!-- </exclusions>-->
+ </dependency>
+ <dependency>
+ <groupId>org.mapstruct</groupId>
+ <artifactId>mapstruct</artifactId>
+ <version>${mapstruct.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mapstruct</groupId>
+ <artifactId>mapstruct-processor</artifactId>
+ <version>${mapstruct.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok-mapstruct-binding</artifactId>
+ <version>${lombok-mapstruct-binding.version}</version>
+ </dependency>
+ <!-- pagehelper分页-end -->
+
+<!-- <!–代码生成器依赖–>-->
+<!-- <dependency>-->
+<!-- <groupId>org.freemarker</groupId>-->
+<!-- <artifactId>freemarker</artifactId>-->
+<!-- <version>${freemarker.version}</version>-->
+<!-- <scope>test</scope>-->
+<!-- </dependency>-->
+
+<!-- <dependency>-->
+<!-- <groupId>com.baomidou</groupId>-->
+<!-- <artifactId>mybatis-plus-generator</artifactId>-->
+<!-- <version>${mybatis-plus.version}</version>-->
+<!-- <scope>test</scope>-->
+<!-- </dependency>-->
</dependencies>
@@ -333,6 +381,33 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ <encoding>UTF-8</encoding>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>org.mapstruct</groupId>
+ <artifactId>mapstruct-processor</artifactId>
+ <version>${mapstruct.version}</version>
+ </path>
+ <path>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ </path>
+ <path>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok-mapstruct-binding</artifactId>
+ <version>${lombok-mapstruct-binding.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
diff --git a/src/main/java/com/mzl/flower/dto/request/film/CommentLikesDTO.java b/src/main/java/com/mzl/flower/dto/request/film/CommentLikesDTO.java
index 13627d3..f35ec6d 100644
--- a/src/main/java/com/mzl/flower/dto/request/film/CommentLikesDTO.java
+++ b/src/main/java/com/mzl/flower/dto/request/film/CommentLikesDTO.java
@@ -2,105 +2,16 @@
import lombok.Data;
-import java.math.BigDecimal;
-import java.time.LocalDate;
@Data
public class CommentLikesDTO {
/**
- * 关联的影视作品ID
+ * 评论ID
*/
- private Integer filmId;
+ private Integer commentId;
/**
- * 拍摄地点名称
+ * 点赞状态(0取消,1有效)
*/
- private String locationName;
-
- /**
- * 详细地址
- */
- private String address;
-
- /**
- * 纬度坐标(精确到小数点后6位)
- */
- private BigDecimal gpsLat;
-
- /**
- * 经度坐标(精确到小数点后6位)
- */
- private BigDecimal gpsLng;
-
- /**
- * 拍摄开始日期
- */
- private LocalDate startDate;
-
- /**
- * 拍摄结束日期
- */
- private LocalDate endDate;
-
- /**
- * 场景类型
- */
- private String sceneType;
-
- /**
- * 经典画面描述
- */
- private String classicScene;
-
- /**
- * 是否开放参观(0否,1是)
- */
- private Boolean isOpenVisit;
-
- /**
- * 参观提示(JSON格式存储)
- */
- private String visitInfo;
-
- /**
- * 地标性建筑描述
- */
- private String landmarkDesc;
-
- /**
- * 交通指引说明
- */
- private String transportGuide;
-
- /**
- * 停车场信息
- */
- private String parkingInfo;
-
- /**
- * 周边设施描述
- */
- private String surroundingFacilities;
-
- /**
- * AR实景对比功能入口URL
- */
- private String arEntry;
-
- /**
- * 状态(0禁用,1启用)
- */
- private Integer status;
-
-
- /**
- * 打卡记录量
- */
- private Integer checkinCount;
-
- /**
- * 游客实拍图(存储JSON数组)
- */
- private String visitorPhotos;
-
+ private Boolean status;
}
diff --git a/src/main/java/com/mzl/flower/dto/request/film/CommentSearchDTO.java b/src/main/java/com/mzl/flower/dto/request/film/CommentSearchDTO.java
new file mode 100644
index 0000000..0d0787b
--- /dev/null
+++ b/src/main/java/com/mzl/flower/dto/request/film/CommentSearchDTO.java
@@ -0,0 +1,51 @@
+package com.mzl.flower.dto.request.film;
+
+import com.mzl.flower.enums.SortRuleEnum;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author fanghaowei
+ * @date 2025/4/6 15:06
+ */
+@Data
+public class CommentSearchDTO implements Serializable {
+ /**
+ * 评论编号
+ */
+ private Integer id;
+
+ /**
+ * 评论内容
+ */
+ private String content;
+
+ /**
+ * 评论用户id
+ */
+ private String createBy;
+
+ /**
+ * 文章id
+ */
+ private Integer filmId;
+
+ /**
+ * 排序规则
+ */
+ private SortRuleEnum sortRule;
+
+ /**
+ * 当前页
+ */
+ private Integer currentPage;
+
+ /**
+ * 每页条数
+ */
+ private Integer pageSize;
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/com/mzl/flower/dto/request/film/FilmLikesDTO.java b/src/main/java/com/mzl/flower/dto/request/film/FilmLikesDTO.java
index 682efc4..fde8c23 100644
--- a/src/main/java/com/mzl/flower/dto/request/film/FilmLikesDTO.java
+++ b/src/main/java/com/mzl/flower/dto/request/film/FilmLikesDTO.java
@@ -90,7 +90,7 @@
/**
* 状态(0禁用,1启用)
*/
- private Integer status;
+ private Boolean status;
/**
diff --git a/src/main/java/com/mzl/flower/dto/response/film/CommentDTO.java b/src/main/java/com/mzl/flower/dto/response/film/CommentDTO.java
new file mode 100644
index 0000000..1adc109
--- /dev/null
+++ b/src/main/java/com/mzl/flower/dto/response/film/CommentDTO.java
@@ -0,0 +1,99 @@
+package com.mzl.flower.dto.response.film;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @author fanghaowei
+ * @date 2025/6/6 14:30
+ */
+@Data
+public class CommentDTO implements Serializable {
+ /**
+ * 评论编号
+ */
+ private Integer id;
+
+ /**
+ * 父评论id
+ */
+ private Integer parentId;
+
+ /**
+ * 评论内容
+ */
+ private String content;
+
+ /**
+ * 被评论帖子id
+ */
+ private Integer filmId;
+
+ /**
+ * 状态(0禁用,1启用)
+ */
+ private Boolean state;
+
+ /**
+ * 逻辑删除(0正常,1删除)
+ */
+ private Boolean deleted;
+
+ /**
+ * 评论用户id
+ */
+ private String createBy;
+
+ /**
+ * 评论用户名称
+ */
+ private String commentUserName;
+
+ /**
+ * 用户头像
+ */
+ private String picture;
+
+ /**
+ * 等级(Lv6)
+ */
+ private String level;
+
+ /**
+ * 是否点赞
+ */
+ private Boolean isLike;
+
+ /**
+ * 点赞数量
+ */
+ private Long likeCount;
+
+ /**
+ * 回复数量
+ */
+ private Integer repliesCount;
+
+ /**
+ * 评论深度
+ */
+ private Integer depth;
+
+ /**
+ * 创建时间
+ */
+ private LocalDateTime createTime;
+
+ /**
+ * 更新时间
+ */
+ private LocalDateTime updateTime;
+
+ private List<CommentDTO> child;
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/com/mzl/flower/entity/film/CommentLikes.java b/src/main/java/com/mzl/flower/entity/film/CommentLikes.java
index 0ab4f97..f3482d1 100644
--- a/src/main/java/com/mzl/flower/entity/film/CommentLikes.java
+++ b/src/main/java/com/mzl/flower/entity/film/CommentLikes.java
@@ -5,7 +5,7 @@
import lombok.Data;
/**
- * 影视作品点赞表
+ * 评论点赞表
*
* @author generator@Fang
* @since 2025-05-29
diff --git a/src/main/java/com/mzl/flower/entity/film/CommentPo.java b/src/main/java/com/mzl/flower/entity/film/CommentPo.java
new file mode 100644
index 0000000..9e9b8f2
--- /dev/null
+++ b/src/main/java/com/mzl/flower/entity/film/CommentPo.java
@@ -0,0 +1,37 @@
+package com.mzl.flower.entity.film;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.mzl.flower.base.BaseAutoPhyEntity;
+import lombok.Data;
+
+
+@Data
+@TableName("film_comments")
+public class CommentPo extends BaseAutoPhyEntity {
+
+ /**
+ * 父评论id
+ */
+ @TableField("parent_id")
+ private Integer parentId;
+
+ /**
+ * 被评论帖子id
+ */
+ @TableField("film_id")
+ private Integer filmId;
+
+ /**
+ * 评论内容
+ */
+ @TableField("content")
+ private String content;
+
+ /**
+ * 状态(0禁用,1启用)
+ */
+ @TableField("state")
+ private Boolean state;
+
+}
diff --git a/src/main/java/com/mzl/flower/entity/film/CommentPoExample.java b/src/main/java/com/mzl/flower/entity/film/CommentPoExample.java
new file mode 100644
index 0000000..8e11af6
--- /dev/null
+++ b/src/main/java/com/mzl/flower/entity/film/CommentPoExample.java
@@ -0,0 +1,809 @@
+package com.mzl.flower.entity.film;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CommentPoExample {
+ protected String orderByClause;
+
+ protected boolean distinct;
+
+ protected List<Criteria> oredCriteria;
+
+ /**
+ * CommentPoExample
+ *
+ * @return
+ */
+ public CommentPoExample() {
+ oredCriteria = new ArrayList<Criteria>();
+ }
+
+ /**
+ * setOrderByClause
+ *
+ * @param orderByClause
+ * @return
+ */
+ public void setOrderByClause(String orderByClause) {
+ this.orderByClause = orderByClause;
+ }
+
+ /**
+ * getOrderByClause
+ *
+ * @return
+ */
+ public String getOrderByClause() {
+ return orderByClause;
+ }
+
+ /**
+ * setDistinct
+ *
+ * @param distinct
+ * @return
+ */
+ public void setDistinct(boolean distinct) {
+ this.distinct = distinct;
+ }
+
+ /**
+ * isDistinct
+ *
+ * @return
+ */
+ public boolean isDistinct() {
+ return distinct;
+ }
+
+ /**
+ * getOredCriteria
+ *
+ * @return
+ */
+ public List<Criteria> getOredCriteria() {
+ return oredCriteria;
+ }
+
+ /**
+ * or
+ *
+ * @param criteria
+ * @return
+ */
+ public void or(Criteria criteria) {
+ oredCriteria.add(criteria);
+ }
+
+ /**
+ * or
+ *
+ * @return
+ */
+ public Criteria or() {
+ Criteria criteria = createCriteriaInternal();
+ oredCriteria.add(criteria);
+ return criteria;
+ }
+
+ /**
+ * createCriteria
+ *
+ * @return
+ */
+ public Criteria createCriteria() {
+ Criteria criteria = createCriteriaInternal();
+ if (oredCriteria.size() == 0) {
+ oredCriteria.add(criteria);
+ }
+ return criteria;
+ }
+
+ /**
+ * createCriteriaInternal
+ *
+ * @return
+ */
+ protected Criteria createCriteriaInternal() {
+ Criteria criteria = new Criteria();
+ return criteria;
+ }
+
+ /**
+ * clear
+ *
+ * @return
+ */
+ public void clear() {
+ oredCriteria.clear();
+ orderByClause = null;
+ distinct = false;
+ }
+
+ protected abstract static class GeneratedCriteria {
+ protected List<Criterion> criteria;
+
+ protected GeneratedCriteria() {
+ super();
+ criteria = new ArrayList<Criterion>();
+ }
+
+ public boolean isValid() {
+ return criteria.size() > 0;
+ }
+
+ public List<Criterion> getAllCriteria() {
+ return criteria;
+ }
+
+ public List<Criterion> getCriteria() {
+ return criteria;
+ }
+
+ protected void addCriterion(String condition) {
+ if (condition == null) {
+ throw new RuntimeException("Value for condition cannot be null");
+ }
+ criteria.add(new Criterion(condition));
+ }
+
+ protected void addCriterion(String condition, Object value, String property) {
+ if (value == null) {
+ throw new RuntimeException("Value for " + property + " cannot be null");
+ }
+ criteria.add(new Criterion(condition, value));
+ }
+
+ protected void addCriterion(String condition, Object value1, Object value2, String property) {
+ if (value1 == null || value2 == null) {
+ throw new RuntimeException("Between values for " + property + " cannot be null");
+ }
+ criteria.add(new Criterion(condition, value1, value2));
+ }
+
+ public Criteria andIdIsNull() {
+ addCriterion("id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdIsNotNull() {
+ addCriterion("id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdEqualTo(Integer value) {
+ addCriterion("id =", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotEqualTo(Integer value) {
+ addCriterion("id <>", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdGreaterThan(Integer value) {
+ addCriterion("id >", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("id >=", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdLessThan(Integer value) {
+ addCriterion("id <", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdLessThanOrEqualTo(Integer value) {
+ addCriterion("id <=", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdIn(List<Integer> values) {
+ addCriterion("id in", values, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotIn(List<Integer> values) {
+ addCriterion("id not in", values, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdBetween(Integer value1, Integer value2) {
+ addCriterion("id between", value1, value2, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("id not between", value1, value2, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdIsNull() {
+ addCriterion("parent_id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdIsNotNull() {
+ addCriterion("parent_id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdEqualTo(Integer value) {
+ addCriterion("parent_id =", value, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdNotEqualTo(Integer value) {
+ addCriterion("parent_id <>", value, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdGreaterThan(Integer value) {
+ addCriterion("parent_id >", value, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("parent_id >=", value, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdLessThan(Integer value) {
+ addCriterion("parent_id <", value, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdLessThanOrEqualTo(Integer value) {
+ addCriterion("parent_id <=", value, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdIn(List<Integer> values) {
+ addCriterion("parent_id in", values, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdNotIn(List<Integer> values) {
+ addCriterion("parent_id not in", values, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdBetween(Integer value1, Integer value2) {
+ addCriterion("parent_id between", value1, value2, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andPreIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("parent_id not between", value1, value2, "parentId");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentIsNull() {
+ addCriterion("content is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentIsNotNull() {
+ addCriterion("content is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentEqualTo(String value) {
+ addCriterion("content =", value, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentNotEqualTo(String value) {
+ addCriterion("content <>", value, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentGreaterThan(String value) {
+ addCriterion("content >", value, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentGreaterThanOrEqualTo(String value) {
+ addCriterion("content >=", value, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentLessThan(String value) {
+ addCriterion("content <", value, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentLessThanOrEqualTo(String value) {
+ addCriterion("content <=", value, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentLike(String value) {
+ addCriterion("content like", value, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentNotLike(String value) {
+ addCriterion("content not like", value, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentIn(List<String> values) {
+ addCriterion("content in", values, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentNotIn(List<String> values) {
+ addCriterion("content not in", values, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentBetween(String value1, String value2) {
+ addCriterion("content between", value1, value2, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentNotBetween(String value1, String value2) {
+ addCriterion("content not between", value1, value2, "content");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdIsNull() {
+ addCriterion("film_id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdIsNotNull() {
+ addCriterion("film_id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdEqualTo(Integer value) {
+ addCriterion("film_id =", value, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdNotEqualTo(Integer value) {
+ addCriterion("film_id <>", value, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdGreaterThan(Integer value) {
+ addCriterion("film_id >", value, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("film_id >=", value, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdLessThan(Integer value) {
+ addCriterion("film_id <", value, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdLessThanOrEqualTo(Integer value) {
+ addCriterion("film_id <=", value, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdIn(List<Integer> values) {
+ addCriterion("film_id in", values, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdNotIn(List<Integer> values) {
+ addCriterion("film_id not in", values, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdBetween(Integer value1, Integer value2) {
+ addCriterion("film_id between", value1, value2, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andArticleIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("film_id not between", value1, value2, "filmId");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateIsNull() {
+ addCriterion("`state` is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateIsNotNull() {
+ addCriterion("`state` is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateEqualTo(Boolean value) {
+ addCriterion("`state` =", value, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateNotEqualTo(Boolean value) {
+ addCriterion("`state` <>", value, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateGreaterThan(Boolean value) {
+ addCriterion("`state` >", value, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateGreaterThanOrEqualTo(Boolean value) {
+ addCriterion("`state` >=", value, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateLessThan(Boolean value) {
+ addCriterion("`state` <", value, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateLessThanOrEqualTo(Boolean value) {
+ addCriterion("`state` <=", value, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateIn(List<Boolean> values) {
+ addCriterion("`state` in", values, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateNotIn(List<Boolean> values) {
+ addCriterion("`state` not in", values, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateBetween(Boolean value1, Boolean value2) {
+ addCriterion("`state` between", value1, value2, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andStateNotBetween(Boolean value1, Boolean value2) {
+ addCriterion("`state` not between", value1, value2, "state");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedIsNull() {
+ addCriterion("deleted is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedIsNotNull() {
+ addCriterion("deleted is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedEqualTo(Boolean value) {
+ addCriterion("deleted =", value, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedNotEqualTo(Boolean value) {
+ addCriterion("deleted <>", value, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedGreaterThan(Boolean value) {
+ addCriterion("deleted >", value, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedGreaterThanOrEqualTo(Boolean value) {
+ addCriterion("deleted >=", value, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedLessThan(Boolean value) {
+ addCriterion("deleted <", value, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedLessThanOrEqualTo(Boolean value) {
+ addCriterion("deleted <=", value, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedIn(List<Boolean> values) {
+ addCriterion("deleted in", values, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedNotIn(List<Boolean> values) {
+ addCriterion("deleted not in", values, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedBetween(Boolean value1, Boolean value2) {
+ addCriterion("deleted between", value1, value2, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsDeletedNotBetween(Boolean value1, Boolean value2) {
+ addCriterion("deleted not between", value1, value2, "deleted");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserIsNull() {
+ addCriterion("comment_user is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserIsNotNull() {
+ addCriterion("comment_user is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserEqualTo(Long value) {
+ addCriterion("comment_user =", value, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserNotEqualTo(Long value) {
+ addCriterion("comment_user <>", value, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserGreaterThan(Long value) {
+ addCriterion("comment_user >", value, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserGreaterThanOrEqualTo(Long value) {
+ addCriterion("comment_user >=", value, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserLessThan(Long value) {
+ addCriterion("comment_user <", value, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserLessThanOrEqualTo(Long value) {
+ addCriterion("comment_user <=", value, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserIn(List<Long> values) {
+ addCriterion("comment_user in", values, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserNotIn(List<Long> values) {
+ addCriterion("comment_user not in", values, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserBetween(Long value1, Long value2) {
+ addCriterion("comment_user between", value1, value2, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCommentUserNotBetween(Long value1, Long value2) {
+ addCriterion("comment_user not between", value1, value2, "commentUser");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeIsNull() {
+ addCriterion("create_time is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeIsNotNull() {
+ addCriterion("create_time is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeEqualTo(LocalDateTime value) {
+ addCriterion("create_time =", value, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeNotEqualTo(LocalDateTime value) {
+ addCriterion("create_time <>", value, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeGreaterThan(LocalDateTime value) {
+ addCriterion("create_time >", value, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) {
+ addCriterion("create_time >=", value, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeLessThan(LocalDateTime value) {
+ addCriterion("create_time <", value, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) {
+ addCriterion("create_time <=", value, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeIn(List<LocalDateTime> values) {
+ addCriterion("create_time in", values, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeNotIn(List<LocalDateTime> values) {
+ addCriterion("create_time not in", values, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
+ addCriterion("create_time between", value1, value2, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
+ addCriterion("create_time not between", value1, value2, "createTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeIsNull() {
+ addCriterion("update_time is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeIsNotNull() {
+ addCriterion("update_time is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeEqualTo(LocalDateTime value) {
+ addCriterion("update_time =", value, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeNotEqualTo(LocalDateTime value) {
+ addCriterion("update_time <>", value, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeGreaterThan(LocalDateTime value) {
+ addCriterion("update_time >", value, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeGreaterThanOrEqualTo(LocalDateTime value) {
+ addCriterion("update_time >=", value, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeLessThan(LocalDateTime value) {
+ addCriterion("update_time <", value, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeLessThanOrEqualTo(LocalDateTime value) {
+ addCriterion("update_time <=", value, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeIn(List<LocalDateTime> values) {
+ addCriterion("update_time in", values, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeNotIn(List<LocalDateTime> values) {
+ addCriterion("update_time not in", values, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
+ addCriterion("update_time between", value1, value2, "updateTime");
+ return (Criteria) this;
+ }
+
+ public Criteria andUpdateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
+ addCriterion("update_time not between", value1, value2, "updateTime");
+ return (Criteria) this;
+ }
+ }
+
+ public static class Criteria extends GeneratedCriteria {
+
+ protected Criteria() {
+ super();
+ }
+ }
+
+ public static class Criterion {
+ private String condition;
+
+ private Object value;
+
+ private Object secondValue;
+
+ private boolean noValue;
+
+ private boolean singleValue;
+
+ private boolean betweenValue;
+
+ private boolean listValue;
+
+ private String typeHandler;
+
+ public String getCondition() {
+ return condition;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object getSecondValue() {
+ return secondValue;
+ }
+
+ public boolean isNoValue() {
+ return noValue;
+ }
+
+ public boolean isSingleValue() {
+ return singleValue;
+ }
+
+ public boolean isBetweenValue() {
+ return betweenValue;
+ }
+
+ public boolean isListValue() {
+ return listValue;
+ }
+
+ public String getTypeHandler() {
+ return typeHandler;
+ }
+
+ protected Criterion(String condition) {
+ super();
+ this.condition = condition;
+ this.typeHandler = null;
+ this.noValue = true;
+ }
+
+ protected Criterion(String condition, Object value, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.typeHandler = typeHandler;
+ if (value instanceof List<?>) {
+ this.listValue = true;
+ } else {
+ this.singleValue = true;
+ }
+ }
+
+ protected Criterion(String condition, Object value) {
+ this(condition, value, null);
+ }
+
+ protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.secondValue = secondValue;
+ this.typeHandler = typeHandler;
+ this.betweenValue = true;
+ }
+
+ protected Criterion(String condition, Object value, Object secondValue) {
+ this(condition, value, secondValue, null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/mzl/flower/enums/SortRuleEnum.java b/src/main/java/com/mzl/flower/enums/SortRuleEnum.java
new file mode 100644
index 0000000..b1878f3
--- /dev/null
+++ b/src/main/java/com/mzl/flower/enums/SortRuleEnum.java
@@ -0,0 +1,24 @@
+package com.mzl.flower.enums;
+
+import lombok.Getter;
+
+/**
+ * 影视作品排序
+ */
+@Getter
+public enum SortRuleEnum {
+ /**
+ * 最热,最新
+ */
+ hottest("最热"), newest("最新");
+
+ /**
+ * 说明
+ */
+ private String desc;
+
+ SortRuleEnum(String name) {
+ this.desc = name;
+ }
+
+}
diff --git a/src/main/java/com/mzl/flower/mapper/film/CommentLikesMapper.java b/src/main/java/com/mzl/flower/mapper/film/CommentLikesMapper.java
index e17611d..e70d5b6 100644
--- a/src/main/java/com/mzl/flower/mapper/film/CommentLikesMapper.java
+++ b/src/main/java/com/mzl/flower/mapper/film/CommentLikesMapper.java
@@ -2,15 +2,32 @@
import com.mzl.flower.entity.film.CommentLikes;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
/**
- * <p>
- * 影视作品点赞表 Mapper 接口
- * </p>
- *
- * @author generator@Fang
- * @since 2025-05-29
+ * 评论点赞表 Mapper
*/
+@Repository
public interface CommentLikesMapper extends BaseMapper<CommentLikes> {
+ /**
+ * 根据评论id查询点赞数量
+ */
+ @Select("select count(1) from comment_likes where status = '1' and comment_id =#{ id} ")
+ Long getLikeCountCommentId(Integer id);
+
+ /**
+ * 判断用户是否点赞
+ */
+ @Select("select status from comment_likes where comment_id = #{commentId} and create_by = #{userId} ")
+ Boolean isLike(Integer commentId, String userId);
+
+ /**
+ * 查询人员有没有对应的评论点赞信息
+ */
+
+ @Select("select * from comment_likes where create_by = #{userId} and comment_id = #{commentId} ")
+ CommentLikes getCommentLikeByUserIdAndCommentId(String userId, Integer commentId);
+
}
diff --git a/src/main/java/com/mzl/flower/mapper/film/CommentMS.java b/src/main/java/com/mzl/flower/mapper/film/CommentMS.java
new file mode 100644
index 0000000..5a83793
--- /dev/null
+++ b/src/main/java/com/mzl/flower/mapper/film/CommentMS.java
@@ -0,0 +1,15 @@
+package com.mzl.flower.mapper.film;
+
+import com.mzl.flower.dto.response.film.CommentDTO;
+import com.mzl.flower.entity.film.CommentPo;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * @author fanghaowei
+ * @date
+ */
+@Mapper(componentModel = "spring")
+public interface CommentMS extends CommonMS<CommentPo, CommentDTO> {
+ CommentMS INSTANCE = Mappers.getMapper(CommentMS.class);
+}
diff --git a/src/main/java/com/mzl/flower/mapper/film/CommentPoExMapper.java b/src/main/java/com/mzl/flower/mapper/film/CommentPoExMapper.java
new file mode 100644
index 0000000..3b97b5f
--- /dev/null
+++ b/src/main/java/com/mzl/flower/mapper/film/CommentPoExMapper.java
@@ -0,0 +1,41 @@
+package com.mzl.flower.mapper.film;
+
+import com.mzl.flower.entity.film.CommentPo;
+import org.apache.ibatis.annotations.Param;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @author fanghaowei
+ */
+public interface CommentPoExMapper {
+
+ /**
+ * 获取最新评论信息
+ *
+ * @param content
+ * @param commentUser
+ * @return
+ */
+ List<CommentPo> selectLatestComments(String content, String commentUser);
+
+ /**
+ * 获取所有通过审核文章的评论信息
+ *
+ * @param startTime
+ * @param endTime
+ * @return
+ */
+ List<CommentPo> getAllArticleComment(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
+
+ /**
+ * 获取所有通过审核文章的评论回复信息
+ *
+ * @param startTime
+ * @param endTime
+ * @return
+ */
+ List<CommentPo> getAllCommentReply(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
+
+}
diff --git a/src/main/java/com/mzl/flower/mapper/film/CommentPoMapper.java b/src/main/java/com/mzl/flower/mapper/film/CommentPoMapper.java
new file mode 100644
index 0000000..7ea15f3
--- /dev/null
+++ b/src/main/java/com/mzl/flower/mapper/film/CommentPoMapper.java
@@ -0,0 +1,102 @@
+package com.mzl.flower.mapper.film;
+
+import com.mzl.flower.entity.film.CommentPo;
+import com.mzl.flower.entity.film.CommentPoExample;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+public interface CommentPoMapper {
+ /**
+ * countByExample
+ *
+ * @param example
+ * @return
+ */
+ long countByExample(CommentPoExample example);
+
+ /**
+ * deleteByExample
+ *
+ * @param example
+ * @return
+ */
+ int deleteByExample(CommentPoExample example);
+
+ /**
+ * deleteByPrimaryKey
+ *
+ * @param id
+ * @return
+ */
+ int deleteByPrimaryKey(Integer id);
+
+ /**
+ * insert
+ *
+ * @param record
+ * @return
+ */
+ int insert(CommentPo record);
+
+ /**
+ * insertSelective
+ *
+ * @param record
+ * @return
+ */
+ int insertSelective(CommentPo record);
+
+ /**
+ * selectByExample
+ *
+ * @param example
+ * @return
+ */
+ List<CommentPo> selectByExample(CommentPoExample example);
+
+ /**
+ * selectByPrimaryKey
+ *
+ * @param id
+ * @return
+ */
+ CommentPo selectByPrimaryKey(Integer id);
+
+ /**
+ * updateByExampleSelective
+ *
+ * @param record
+ * @param example
+ * @return
+ */
+ int updateByExampleSelective(@Param("record") CommentPo record, @Param("example") CommentPoExample example);
+
+ /**
+ * updateByExample
+ *
+ * @param record
+ * @param example
+ * @return
+ */
+ int updateByExample(@Param("record") CommentPo record, @Param("example") CommentPoExample example);
+
+ /**
+ * updateByPrimaryKeySelective
+ *
+ * @param record
+ * @return
+ */
+ int updateByPrimaryKeySelective(CommentPo record);
+
+ /**
+ * updateByPrimaryKey
+ *
+ * @param record
+ * @return
+ */
+ int updateByPrimaryKey(CommentPo record);
+
+ List<CommentPo> selectByArticleId(Integer articleId);
+}
\ No newline at end of file
diff --git a/src/main/java/com/mzl/flower/mapper/film/CommonMS.java b/src/main/java/com/mzl/flower/mapper/film/CommonMS.java
new file mode 100644
index 0000000..aa1cbea
--- /dev/null
+++ b/src/main/java/com/mzl/flower/mapper/film/CommonMS.java
@@ -0,0 +1,52 @@
+package com.mzl.flower.mapper.film;
+
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
+
+/**
+ * @author fanghaowei
+ * @date
+ */
+public interface CommonMS<P, D> {
+ /**
+ * po转dto
+ *
+ * @param p po
+ * @return dto
+ */
+ D toDTO(P p);
+
+ /**
+ * dto转po
+ *
+ * @param d dto
+ * @return po
+ */
+ P toPo(D d);
+
+ /**
+ * po转dto
+ *
+ * @param pList po
+ * @return dto
+ */
+ List<D> toDTO(List<P> pList);
+
+ /**
+ * dto转po
+ *
+ * @param pList dto
+ * @return po
+ */
+ List<P> toPo(List<D> pList);
+
+ /**
+ * po转dto
+ *
+ * @param pageInfo po
+ * @return dto
+ */
+ PageInfo<D> toPage(PageInfo<P> pageInfo);
+
+}
diff --git a/src/main/java/com/mzl/flower/mapper/film/FilmLikesMapper.java b/src/main/java/com/mzl/flower/mapper/film/FilmLikesMapper.java
index 90b4d6b..81f01a2 100644
--- a/src/main/java/com/mzl/flower/mapper/film/FilmLikesMapper.java
+++ b/src/main/java/com/mzl/flower/mapper/film/FilmLikesMapper.java
@@ -2,6 +2,7 @@
import com.mzl.flower.entity.film.FilmLikes;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
/**
* <p>
@@ -11,6 +12,7 @@
* @author generator@Fang
* @since 2025-05-29
*/
+@Repository
public interface FilmLikesMapper extends BaseMapper<FilmLikes> {
}
diff --git a/src/main/java/com/mzl/flower/mapper/film/LikeCommentPoExMapper.java b/src/main/java/com/mzl/flower/mapper/film/LikeCommentPoExMapper.java
new file mode 100644
index 0000000..0099734
--- /dev/null
+++ b/src/main/java/com/mzl/flower/mapper/film/LikeCommentPoExMapper.java
@@ -0,0 +1,22 @@
+package com.mzl.flower.mapper.film;
+
+import org.apache.ibatis.annotations.Param;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @author fanghaowei
+ */
+public interface LikeCommentPoExMapper {
+
+ /**
+ * 获取所有通过审核文章的评论的点赞信息
+ *
+ * @param startTime
+ * @param endTime
+ * @return
+ */
+// List<LikeCommentPo> selectAllCommentLike(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
+
+}
diff --git a/src/main/java/com/mzl/flower/mapper/film/LikeCommentPoMapper.java b/src/main/java/com/mzl/flower/mapper/film/LikeCommentPoMapper.java
new file mode 100644
index 0000000..3ca30f2
--- /dev/null
+++ b/src/main/java/com/mzl/flower/mapper/film/LikeCommentPoMapper.java
@@ -0,0 +1,97 @@
+package com.mzl.flower.mapper.film;
+
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface LikeCommentPoMapper {
+// /**
+// * countByExample
+// *
+// * @param example
+// * @return
+// */
+// long countByExample(LikeCommentPoExample example);
+//
+// /**
+// * deleteByExample
+// *
+// * @param example
+// * @return
+// */
+// int deleteByExample(LikeCommentPoExample example);
+//
+// /**
+// * deleteByPrimaryKey
+// *
+// * @param id
+// * @return
+// */
+// int deleteByPrimaryKey(Integer id);
+//
+// /**
+// * insert
+// *
+// * @param record
+// * @return
+// */
+// int insert(LikeCommentPo record);
+//
+// /**
+// * insertSelective
+// *
+// * @param record
+// * @return
+// */
+// int insertSelective(LikeCommentPo record);
+//
+// /**
+// * selectByExample
+// *
+// * @param example
+// * @return
+// */
+// List<LikeCommentPo> selectByExample(LikeCommentPoExample example);
+//
+// /**
+// * selectByPrimaryKey
+// *
+// * @param id
+// * @return
+// */
+// LikeCommentPo selectByPrimaryKey(Integer id);
+//
+// /**
+// * updateByExampleSelective
+// *
+// * @param record
+// * @param example
+// * @return
+// */
+// int updateByExampleSelective(@Param("record") LikeCommentPo record, @Param("example") LikeCommentPoExample example);
+//
+// /**
+// * updateByExample
+// *
+// * @param record
+// * @param example
+// * @return
+// */
+// int updateByExample(@Param("record") LikeCommentPo record, @Param("example") LikeCommentPoExample example);
+//
+// /**
+// * updateByPrimaryKeySelective
+// *
+// * @param record
+// * @return
+// */
+// int updateByPrimaryKeySelective(LikeCommentPo record);
+//
+// /**
+// * updateByPrimaryKey
+// *
+// * @param record
+// * @return
+// */
+// int updateByPrimaryKey(LikeCommentPo record);
+}
\ No newline at end of file
diff --git a/src/main/java/com/mzl/flower/service/film/CommentLikesService.java b/src/main/java/com/mzl/flower/service/film/CommentLikesService.java
index 82142dc..3afd3d4 100644
--- a/src/main/java/com/mzl/flower/service/film/CommentLikesService.java
+++ b/src/main/java/com/mzl/flower/service/film/CommentLikesService.java
@@ -21,4 +21,8 @@
void deleteCommentLikes(String id);
Page<CommentLikesVO> queryPage(CommentLikesQueryDTO commentLikesQueryDTO, Page page);
+
+ Long getLikeCountCommentId(Integer id);
+
+ Boolean isLike(Integer commentId, String userId);
}
diff --git a/src/main/java/com/mzl/flower/service/film/CommentService.java b/src/main/java/com/mzl/flower/service/film/CommentService.java
new file mode 100644
index 0000000..e08c6e1
--- /dev/null
+++ b/src/main/java/com/mzl/flower/service/film/CommentService.java
@@ -0,0 +1,105 @@
+package com.mzl.flower.service.film;
+
+
+import com.github.pagehelper.PageInfo;
+import com.mzl.flower.dto.request.film.CommentSearchDTO;
+import com.mzl.flower.dto.response.film.CommentDTO;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @author fanghaowei
+ * @date 2025/4/6 14:33
+ */
+public interface CommentService {
+ /**
+ * 获取文章的评论信息
+ *
+ * @param commentSearchDTO
+ * @return
+ */
+ List<CommentDTO> getCommentByFilmId(CommentSearchDTO commentSearchDTO);
+
+ /**
+ * 获取所有通过审核文章的评论信息
+ *
+ * @param startTime
+ * @param endTime
+ * @return
+ */
+ List<CommentDTO> getAllArticleComment(LocalDateTime startTime, LocalDateTime endTime);
+
+ /**
+ * 获取所有通过审核文章的评论回复信息
+ *
+ * @param startTime
+ * @param endTime
+ * @return
+ */
+ List<CommentDTO> getAllCommentReply(LocalDateTime startTime, LocalDateTime endTime);
+
+ /**
+ * 获取最新评论信息
+ *
+ * @param commentSearchDTO
+ * @return
+ */
+ PageInfo<CommentDTO> getLatestComment(CommentSearchDTO commentSearchDTO);
+
+ /**
+ * 获取文章的评论数量
+ *
+ * @param articleId
+ * @return
+ */
+ Long getCommentCountByArticle(Integer articleId);
+
+ /**
+ * 获取评论数量
+ *
+ * @return
+ */
+ Long getTotal();
+
+ /**
+ * 创建评论
+ *
+ * @param commentDTO
+ * @return
+ */
+ Boolean create(CommentDTO commentDTO);
+
+ /**
+ * 删除评论
+ *
+ * @param commentId
+ * @return
+ */
+ Boolean delete(Integer commentId);
+
+ /**
+ * 通过父级ID获取子级评论信息
+ *
+ * @param result 存放结果
+ * @param preId
+ * @return
+ */
+ void getAllChildrenByPreId(List<CommentDTO> result, Integer preId);
+
+ /**
+ * 获取评论id获取文章id
+ *
+ * @param commentId
+ * @return
+ */
+ String getArticleIdByCommentId(Integer commentId);
+
+ /**
+ * 通过批量id获取评论信息
+ *
+ * @param commentId
+ * @return
+ */
+ CommentDTO getById(Integer commentId);
+}
diff --git a/src/main/java/com/mzl/flower/service/film/FilmLikesService.java b/src/main/java/com/mzl/flower/service/film/FilmLikesService.java
index 4a9c77b..d378381 100644
--- a/src/main/java/com/mzl/flower/service/film/FilmLikesService.java
+++ b/src/main/java/com/mzl/flower/service/film/FilmLikesService.java
@@ -20,7 +20,7 @@
void saveFilmLikes(FilmLikesDTO filmLikesDTO);
- void updateFilmLikes(FilmLikesDTO filmLikesDTO);
+ Boolean updateFilmLikes(FilmLikesDTO filmLikesDTO);
void deleteFilmLikes(String id);
Page<FilmLikesVO> queryPage(FilmLikesQueryDTO filmLikesQueryDTO, Page page);
diff --git a/src/main/java/com/mzl/flower/service/film/impl/CommentLikesServiceImpl.java b/src/main/java/com/mzl/flower/service/film/impl/CommentLikesServiceImpl.java
index 441c9a9..d9d8bd7 100644
--- a/src/main/java/com/mzl/flower/service/film/impl/CommentLikesServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/film/impl/CommentLikesServiceImpl.java
@@ -1,6 +1,7 @@
package com.mzl.flower.service.film.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mzl.flower.config.security.SecurityUtils;
import com.mzl.flower.dto.request.film.CommentLikesDTO;
import com.mzl.flower.dto.request.film.CommentLikesQueryDTO;
import com.mzl.flower.dto.response.film.CommentLikesVO;
@@ -10,12 +11,17 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+
/**
* @author generator@Fang
* @since 2025-05-29
*/
@Service
public class CommentLikesServiceImpl extends ServiceImpl<CommentLikesMapper, CommentLikes> implements CommentLikesService {
+
+ @Resource
+ private CommentLikesMapper commentLikesMapper;
@Override
public void saveCommentLikes(CommentLikesDTO commentLikesDTO) {
@@ -24,7 +30,20 @@
@Override
public void updateCommentLikes(CommentLikesDTO commentLikesDTO) {
-
+ //查询有没有对应人员的点赞信息
+ CommentLikes commentLikes = commentLikesMapper.getCommentLikeByUserIdAndCommentId(SecurityUtils.getUserId(), commentLikesDTO.getCommentId());
+ if (commentLikes == null) {
+ CommentLikes commentLikes1 = new CommentLikes();
+ commentLikes1.setCommentId(commentLikesDTO.getCommentId());
+ commentLikes1.setStatus(true);
+ commentLikes1.create();
+ commentLikesMapper.insert(commentLikes1);
+ } else {
+ // 状态取反
+ commentLikes.setStatus(!commentLikes.getStatus());
+ commentLikes.update(SecurityUtils.getUserId());
+ commentLikesMapper.updateById(commentLikes);
+ }
}
@Override
@@ -36,4 +55,14 @@
public Page<CommentLikesVO> queryPage(CommentLikesQueryDTO commentLikesQueryDTO, Page page) {
return null;
}
+
+ @Override
+ public Long getLikeCountCommentId(Integer id) {
+ return commentLikesMapper.getLikeCountCommentId(id);
+ }
+
+ @Override
+ public Boolean isLike(Integer commentId, String userId) {
+ return commentLikesMapper.isLike(commentId,userId);
+ }
}
diff --git a/src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java b/src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java
new file mode 100644
index 0000000..e854bb9
--- /dev/null
+++ b/src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java
@@ -0,0 +1,297 @@
+package com.mzl.flower.service.film.impl;
+import com.github.pagehelper.PageInfo;
+import com.github.pagehelper.PageHelper;
+import com.mzl.flower.config.exception.ValidationException;
+import com.mzl.flower.config.security.SecurityUtils;
+import com.mzl.flower.constant.Constants;
+import com.mzl.flower.dto.request.film.CommentSearchDTO;
+import com.mzl.flower.dto.response.current.CurrentUserDTO;
+import com.mzl.flower.dto.response.customer.CustomerDTO;
+import com.mzl.flower.dto.response.film.CommentDTO;
+import com.mzl.flower.dto.security.UserDTO;
+import com.mzl.flower.entity.film.CommentPo;
+import com.mzl.flower.entity.film.CommentPoExample;
+import com.mzl.flower.entity.system.User;
+import com.mzl.flower.enums.SortRuleEnum;
+import com.mzl.flower.mapper.customer.CustomerMapper;
+import com.mzl.flower.mapper.film.CommentMS;
+import com.mzl.flower.mapper.film.CommentPoExMapper;
+import com.mzl.flower.mapper.film.CommentPoMapper;
+import com.mzl.flower.service.film.CommentLikesService;
+import com.mzl.flower.service.film.CommentService;
+import com.mzl.flower.service.system.UserService;
+import com.mzl.flower.utils.CommentTreeUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Component
+@Service
+public class CommentServiceImpl implements CommentService {
+ @Resource
+ private CommentPoMapper commentPoMapper;
+
+ @Resource
+ private UserService userService;
+
+ @Resource
+ private CommentPoExMapper commentPoExMapper;
+
+ @Resource
+ private CustomerMapper customerMapper;
+
+ @Resource
+ private CommentService commentService;
+ @Resource
+ private CommentLikesService commentLikesService;
+
+ /**
+ * 获取文章的评论信息
+ *
+ * @param commentSearchDTO
+ * @return
+ */
+
+ @Override
+ public List<CommentDTO> getCommentByFilmId(CommentSearchDTO commentSearchDTO) {
+
+ CurrentUserDTO currentUser = userService.getCurrentUser();
+ // 直接调用 mapper 方法获取评论列表
+ List<CommentPo> commentPos = commentPoMapper.selectByArticleId(commentSearchDTO.getFilmId());
+
+ List<CommentDTO> commentDTOS = CommentMS.INSTANCE.toDTO(commentPos);
+
+ if (CollectionUtils.isNotEmpty(commentDTOS)) {
+ //构建评论信息
+ buildCommentInfo(commentDTOS, currentUser);
+ }
+
+ commentDTOS = CommentTreeUtils.toTree(commentDTOS);
+
+ // 排序逻辑保持不变
+ if (SortRuleEnum.hottest.equals(commentSearchDTO.getSortRule())) {
+ commentDTOS = commentDTOS.stream()
+ .sorted(Comparator.comparing(CommentDTO::getLikeCount, Comparator.nullsLast(Comparator.reverseOrder()))
+ .thenComparing(CommentDTO::getRepliesCount, Comparator.nullsLast(Comparator.reverseOrder())))
+ .collect(Collectors.toList());
+ } else if (SortRuleEnum.newest.equals(commentSearchDTO.getSortRule())) {
+ commentDTOS = commentDTOS.stream()
+ .sorted(Comparator.comparing(CommentDTO::getCreateTime, Comparator.nullsLast(Comparator.reverseOrder())))
+ .collect(Collectors.toList());
+ }
+
+ return commentDTOS;
+ }
+
+ /**
+ * 获取所有通过审核文章的评论信息
+ *
+ * @param startTime
+ * @param endTime
+ * @return
+ */
+ @Override
+ public List<CommentDTO> getAllArticleComment(LocalDateTime startTime, LocalDateTime endTime) {
+ return CommentMS.INSTANCE.toDTO(commentPoExMapper.getAllArticleComment(startTime, endTime));
+ }
+
+ @Override
+ public List<CommentDTO> getAllCommentReply(LocalDateTime startTime, LocalDateTime endTime) {
+ return CommentMS.INSTANCE.toDTO(commentPoExMapper.getAllCommentReply(startTime, endTime));
+ }
+
+ /**
+ * 获取最新评论信息
+ *
+ * @param commentSearchDTO
+ * @return
+ */
+ @Override
+ public PageInfo<CommentDTO> getLatestComment(CommentSearchDTO commentSearchDTO) {
+ PageHelper.startPage(commentSearchDTO.getCurrentPage(), commentSearchDTO.getPageSize());
+ List<CommentPo> commentPos = commentPoExMapper.selectLatestComments(commentSearchDTO.getContent(), commentSearchDTO.getCreateBy());
+ PageInfo<CommentDTO> pageInfo = CommentMS.INSTANCE.toPage(new PageInfo<>(commentPos));
+ if (CollectionUtils.isNotEmpty(pageInfo.getList())) {
+ // 构建评论信息
+ buildCommentInfo(pageInfo.getList(), null);
+ }
+ return pageInfo;
+ }
+
+ /**
+ * 获取文章的评论数量
+ *
+ * @param articleId
+ * @return
+ */
+ @Override
+ public Long getCommentCountByArticle(Integer articleId) {
+ CommentPoExample example = new CommentPoExample();
+ example.createCriteria().andIsDeletedEqualTo(false)
+ .andStateEqualTo(true)
+ .andArticleIdEqualTo(articleId);
+
+ return commentPoMapper.countByExample(example);
+ }
+
+ /**
+ * 获取评论数量
+ *
+ * @return
+ */
+ @Override
+ public Long getTotal() {
+ CommentPoExample example = new CommentPoExample();
+ example.createCriteria().andIsDeletedEqualTo(false)
+ .andStateEqualTo(true);
+ return commentPoMapper.countByExample(example);
+ }
+
+ /**
+ * 创建评论
+ *
+ * @param commentDTO
+ * @return
+ */
+ @Override
+ public Boolean create(CommentDTO commentDTO) {
+ if (StringUtils.isEmpty(commentDTO.getContent())) {
+ throw new ValidationException("评论内容不能为空");
+ }
+ //todo 评论内风险校验,评论内容可以是图片资源,考虑增加一个contextType字段用来区分资源类型
+ CommentPo commentPo = new CommentPo();
+ BeanUtils.copyProperties(commentDTO, commentPo);
+ commentPo.setState(true);
+ commentPo.create(SecurityUtils.getUserId());
+ if (commentPoMapper.insert(commentPo) <= 0) {
+ throw new ValidationException("添加评论失败");
+ }
+ return true;
+ }
+
+ /**
+ * 删除评论
+ *
+ * @param commentId
+ * @return
+ */
+ @Override
+ public Boolean delete(Integer commentId) {
+ List<Integer> commentIds = new ArrayList<>();
+ List<CommentDTO> children = new ArrayList<>();
+ // 通过父级ID获取子级评论信息
+ this.getAllChildrenByPreId(children, commentId);
+ if (CollectionUtils.isNotEmpty(children)) {
+ commentIds.addAll(children.stream().map(CommentDTO::getId).collect(Collectors.toList()));
+ }
+ commentIds.add(commentId);
+ CommentPoExample example = new CommentPoExample();
+ example.createCriteria().andIdIn(commentIds);
+
+ CommentPo commentPo = new CommentPo();
+ commentPo.setDeleted(true);
+ commentPo.setUpdateTime(LocalDateTime.now());
+ if (commentPoMapper.updateByExampleSelective(commentPo, example) <= 0) {
+ throw new ValidationException("删除评论失败");
+ }
+ return true;
+ }
+
+ /**
+ * 通过父级ID获取子级评论信息
+ *
+ * @param result 存放结果
+ * @param preId
+ * @return
+ */
+ @Override
+ public void getAllChildrenByPreId(List<CommentDTO> result, Integer preId) {
+ CommentPoExample example = new CommentPoExample();
+ example.createCriteria().andIsDeletedEqualTo(false)
+ .andStateEqualTo(true)
+ .andPreIdEqualTo(preId);
+ List<CommentDTO> commentDTOS = CommentMS.INSTANCE.toDTO(commentPoMapper.selectByExample(example));
+ if (CollectionUtils.isNotEmpty(commentDTOS)) {
+ result.addAll(commentDTOS);
+ commentDTOS.forEach(commentDTO -> {
+ this.getAllChildrenByPreId(result, commentDTO.getId());
+ });
+ }
+ }
+
+ @Override
+ public String getArticleIdByCommentId(Integer commentId) {
+ CommentPo commentPo = commentPoMapper.selectByPrimaryKey(commentId);
+ return commentPo == null ? null : commentPo.getCreateBy();
+ }
+
+ @Override
+ public CommentDTO getById(Integer commentId) {
+ return CommentMS.INSTANCE.toDTO(commentPoMapper.selectByPrimaryKey(commentId));
+ }
+
+ /**
+ * 构建评论信息
+ *
+ * @param commentDTOS
+ * @param currentUser
+ */
+
+ private void buildCommentInfo(List<CommentDTO> commentDTOS, CurrentUserDTO currentUser) {
+ if (CollectionUtils.isEmpty(commentDTOS)) {
+ return;
+ }
+
+ List<String> userIds = commentDTOS.stream()
+ .map(CommentDTO::getCreateBy)
+ .distinct()
+ .collect(Collectors.toList());
+
+ Map<String, List<User>> idUsers = userService.getByIds(userIds).stream()
+ .collect(Collectors.groupingBy(User::getId));
+
+ Map<Integer, List<CommentDTO>> preIdMap = commentDTOS.stream()
+ .collect(Collectors.groupingBy(CommentDTO::getParentId));
+
+ commentDTOS.forEach(commentDTO -> {
+ // 设置用户名和头像
+ User userInfo = idUsers.getOrDefault(commentDTO.getCreateBy(), Collections.emptyList()).stream()
+ .findFirst()
+ .orElse(null);
+ if (userInfo != null) {
+ //获取用户信息
+ CustomerDTO currentCustomer = customerMapper.getCurrentCustomer(commentDTO.getCreateBy());
+ if(!ObjectUtils.isEmpty(currentCustomer)){
+ commentDTO.setCommentUserName(currentCustomer.getNickName());
+ commentDTO.setPicture(currentCustomer.getCover());
+ User user = userService.findByTel(currentCustomer.getTel(), Constants.USER_TYPE.customer.name());
+ if(!ObjectUtils.isEmpty(user)){
+ commentDTO.setLevel(user.getVipGrade());
+ }
+ }
+ }
+
+ // 获取点赞数
+ commentDTO.setLikeCount(commentLikesService.getLikeCountCommentId(commentDTO.getId()));
+
+ // 是否已点赞,这里面传入的是用户ID
+ if (currentUser != null) {
+ commentDTO.setIsLike(commentLikesService.isLike(commentDTO.getId(), currentUser.getId()));
+ }
+
+ // 回复数量
+ commentDTO.setRepliesCount(preIdMap.getOrDefault(commentDTO.getId(), Collections.emptyList()).size());
+ });
+ }
+
+}
diff --git a/src/main/java/com/mzl/flower/service/film/impl/FilmLikesServiceImpl.java b/src/main/java/com/mzl/flower/service/film/impl/FilmLikesServiceImpl.java
index dce8bda..83d5bfd 100644
--- a/src/main/java/com/mzl/flower/service/film/impl/FilmLikesServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/film/impl/FilmLikesServiceImpl.java
@@ -1,6 +1,7 @@
package com.mzl.flower.service.film.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mzl.flower.config.exception.ValidationException;
import com.mzl.flower.dto.request.film.FilmLikesDTO;
import com.mzl.flower.dto.request.film.FilmLikesQueryDTO;
import com.mzl.flower.dto.response.film.FilmLikesVO;
@@ -9,6 +10,9 @@
import com.mzl.flower.service.film.FilmLikesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
/**
* <p>
@@ -21,14 +25,34 @@
@Service
public class FilmLikesServiceImpl extends ServiceImpl<FilmLikesMapper, FilmLikes> implements FilmLikesService {
+ @Resource
+ private FilmLikesMapper filmLikesMapper;
+
@Override
public void saveFilmLikes(FilmLikesDTO filmLikesDTO) {
}
@Override
- public void updateFilmLikes(FilmLikesDTO filmLikesDTO) {
-
+ public Boolean updateFilmLikes(FilmLikesDTO filmLikesDTO) {
+ LocalDateTime now = LocalDateTime.now();
+ // 没有,新增
+ FilmLikes filmLikes = null;
+ if (filmLikesDTO == null) {
+ filmLikes = new FilmLikes();
+ filmLikes.setFilmId(filmLikesDTO.getFilmId());
+ filmLikes.setStatus(true);
+ if (filmLikesMapper.insert(filmLikes) <= 0) {
+ throw new ValidationException("添加评论点赞失败");
+ }
+ } else {
+ // 状态取反
+ filmLikesDTO.setStatus(!filmLikesDTO.getStatus());
+ if (filmLikesMapper.updateById(filmLikes) <= 0) {
+ throw new ValidationException("更新评论点赞状态失败");
+ }
+ }
+ return true;
}
@Override
diff --git a/src/main/java/com/mzl/flower/service/system/UserService.java b/src/main/java/com/mzl/flower/service/system/UserService.java
index 1a3835e..1d07e74 100644
--- a/src/main/java/com/mzl/flower/service/system/UserService.java
+++ b/src/main/java/com/mzl/flower/service/system/UserService.java
@@ -15,6 +15,7 @@
import com.mzl.flower.dto.response.current.CurrentUserDTO;
import com.mzl.flower.dto.response.customer.CustomerDTO;
import com.mzl.flower.dto.response.system.*;
+import com.mzl.flower.dto.security.UserDTO;
import com.mzl.flower.entity.customer.Customer;
import com.mzl.flower.entity.point.CustomerPoint;
import com.mzl.flower.entity.system.*;
@@ -696,4 +697,7 @@
}
+ public List<User> getByIds(List<String> userIds) {
+ return userMapper.getByIds(userIds);
+ }
}
diff --git a/src/main/java/com/mzl/flower/utils/CommentTreeUtils.java b/src/main/java/com/mzl/flower/utils/CommentTreeUtils.java
new file mode 100644
index 0000000..b11a381
--- /dev/null
+++ b/src/main/java/com/mzl/flower/utils/CommentTreeUtils.java
@@ -0,0 +1,53 @@
+package com.mzl.flower.utils;
+
+import com.mzl.flower.dto.response.film.CommentDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 用于树转集合,集合转树场景
+ *
+ * @author fanghaowei
+ * @date
+ */
+@Slf4j
+public class CommentTreeUtils {
+ /**
+ * 集合转树
+ *
+ * @param commentDTOS
+ * @return
+ */
+ public static List<CommentDTO> toTree(List<CommentDTO> commentDTOS) {
+ Map<Integer, CommentDTO> commentDTOMap = commentDTOS.stream().collect(Collectors.toMap(CommentDTO::getId, e -> e));
+ List<CommentDTO> root = new ArrayList<>();
+ for (CommentDTO dto : commentDTOS) {
+ Integer parentId = dto.getParentId();
+ // 是根评论
+ if (parentId == 0) {
+ // 设置评论深度
+ dto.setDepth(0);
+ root.add(dto);
+ } else {
+ CommentDTO parent = commentDTOMap.get(parentId);
+ // 跳过子级无父级的评论
+ if (parent == null) {
+ continue;
+ }
+ List<CommentDTO> children = CollectionUtils.isEmpty(parent.getChild()) ? new ArrayList<>() : parent.getChild();
+ // 设置评论深度
+ dto.setDepth(parent.getDepth() + 1);
+ children.add(dto);
+ parent.setChild(children);
+ }
+ }
+ return root;
+ }
+
+
+}
diff --git a/src/main/java/com/mzl/flower/web/film/CommentController.java b/src/main/java/com/mzl/flower/web/film/CommentController.java
new file mode 100644
index 0000000..047a51c
--- /dev/null
+++ b/src/main/java/com/mzl/flower/web/film/CommentController.java
@@ -0,0 +1,56 @@
+package com.mzl.flower.web.film;
+
+import com.github.pagehelper.PageInfo;
+import com.mzl.flower.base.BaseController;
+import com.mzl.flower.base.R;
+import com.mzl.flower.base.ReturnDataDTO;
+import com.mzl.flower.dto.request.film.CommentSearchDTO;
+import com.mzl.flower.dto.response.film.CommentDTO;
+import com.mzl.flower.service.film.CommentService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+
+/**
+ * @author fanghaowei
+ * @date 2025/6/3 14:28
+ */
+@Slf4j
+@RestController
+@RequestMapping("/api/comment/")
+@Api(tags = "评论管理")
+public class CommentController extends BaseController {
+ @Resource
+ private CommentService commentService;
+
+ @GetMapping("getCommentByFilmId")
+ @ApiOperation(value = "获取文章的评论信息")
+ public ResponseEntity<ReturnDataDTO<List<CommentDTO>>> getCommentByFilmId(CommentSearchDTO commentSearchDTO) {
+ return returnData(R.SUCCESS.getCode(), commentService.getCommentByFilmId(commentSearchDTO));
+ }
+
+ @GetMapping("getLatestComment")
+ @ApiOperation(value = "获取最新评论信息")
+ public ResponseEntity<PageInfo<CommentDTO>> getLatestComment(CommentSearchDTO commentSearchDTO) {
+ return returnData(R.SUCCESS.getCode(),commentService.getLatestComment(commentSearchDTO));
+ }
+
+ @PostMapping("create")
+ @ApiOperation(value = "创建评论")
+ public ResponseEntity<Boolean> create(@RequestBody CommentDTO commentDTO) {
+ return returnData(R.SUCCESS.getCode(),commentService.create(commentDTO));
+ }
+
+ @PostMapping("delete/{commentId}")
+ @ApiOperation(value = "删除评论")
+ public ResponseEntity<Boolean> delete(@PathVariable Integer commentId) {
+ return returnData(R.SUCCESS.getCode(),commentService.delete(commentId));
+ }
+
+}
diff --git a/src/main/java/com/mzl/flower/web/film/CommentLikesController.java b/src/main/java/com/mzl/flower/web/film/CommentLikesController.java
index aebe64f..0b4a663 100644
--- a/src/main/java/com/mzl/flower/web/film/CommentLikesController.java
+++ b/src/main/java/com/mzl/flower/web/film/CommentLikesController.java
@@ -17,7 +17,7 @@
import javax.validation.constraints.NotNull;
-@Api(value = "影视作品评论点赞", tags = "影视作品评论点赞")
+@Api(value = "评论点赞", tags = "评论点赞")
@RestController
@RequestMapping("/v2/comment-likes")
@RequiredArgsConstructor
@@ -26,27 +26,27 @@
private final CommentLikesService commentLikesService;
@GetMapping("/commentLikes/list")
- @ApiOperation(value = "影视作品评论点赞列表", httpMethod = "GET")
+ @ApiOperation(value = "评论点赞列表", httpMethod = "GET")
public ResponseEntity<ReturnDataDTO<Page<CommentLikesVO>>> getCommentLikesList(Page page, CommentLikesQueryDTO dto) {
return returnData(R.SUCCESS.getCode(), commentLikesService.queryPage(dto, page));
}
@GetMapping(value = "/commentLikes/delete")
- @ApiOperation(value = "删除影视作品评论点赞 ", httpMethod = "GET", notes = "ID")
+ @ApiOperation(value = "删除评论点赞 ", httpMethod = "GET", notes = "ID")
public ResponseEntity delete(@NotNull(message = "id不能为空") Long id) {
commentLikesService.deleteCommentLikes(String.valueOf(id));
return returnData(R.SUCCESS.getCode(), null);
}
@PostMapping(value = "/commentLikes/new")
- @ApiOperation(value = "保存影视作品评论点赞", httpMethod = "POST")
+ @ApiOperation(value = "保存评论点赞", httpMethod = "POST")
public ResponseEntity insert(@RequestBody CommentLikesDTO commentLikesDTO) {
commentLikesService.saveCommentLikes(commentLikesDTO);
return returnData(R.SUCCESS.getCode(), null);
}
@PostMapping(value = "/commentLikes/edit")
- @ApiOperation(value = "更新影视作品评论点赞", httpMethod = "POST")
+ @ApiOperation(value = "更新评论点赞", httpMethod = "POST")
public ResponseEntity update(@RequestBody CommentLikesDTO commentLikesDTO) {
commentLikesService.updateCommentLikes(commentLikesDTO);
return returnData(R.SUCCESS.getCode(), null);
diff --git a/src/main/resources/mapper/film/CommentPoExMapper.xml b/src/main/resources/mapper/film/CommentPoExMapper.xml
new file mode 100644
index 0000000..183171c
--- /dev/null
+++ b/src/main/resources/mapper/film/CommentPoExMapper.xml
@@ -0,0 +1,54 @@
+<?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.mzl.flower.mapper.film.CommentPoExMapper">
+ <resultMap id="BaseResultMap" type="com.mzl.flower.entity.film.CommentPo">
+ <id column="id" jdbcType="INTEGER" property="id"/>
+ <result column="parent_id" jdbcType="INTEGER" property="parentId"/>
+ <result column="content" jdbcType="VARCHAR" property="content"/>
+ <result column="film_id" jdbcType="INTEGER" property="filmId"/>
+ <result column="state" jdbcType="BIT" property="state"/>
+ <result column="deleted" jdbcType="BIT" property="deleted"/>
+ <result column="create_by" jdbcType="BIGINT" property="createBy"/>
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+ <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+ </resultMap>
+
+ <sql id="Base_Column_List">
+ fs_comment.id, fs_comment.parent_id, fs_comment.content, fs_comment.film_id, fs_comment.`state`, fs_comment.deleted,
+ fs_comment.create_by, fs_comment.create_time, fs_comment.update_time
+ </sql>
+
+ <select id="selectLatestComments" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ from fs_comment left join fs_article on fs_comment.film_id = fs_article.id
+ where fs_comment.deleted = 0
+ and fs_comment.state = 1
+ and fs_article.state = 1
+ and fs_article.deleted = 0
+ order by fs_comment.id desc
+ </select>
+
+ <select id="getAllArticleComment" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ from fs_comment left join fs_article on fs_comment.film_id = fs_article.id
+ where fs_comment.deleted = 0
+ and fs_comment.state = 1
+ and fs_article.state = 1
+ and fs_comment.create_time between #{startTime} and #{endTime}
+ and fs_comment.parent_id = 0
+ </select>
+
+ <select id="getAllCommentReply" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ from fs_comment left join fs_article on fs_comment.film_id = fs_article.id
+ where fs_comment.deleted = 0
+ and fs_comment.state = 1
+ and fs_article.state = 1
+ and fs_comment.create_time between #{startTime} and #{endTime}
+ and fs_comment.parent_id != 0
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/film/CommentPoMapper.xml b/src/main/resources/mapper/film/CommentPoMapper.xml
new file mode 100644
index 0000000..c53db12
--- /dev/null
+++ b/src/main/resources/mapper/film/CommentPoMapper.xml
@@ -0,0 +1,279 @@
+<?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.mzl.flower.mapper.film.CommentPoMapper">
+ <resultMap id="BaseResultMap" type="com.mzl.flower.entity.film.CommentPo">
+ <id column="id" jdbcType="INTEGER" property="id" />
+ <result column="parent_id" jdbcType="INTEGER" property="parentId" />
+ <result column="content" jdbcType="VARCHAR" property="content" />
+ <result column="film_id" jdbcType="INTEGER" property="filmId" />
+ <result column="state" jdbcType="BIT" property="state" />
+ <result column="deleted" jdbcType="BIT" property="deleted" />
+ <result column="create_by" jdbcType="BIGINT" property="createBy" />
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+ <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+ </resultMap>
+ <sql id="Example_Where_Clause">
+ <where>
+ <foreach collection="oredCriteria" item="criteria" separator="or">
+ <if test="criteria.valid">
+ <trim prefix="(" prefixOverrides="and" suffix=")">
+ <foreach collection="criteria.criteria" item="criterion">
+ <choose>
+ <when test="criterion.noValue">
+ and ${criterion.condition}
+ </when>
+ <when test="criterion.singleValue">
+ and ${criterion.condition} #{criterion.value}
+ </when>
+ <when test="criterion.betweenValue">
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+ </when>
+ <when test="criterion.listValue">
+ and ${criterion.condition}
+ <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+ #{listItem}
+ </foreach>
+ </when>
+ </choose>
+ </foreach>
+ </trim>
+ </if>
+ </foreach>
+ </where>
+ </sql>
+ <sql id="Update_By_Example_Where_Clause">
+ <where>
+ <foreach collection="example.oredCriteria" item="criteria" separator="or">
+ <if test="criteria.valid">
+ <trim prefix="(" prefixOverrides="and" suffix=")">
+ <foreach collection="criteria.criteria" item="criterion">
+ <choose>
+ <when test="criterion.noValue">
+ and ${criterion.condition}
+ </when>
+ <when test="criterion.singleValue">
+ and ${criterion.condition} #{criterion.value}
+ </when>
+ <when test="criterion.betweenValue">
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+ </when>
+ <when test="criterion.listValue">
+ and ${criterion.condition}
+ <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+ #{listItem}
+ </foreach>
+ </when>
+ </choose>
+ </foreach>
+ </trim>
+ </if>
+ </foreach>
+ </where>
+ </sql>
+ <sql id="Base_Column_List">
+ id, parent_id, content, film_id, `state`, deleted, create_by, create_time,
+ update_time
+ </sql>
+ <select id="selectByExample" parameterType="com.mzl.flower.entity.film.CommentPoExample" resultMap="BaseResultMap">
+ select
+ <if test="distinct">
+ distinct
+ </if>
+ <include refid="Base_Column_List" />
+ from film_comments
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ <if test="orderByClause != null">
+ order by ${orderByClause}
+ </if>
+ </select>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List" />
+ from film_comments
+ where id = #{id,jdbcType=INTEGER}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+ delete from film_comments
+ where id = #{id,jdbcType=INTEGER}
+ </delete>
+ <delete id="deleteByExample" parameterType="com.mzl.flower.entity.film.CommentPoExample">
+ delete from film_comments
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ </delete>
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mzl.flower.entity.film.CommentPo" useGeneratedKeys="true">
+ insert into film_comments (parent_id, content, film_id,
+ `state`, deleted, create_by,
+ create_time, update_time)
+ values (#{parentId,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{filmId,jdbcType=INTEGER},
+ #{state,jdbcType=BIT}, #{deleted,jdbcType=BIT}, #{createBy,jdbcType=BIGINT},
+ #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+ </insert>
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mzl.flower.entity.film.CommentPo" useGeneratedKeys="true">
+ insert into film_comments
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="parentId != null">
+ parent_id,
+ </if>
+ <if test="content != null">
+ content,
+ </if>
+ <if test="filmId != null">
+ film_id,
+ </if>
+ <if test="state != null">
+ `state`,
+ </if>
+ <if test="deleted != null">
+ deleted,
+ </if>
+ <if test="createBy != null">
+ create_by,
+ </if>
+ <if test="createTime != null">
+ create_time,
+ </if>
+ <if test="updateTime != null">
+ update_time,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="parentId != null">
+ #{parentId,jdbcType=INTEGER},
+ </if>
+ <if test="content != null">
+ #{content,jdbcType=VARCHAR},
+ </if>
+ <if test="filmId != null">
+ #{filmId,jdbcType=INTEGER},
+ </if>
+ <if test="state != null">
+ #{state,jdbcType=BIT},
+ </if>
+ <if test="deleted != null">
+ #{deleted,jdbcType=BIT},
+ </if>
+ <if test="createBy != null">
+ #{createBy,jdbcType=BIGINT},
+ </if>
+ <if test="createTime != null">
+ #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="updateTime != null">
+ #{updateTime,jdbcType=TIMESTAMP},
+ </if>
+ </trim>
+ </insert>
+ <select id="countByExample" parameterType="com.mzl.flower.entity.film.CommentPoExample" resultType="java.lang.Long">
+ select count(*) from film_comments
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ </select>
+ <update id="updateByExampleSelective" parameterType="map">
+ update film_comments
+ <set>
+ <if test="record.id != null">
+ id = #{record.id,jdbcType=INTEGER},
+ </if>
+ <if test="record.parentId != null">
+ parent_id = #{record.parentId,jdbcType=INTEGER},
+ </if>
+ <if test="record.content != null">
+ content = #{record.content,jdbcType=VARCHAR},
+ </if>
+ <if test="record.filmId != null">
+ film_id = #{record.filmId,jdbcType=INTEGER},
+ </if>
+ <if test="record.state != null">
+ `state` = #{record.state,jdbcType=BIT},
+ </if>
+ <if test="record.deleted != null">
+ deleted = #{record.deleted,jdbcType=BIT},
+ </if>
+ <if test="record.createBy != null">
+ create_by = #{record.createBy,jdbcType=BIGINT},
+ </if>
+ <if test="record.createTime != null">
+ create_time = #{record.createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="record.updateTime != null">
+ update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+ </if>
+ </set>
+ <if test="_parameter != null">
+ <include refid="Update_By_Example_Where_Clause" />
+ </if>
+ </update>
+ <update id="updateByExample" parameterType="map">
+ update film_comments
+ set id = #{record.id,jdbcType=INTEGER},
+ parent_id = #{record.parentId,jdbcType=INTEGER},
+ content = #{record.content,jdbcType=VARCHAR},
+ film_id = #{record.filmId,jdbcType=INTEGER},
+ `state` = #{record.state,jdbcType=BIT},
+ deleted = #{record.deleted,jdbcType=BIT},
+ create_by = #{record.createBy,jdbcType=BIGINT},
+ create_time = #{record.createTime,jdbcType=TIMESTAMP},
+ update_time = #{record.updateTime,jdbcType=TIMESTAMP}
+ <if test="_parameter != null">
+ <include refid="Update_By_Example_Where_Clause" />
+ </if>
+ </update>
+ <update id="updateByPrimaryKeySelective" parameterType="com.mzl.flower.entity.film.CommentPo">
+ update film_comments
+ <set>
+ <if test="parentId != null">
+ parent_id = #{parentId,jdbcType=INTEGER},
+ </if>
+ <if test="content != null">
+ content = #{content,jdbcType=VARCHAR},
+ </if>
+ <if test="filmId != null">
+ film_id = #{filmId,jdbcType=INTEGER},
+ </if>
+ <if test="state != null">
+ `state` = #{state,jdbcType=BIT},
+ </if>
+ <if test="deleted != null">
+ deleted = #{deleted,jdbcType=BIT},
+ </if>
+ <if test="createBy != null">
+ create_by = #{createBy,jdbcType=BIGINT},
+ </if>
+ <if test="createTime != null">
+ create_time = #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="updateTime != null">
+ update_time = #{updateTime,jdbcType=TIMESTAMP},
+ </if>
+ </set>
+ where id = #{id,jdbcType=INTEGER}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.mzl.flower.entity.film.CommentPo">
+ update film_comments
+ set parent_id = #{parentId,jdbcType=INTEGER},
+ content = #{content,jdbcType=VARCHAR},
+ film_id = #{filmId,jdbcType=INTEGER},
+ `state` = #{state,jdbcType=BIT},
+ deleted = #{deleted,jdbcType=BIT},
+ create_by = #{createBy,jdbcType=BIGINT},
+ create_time = #{createTime,jdbcType=TIMESTAMP},
+ update_time = #{updateTime,jdbcType=TIMESTAMP}
+ where id = #{id,jdbcType=INTEGER}
+ </update>
+
+ <!-- CommentPoMapper.xml -->
+ <select id="selectByArticleId" resultType="com.mzl.flower.entity.film.CommentPo">
+ SELECT *
+ FROM film_comments
+ WHERE film_id = #{filmId}
+ AND deleted = false
+ AND state = true
+ </select>
+
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/film/LikeCommentPoExMapper.xml b/src/main/resources/mapper/film/LikeCommentPoExMapper.xml
new file mode 100644
index 0000000..c7e0e2e
--- /dev/null
+++ b/src/main/resources/mapper/film/LikeCommentPoExMapper.xml
@@ -0,0 +1,27 @@
+<?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.mzl.flower.mapper.film.LikeCommentPoExMapper">
+<!-- <resultMap id="BaseResultMap" type="com.liang.bbs.user.persistence.entity.LikeCommentPo">-->
+<!-- <id column="id" jdbcType="INTEGER" property="id" />-->
+<!-- <result column="comment_id" jdbcType="INTEGER" property="commentId" />-->
+<!-- <result column="state" jdbcType="BIT" property="state" />-->
+<!-- <result column="like_user" jdbcType="BIGINT" property="likeUser" />-->
+<!-- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />-->
+<!-- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />-->
+<!-- </resultMap>-->
+
+<!-- <sql id="Base_Column_List">-->
+<!-- fs_comment_like.id, fs_comment_like.comment_id, fs_comment_like.`state`, fs_comment_like.like_user, fs_comment_like.create_time, fs_comment_like.update_time-->
+<!-- </sql>-->
+
+<!-- <select id="selectAllCommentLike" resultMap="BaseResultMap">-->
+<!-- select-->
+<!-- <include refid="Base_Column_List"/>-->
+<!-- from fs_comment_like left join fs_comment on fs_comment_like.comment_id = fs_comment.id-->
+<!-- where fs_comment_like.state = 1-->
+<!-- and fs_comment.is_deleted = 0-->
+<!-- and fs_comment.state = 1-->
+<!-- and fs_comment_like.create_time between #{startTime} and #{endTime}-->
+<!-- </select>-->
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/film/LikeCommentPoMapper.xml b/src/main/resources/mapper/film/LikeCommentPoMapper.xml
new file mode 100644
index 0000000..b043272
--- /dev/null
+++ b/src/main/resources/mapper/film/LikeCommentPoMapper.xml
@@ -0,0 +1,220 @@
+<?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.mzl.flower.mapper.film.LikeCommentPoMapper">
+<!-- <resultMap id="BaseResultMap" type="com.liang.bbs.user.persistence.entity.LikeCommentPo">-->
+<!-- <id column="id" jdbcType="INTEGER" property="id" />-->
+<!-- <result column="comment_id" jdbcType="INTEGER" property="commentId" />-->
+<!-- <result column="state" jdbcType="BIT" property="state" />-->
+<!-- <result column="like_user" jdbcType="BIGINT" property="likeUser" />-->
+<!-- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />-->
+<!-- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />-->
+<!-- </resultMap>-->
+<!-- <sql id="Example_Where_Clause">-->
+<!-- <where>-->
+<!-- <foreach collection="oredCriteria" item="criteria" separator="or">-->
+<!-- <if test="criteria.valid">-->
+<!-- <trim prefix="(" prefixOverrides="and" suffix=")">-->
+<!-- <foreach collection="criteria.criteria" item="criterion">-->
+<!-- <choose>-->
+<!-- <when test="criterion.noValue">-->
+<!-- and ${criterion.condition}-->
+<!-- </when>-->
+<!-- <when test="criterion.singleValue">-->
+<!-- and ${criterion.condition} #{criterion.value}-->
+<!-- </when>-->
+<!-- <when test="criterion.betweenValue">-->
+<!-- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}-->
+<!-- </when>-->
+<!-- <when test="criterion.listValue">-->
+<!-- and ${criterion.condition}-->
+<!-- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">-->
+<!-- #{listItem}-->
+<!-- </foreach>-->
+<!-- </when>-->
+<!-- </choose>-->
+<!-- </foreach>-->
+<!-- </trim>-->
+<!-- </if>-->
+<!-- </foreach>-->
+<!-- </where>-->
+<!-- </sql>-->
+<!-- <sql id="Update_By_Example_Where_Clause">-->
+<!-- <where>-->
+<!-- <foreach collection="example.oredCriteria" item="criteria" separator="or">-->
+<!-- <if test="criteria.valid">-->
+<!-- <trim prefix="(" prefixOverrides="and" suffix=")">-->
+<!-- <foreach collection="criteria.criteria" item="criterion">-->
+<!-- <choose>-->
+<!-- <when test="criterion.noValue">-->
+<!-- and ${criterion.condition}-->
+<!-- </when>-->
+<!-- <when test="criterion.singleValue">-->
+<!-- and ${criterion.condition} #{criterion.value}-->
+<!-- </when>-->
+<!-- <when test="criterion.betweenValue">-->
+<!-- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}-->
+<!-- </when>-->
+<!-- <when test="criterion.listValue">-->
+<!-- and ${criterion.condition}-->
+<!-- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">-->
+<!-- #{listItem}-->
+<!-- </foreach>-->
+<!-- </when>-->
+<!-- </choose>-->
+<!-- </foreach>-->
+<!-- </trim>-->
+<!-- </if>-->
+<!-- </foreach>-->
+<!-- </where>-->
+<!-- </sql>-->
+<!-- <sql id="Base_Column_List">-->
+<!-- id, comment_id, `state`, like_user, create_time, update_time-->
+<!-- </sql>-->
+<!-- <select id="selectByExample" parameterType="com.liang.bbs.user.persistence.entity.LikeCommentPoExample" resultMap="BaseResultMap">-->
+<!-- select-->
+<!-- <if test="distinct">-->
+<!-- distinct-->
+<!-- </if>-->
+<!-- <include refid="Base_Column_List" />-->
+<!-- from fs_comment_like-->
+<!-- <if test="_parameter != null">-->
+<!-- <include refid="Example_Where_Clause" />-->
+<!-- </if>-->
+<!-- <if test="orderByClause != null">-->
+<!-- order by ${orderByClause}-->
+<!-- </if>-->
+<!-- </select>-->
+<!-- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">-->
+<!-- select -->
+<!-- <include refid="Base_Column_List" />-->
+<!-- from fs_comment_like-->
+<!-- where id = #{id,jdbcType=INTEGER}-->
+<!-- </select>-->
+<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">-->
+<!-- delete from fs_comment_like-->
+<!-- where id = #{id,jdbcType=INTEGER}-->
+<!-- </delete>-->
+<!-- <delete id="deleteByExample" parameterType="com.liang.bbs.user.persistence.entity.LikeCommentPoExample">-->
+<!-- delete from fs_comment_like-->
+<!-- <if test="_parameter != null">-->
+<!-- <include refid="Example_Where_Clause" />-->
+<!-- </if>-->
+<!-- </delete>-->
+<!-- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.liang.bbs.user.persistence.entity.LikeCommentPo" useGeneratedKeys="true">-->
+<!-- insert into fs_comment_like (comment_id, `state`, like_user, -->
+<!-- create_time, update_time)-->
+<!-- values (#{commentId,jdbcType=INTEGER}, #{state,jdbcType=BIT}, #{likeUser,jdbcType=BIGINT}, -->
+<!-- #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})-->
+<!-- </insert>-->
+<!-- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.liang.bbs.user.persistence.entity.LikeCommentPo" useGeneratedKeys="true">-->
+<!-- insert into fs_comment_like-->
+<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
+<!-- <if test="commentId != null">-->
+<!-- comment_id,-->
+<!-- </if>-->
+<!-- <if test="state != null">-->
+<!-- `state`,-->
+<!-- </if>-->
+<!-- <if test="likeUser != null">-->
+<!-- like_user,-->
+<!-- </if>-->
+<!-- <if test="createTime != null">-->
+<!-- create_time,-->
+<!-- </if>-->
+<!-- <if test="updateTime != null">-->
+<!-- update_time,-->
+<!-- </if>-->
+<!-- </trim>-->
+<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
+<!-- <if test="commentId != null">-->
+<!-- #{commentId,jdbcType=INTEGER},-->
+<!-- </if>-->
+<!-- <if test="state != null">-->
+<!-- #{state,jdbcType=BIT},-->
+<!-- </if>-->
+<!-- <if test="likeUser != null">-->
+<!-- #{likeUser,jdbcType=BIGINT},-->
+<!-- </if>-->
+<!-- <if test="createTime != null">-->
+<!-- #{createTime,jdbcType=TIMESTAMP},-->
+<!-- </if>-->
+<!-- <if test="updateTime != null">-->
+<!-- #{updateTime,jdbcType=TIMESTAMP},-->
+<!-- </if>-->
+<!-- </trim>-->
+<!-- </insert>-->
+<!-- <select id="countByExample" parameterType="com.liang.bbs.user.persistence.entity.LikeCommentPoExample" resultType="java.lang.Long">-->
+<!-- select count(*) from fs_comment_like-->
+<!-- <if test="_parameter != null">-->
+<!-- <include refid="Example_Where_Clause" />-->
+<!-- </if>-->
+<!-- </select>-->
+<!-- <update id="updateByExampleSelective" parameterType="map">-->
+<!-- update fs_comment_like-->
+<!-- <set>-->
+<!-- <if test="record.id != null">-->
+<!-- id = #{record.id,jdbcType=INTEGER},-->
+<!-- </if>-->
+<!-- <if test="record.commentId != null">-->
+<!-- comment_id = #{record.commentId,jdbcType=INTEGER},-->
+<!-- </if>-->
+<!-- <if test="record.state != null">-->
+<!-- `state` = #{record.state,jdbcType=BIT},-->
+<!-- </if>-->
+<!-- <if test="record.likeUser != null">-->
+<!-- like_user = #{record.likeUser,jdbcType=BIGINT},-->
+<!-- </if>-->
+<!-- <if test="record.createTime != null">-->
+<!-- create_time = #{record.createTime,jdbcType=TIMESTAMP},-->
+<!-- </if>-->
+<!-- <if test="record.updateTime != null">-->
+<!-- update_time = #{record.updateTime,jdbcType=TIMESTAMP},-->
+<!-- </if>-->
+<!-- </set>-->
+<!-- <if test="_parameter != null">-->
+<!-- <include refid="Update_By_Example_Where_Clause" />-->
+<!-- </if>-->
+<!-- </update>-->
+<!-- <update id="updateByExample" parameterType="map">-->
+<!-- update fs_comment_like-->
+<!-- set id = #{record.id,jdbcType=INTEGER},-->
+<!-- comment_id = #{record.commentId,jdbcType=INTEGER},-->
+<!-- `state` = #{record.state,jdbcType=BIT},-->
+<!-- like_user = #{record.likeUser,jdbcType=BIGINT},-->
+<!-- create_time = #{record.createTime,jdbcType=TIMESTAMP},-->
+<!-- update_time = #{record.updateTime,jdbcType=TIMESTAMP}-->
+<!-- <if test="_parameter != null">-->
+<!-- <include refid="Update_By_Example_Where_Clause" />-->
+<!-- </if>-->
+<!-- </update>-->
+<!-- <update id="updateByPrimaryKeySelective" parameterType="com.liang.bbs.user.persistence.entity.LikeCommentPo">-->
+<!-- update fs_comment_like-->
+<!-- <set>-->
+<!-- <if test="commentId != null">-->
+<!-- comment_id = #{commentId,jdbcType=INTEGER},-->
+<!-- </if>-->
+<!-- <if test="state != null">-->
+<!-- `state` = #{state,jdbcType=BIT},-->
+<!-- </if>-->
+<!-- <if test="likeUser != null">-->
+<!-- like_user = #{likeUser,jdbcType=BIGINT},-->
+<!-- </if>-->
+<!-- <if test="createTime != null">-->
+<!-- create_time = #{createTime,jdbcType=TIMESTAMP},-->
+<!-- </if>-->
+<!-- <if test="updateTime != null">-->
+<!-- update_time = #{updateTime,jdbcType=TIMESTAMP},-->
+<!-- </if>-->
+<!-- </set>-->
+<!-- where id = #{id,jdbcType=INTEGER}-->
+<!-- </update>-->
+<!-- <update id="updateByPrimaryKey" parameterType="com.liang.bbs.user.persistence.entity.LikeCommentPo">-->
+<!-- update fs_comment_like-->
+<!-- set comment_id = #{commentId,jdbcType=INTEGER},-->
+<!-- `state` = #{state,jdbcType=BIT},-->
+<!-- like_user = #{likeUser,jdbcType=BIGINT},-->
+<!-- create_time = #{createTime,jdbcType=TIMESTAMP},-->
+<!-- update_time = #{updateTime,jdbcType=TIMESTAMP}-->
+<!-- where id = #{id,jdbcType=INTEGER}-->
+<!-- </update>-->
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/system/UserMapper.xml b/src/main/resources/mapper/system/UserMapper.xml
index 037278e..9b660c9 100644
--- a/src/main/resources/mapper/system/UserMapper.xml
+++ b/src/main/resources/mapper/system/UserMapper.xml
@@ -167,4 +167,15 @@
</if>
</where>
</select>
+
+
+ <select id="getByIds" resultType="com.mzl.flower.entity.system.User">
+ SELECT
+ u.*
+ FROM t_user u
+ WHERE u.id IN
+ <foreach collection="userIds" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </select>
</mapper>
--
Gitblit v1.9.3