Compare commits
10 Commits
ff2e764f96
...
dc18d77c00
| Author | SHA1 | Date | |
|---|---|---|---|
| dc18d77c00 | |||
| 2e4c1046a0 | |||
| 6ccc3911a8 | |||
| 76379aab18 | |||
| 3ca59c36f1 | |||
| e47a7a8510 | |||
| 9dd7b4e146 | |||
| e34a2ccae7 | |||
| dcc3ca38a7 | |||
| 2c3fa19cbb |
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM openjdk:17-jdk
|
||||
ARG JAR_FILE=target/*.jar
|
||||
COPY $JAR_FILE app.jar
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
RUN echo 'Asia/Shanghai' > /etc/timezone
|
||||
ENTRYPOINT ["java","-jar","/app.jar"]
|
||||
@@ -1,29 +0,0 @@
|
||||
2025-07-11 16:54:01 |INFO |background-preinit |Version.java:21 |org.hibernate.validator.internal.util.Version |HV000001: Hibernate Validator 8.0.2.Final
|
||||
2025-07-11 16:54:01 |INFO |main |StartupInfoLogger.java:53 |com.cxx.food.FoodHubServiceApplication |Starting FoodHubServiceApplication v0.0.1 using Java 17.0.12 with PID 30460 (D:\Cxx\GitHubProjects\food-hub-service\target\classes started by chenxiuxiang in D:\Cxx\GitHubProjects\food-hub-service)
|
||||
2025-07-11 16:54:01 |INFO |main |SpringApplication.java:658 |com.cxx.food.FoodHubServiceApplication |The following 1 profile is active: "prod"
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.dao.FoodDao
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/FoodDao.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.dao.MomentDao
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/MomentDao.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.CommentRecordMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/CommentRecordMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.FavouriteRecordMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/FavouriteRecordMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.FileRecordMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/FileRecordMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.LikeRecordMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/LikeRecordMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.MaterialMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/MaterialMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.MomentImageMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/MomentImageMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.MomentMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/MomentMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.RecipeMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/RecipeMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.RecordMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/RecordMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.StepMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/StepMapper.xml
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:204 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper interface: com.cxx.food.mapper.UserMapper
|
||||
2025-07-11 16:54:04 |INFO |main |MyBatisNativeConfiguration.java:210 |com.cxx.autoconfigure.data.MyBatisNativeConfiguration$MyBatisBeanFactoryInitializationAotProcessor |Registering MyBatis mapper xml: mapper/UserMapper.xml
|
||||
@@ -11,9 +11,6 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
@Value("${file.path}")
|
||||
private String filePath;
|
||||
|
||||
@Value("${file.log-path}")
|
||||
private String logFilePath;
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/" + FileConstant.FILE_URL_PREFIX + "/**")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.cxx.food.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.cxx.food.dto.*;
|
||||
import com.cxx.food.service.MomentService;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
@@ -43,6 +44,13 @@ public class MomentController {
|
||||
return momentService.queryMomentList();
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询所有朋友圈")
|
||||
@GetMapping("/page")
|
||||
public IPage<MomentDto> queryMomentByPage(@RequestParam("currentPage") Integer currentPage,
|
||||
@RequestParam("pageSize") Integer pageSize) {
|
||||
return momentService.queryMomentByPage(currentPage, pageSize);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询朋友圈")
|
||||
@GetMapping("/{id}")
|
||||
public @JsonView(ReadView.class) List<MomentDto> queryMomentById(@PathVariable("id") long id) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FoodDao {
|
||||
RecipeDto queryRecipe(@Param("id") Long id);
|
||||
RecipeDto queryRecipeById(@Param("id") Long id);
|
||||
|
||||
List<SummaryDto> queryRecipeByUser(@Param("id") Long id);
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cxx.food.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cxx.food.dto.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -10,6 +12,8 @@ import java.util.List;
|
||||
public interface MomentDao {
|
||||
List<MomentDto> queryMomentList();
|
||||
|
||||
IPage<MomentDto> queryMomentByPage(Page<MomentDto> page);
|
||||
|
||||
List<MomentDto> queryMomentById(@Param("id") Long id);
|
||||
|
||||
void insertMomentImage(@Param("momentId") Long momentId,
|
||||
|
||||
41
src/main/java/com/cxx/food/dto/MomentPageDto.java
Normal file
41
src/main/java/com/cxx/food/dto/MomentPageDto.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.cxx.food.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class MomentPageDto {
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "朋友圈内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "朋友圈图片")
|
||||
private List<String> imageList;
|
||||
|
||||
@Schema(description = "时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date date;
|
||||
|
||||
@Schema(description = "点赞用户")
|
||||
private List<Long> likeList;
|
||||
|
||||
@Schema(description = "评论内容")
|
||||
private List<CommentDto> commentList;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cxx.food.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.cxx.food.dto.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,6 +15,8 @@ public interface MomentService {
|
||||
|
||||
List<MomentDto> queryMomentList();
|
||||
|
||||
IPage<MomentDto> queryMomentByPage(int currentPage, int pageSize);
|
||||
|
||||
List<MomentDto> queryMomentById(Long id);
|
||||
|
||||
Boolean addComment(Long momentId, String content);
|
||||
|
||||
@@ -220,7 +220,7 @@ public class FoodServiceImpl implements FoodService {
|
||||
throw new CustomException("该美食不存在");
|
||||
}
|
||||
|
||||
return foodDao.queryRecipe(id);
|
||||
return foodDao.queryRecipeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.cxx.food.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cxx.food.constant.BizType;
|
||||
import com.cxx.food.dao.MomentDao;
|
||||
import com.cxx.food.dto.MomentDto;
|
||||
@@ -74,6 +76,12 @@ public class MomentServiceImpl implements MomentService {
|
||||
return momentDao.queryMomentList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<MomentDto> queryMomentByPage(int currentPage, int pageSize) {
|
||||
Page<MomentDto> page = new Page<>(currentPage, pageSize);
|
||||
return momentDao.queryMomentByPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MomentDto> queryMomentById(Long id) {
|
||||
return momentDao.queryMomentById(id);
|
||||
|
||||
@@ -7,4 +7,3 @@ spring:
|
||||
|
||||
file:
|
||||
path: D:\\temp\\
|
||||
log-path: D:\\temp\\
|
||||
@@ -1,9 +1,14 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/food_hub?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&useSSL=false
|
||||
username: docker
|
||||
password: 19940822Cxx
|
||||
url: jdbc:mysql://host.docker.internal:3306/food_hub?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&useSSL=false
|
||||
username: root
|
||||
password: 19940822Cxx@1213
|
||||
|
||||
file:
|
||||
path: /upload-file/
|
||||
|
||||
logging:
|
||||
fluentd:
|
||||
host: host.docker.internal
|
||||
port: 24224
|
||||
@@ -7,4 +7,3 @@ spring:
|
||||
|
||||
file:
|
||||
path: /root/docker/upload-file/
|
||||
log-path: /root/service/logs/
|
||||
@@ -1,12 +1,12 @@
|
||||
server:
|
||||
port: 8100
|
||||
port: 8083
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @project.artifactId@
|
||||
version: @project.version@
|
||||
profiles:
|
||||
active: dev
|
||||
active: docker
|
||||
|
||||
# mybatis plus mapper路径
|
||||
mybatis-plus:
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
<resultMap id="foodRecordResultMap" type="com.cxx.food.dto.RecordDto">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="person"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="category" column="category"/>
|
||||
<result property="person" column="person"/>
|
||||
<result property="date" column="date"/>
|
||||
@@ -67,7 +67,9 @@
|
||||
<result property="favouriteCount" column="favouriteCount"/>
|
||||
<result property="commentCount" column="commentCount"/>
|
||||
<collection property="recordList" ofType="com.cxx.food.dto.RecordDto">
|
||||
<id property="id" column="workId"/>
|
||||
<id property="id" column="recordId"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="category" column="category"/>
|
||||
<result property="person" column="person"/>
|
||||
<result property="date" column="date"/>
|
||||
<result property="imageUrl" column="imageUrl"/>
|
||||
@@ -128,11 +130,14 @@
|
||||
</select>
|
||||
|
||||
<select id="queryRecordById" resultMap="foodRecordResultMap">
|
||||
SELECT id AS id,
|
||||
person AS person,
|
||||
date AS date,
|
||||
image_url AS imageUrl
|
||||
FROM record
|
||||
SELECT a.id AS id,
|
||||
b.name AS name,
|
||||
b.category AS category,
|
||||
a.person AS person,
|
||||
a.date AS date,
|
||||
a.image_url AS imageUrl
|
||||
FROM record AS a
|
||||
LEFT JOIN recipe AS b ON a.food_id = b.id
|
||||
WHERE food_id = #{id}
|
||||
ORDER BY date DESC
|
||||
</select>
|
||||
@@ -152,12 +157,12 @@
|
||||
ORDER BY date DESC
|
||||
</select>
|
||||
|
||||
<select id="queryRecipe" resultMap="foodRecipeResultMap">
|
||||
<select id="queryRecipeById" resultMap="foodRecipeResultMap">
|
||||
SELECT a.id AS id,
|
||||
a.name AS name,
|
||||
a.category AS category,
|
||||
a.recommend_rate AS recommendRate,
|
||||
a.remark AS remake,
|
||||
a.remark AS remark,
|
||||
a.is_share AS isShare,
|
||||
b.id AS userId,
|
||||
b.username AS username,
|
||||
@@ -172,9 +177,11 @@
|
||||
a.name AS name,
|
||||
a.category AS category,
|
||||
a.recommend_rate AS recommendRate,
|
||||
a.is_share AS isShare,
|
||||
u.id AS userId,
|
||||
u.username AS username,
|
||||
u.avatar AS avatar,
|
||||
b.id AS recordId,
|
||||
b.person AS person,
|
||||
b.date AS date,
|
||||
b.image_url AS imageUrl,
|
||||
@@ -238,10 +245,10 @@
|
||||
|
||||
<select id="querySummaryByPage" resultMap="foodSummaryResultMap">
|
||||
SELECT a.id AS id,
|
||||
a.name AS name,
|
||||
a.category AS category,
|
||||
a.recommend_rate AS recommendRate,
|
||||
a.is_share AS isShare
|
||||
a.name AS name,
|
||||
a.category AS category,
|
||||
a.recommend_rate AS recommendRate,
|
||||
a.is_share AS isShare
|
||||
FROM recipe a
|
||||
<where>
|
||||
<if test="query.category != null and query.category != ''">
|
||||
@@ -252,38 +259,38 @@
|
||||
|
||||
<select id="queryRecipeSummary" resultMap="foodSummaryResultMap">
|
||||
SELECT a.id AS id,
|
||||
a.name AS name,
|
||||
a.category AS category,
|
||||
a.recommend_rate AS recommendRate,
|
||||
a.is_share AS isShare,
|
||||
u.id AS userId,
|
||||
u.username AS username,
|
||||
u.avatar AS avatar,
|
||||
b.person AS person,
|
||||
b.date AS date,
|
||||
b.image_url AS imageUrl,
|
||||
COALESCE(c.like_count, 0) AS likeCount,
|
||||
COALESCE(d.comment_count, 0) AS commentCount,
|
||||
COALESCE(e.favourite_count, 0) AS favouriteCount
|
||||
a.name AS name,
|
||||
a.category AS category,
|
||||
a.recommend_rate AS recommendRate,
|
||||
a.is_share AS isShare,
|
||||
u.id AS userId,
|
||||
u.username AS username,
|
||||
u.avatar AS avatar,
|
||||
b.person AS person,
|
||||
b.date AS date,
|
||||
b.image_url AS imageUrl,
|
||||
COALESCE(c.like_count, 0) AS likeCount,
|
||||
COALESCE(d.comment_count, 0) AS commentCount,
|
||||
COALESCE(e.favourite_count, 0) AS favouriteCount
|
||||
FROM recipe a
|
||||
LEFT JOIN record b ON a.id = b.food_id
|
||||
LEFT JOIN user u ON a.create_by = u.id
|
||||
LEFT JOIN (
|
||||
SELECT subject_id, COUNT(id) AS like_count
|
||||
FROM like_record
|
||||
WHERE type = 'recipe'
|
||||
GROUP BY subject_id
|
||||
SELECT subject_id, COUNT(id) AS like_count
|
||||
FROM like_record
|
||||
WHERE type = 'recipe'
|
||||
GROUP BY subject_id
|
||||
) c ON a.id = c.subject_id
|
||||
LEFT JOIN (
|
||||
SELECT subject_id, COUNT(id) AS comment_count
|
||||
FROM comment_record
|
||||
WHERE type = 'recipe'
|
||||
GROUP BY subject_id
|
||||
SELECT subject_id, COUNT(id) AS comment_count
|
||||
FROM comment_record
|
||||
WHERE type = 'recipe'
|
||||
GROUP BY subject_id
|
||||
) d ON a.id = d.subject_id
|
||||
LEFT JOIN (SELECT subject_id, COUNT(id) AS favourite_count
|
||||
FROM favourite_record
|
||||
WHERE type = 'recipe'
|
||||
GROUP BY subject_id
|
||||
FROM favourite_record
|
||||
WHERE type = 'recipe'
|
||||
GROUP BY subject_id
|
||||
) e ON a.id = e.subject_id
|
||||
<where>
|
||||
<if test="query.category != null and query.category != ''">
|
||||
|
||||
@@ -18,6 +18,23 @@
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="momentPageResultMap" type="com.cxx.food.dto.MomentPageDto">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="userId"/>
|
||||
<result property="username" column="username"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="date" column="date"/>
|
||||
<collection property="imageList" ofType="java.lang.String"
|
||||
column="id" select="queryMomentImage"/>
|
||||
<collection property="likeList" ofType="long"
|
||||
column="id" select="queryMomentLike">
|
||||
</collection>
|
||||
<collection property="commentList" ofType="com.cxx.food.dto.CommentDto"
|
||||
column="id" select="queryMomentComment">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="commentResultMap" type="com.cxx.food.dto.CommentDto">
|
||||
<id property="id" column="id"/>
|
||||
<result property="username" column="username"/>
|
||||
@@ -33,11 +50,11 @@
|
||||
</select>
|
||||
|
||||
<select id="queryMomentComment" resultMap="commentResultMap">
|
||||
SELECT a.id AS id,
|
||||
b.username AS username,
|
||||
b.avatar AS avatar,
|
||||
a.content AS content,
|
||||
a.create_time AS date
|
||||
SELECT a.id AS id,
|
||||
b.username AS username,
|
||||
COALESCE(b.avatar, '') AS avatar,
|
||||
a.content AS content,
|
||||
a.create_time AS date
|
||||
FROM comment_record AS a
|
||||
LEFT JOIN user AS b ON a.create_by = b.id
|
||||
WHERE subject_id = #{id}
|
||||
@@ -45,28 +62,40 @@
|
||||
</select>
|
||||
|
||||
<select id="queryMomentList" resultMap="momentResultMap">
|
||||
SELECT a.id AS id,
|
||||
b.id AS userId,
|
||||
b.username AS username,
|
||||
b.avatar AS avatar,
|
||||
a.content AS content,
|
||||
a.create_time AS date
|
||||
SELECT a.id AS id,
|
||||
b.id AS userId,
|
||||
b.username AS username,
|
||||
COALESCE(b.avatar, '') AS avatar,
|
||||
a.content AS content,
|
||||
a.create_time AS date
|
||||
FROM moment AS a
|
||||
LEFT JOIN user AS b ON a.create_by = b.id
|
||||
ORDER BY a.update_time DESC
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="queryMomentByPage" resultMap="momentPageResultMap">
|
||||
SELECT a.id AS id,
|
||||
b.id AS userId,
|
||||
b.username AS username,
|
||||
COALESCE(b.avatar, '') AS avatar,
|
||||
a.content AS content,
|
||||
a.create_time AS date
|
||||
FROM moment AS a
|
||||
LEFT JOIN user AS b ON a.create_by = b.id
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="queryMomentById" resultMap="momentResultMap">
|
||||
SELECT a.id AS id,
|
||||
b.id AS userId,
|
||||
b.username AS username,
|
||||
b.avatar AS avatar,
|
||||
COALESCE(b.avatar, '') AS avatar,
|
||||
a.content AS content,
|
||||
a.create_time AS date
|
||||
FROM moment AS a
|
||||
LEFT JOIN user AS b ON a.create_by = b.id
|
||||
WHERE a.create_by = #{id}
|
||||
ORDER BY a.update_time DESC
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="queryMomentImage" resultType="java.lang.String">
|
||||
|
||||
Reference in New Issue
Block a user