35 Commits
Author SHA1 Message Date
liwentao 83f3c50a3b Merge remote-tracking branch 'origin/feature/groupCourseSearch' into feature/groupCourseSearch 2026-06-02 18:08:10 +08:00
liwentao ba576a8497 移除已废弃的RedisConfig和RedisService 2026-06-02 18:07:26 +08:00
liwentao 3bfd8e436c 增加Redis缓存功能
注:/api/groupCourse/cache/get接口为测试接口
2026-06-02 18:07:26 +08:00
liwentao 44c5f51fd5 将团课相关代码迁移至gym-GroupCourse模块 2026-06-02 18:07:26 +08:00
liwentao 620c2bb0d9 完成团课查找功能 2026-06-02 18:07:26 +08:00
liwentao 7e306661f2 完成模块2-2.1团课预约 2026-06-02 18:07:23 +08:00
liwentao 5b57639cb2 增加Redis缓存功能
注:/api/groupCourse/cache/get接口为测试接口
2026-06-02 18:07:16 +08:00
liwentao 672f35c16a 将团课相关代码迁移至gym-GroupCourse模块 2026-06-02 18:07:07 +08:00
liwentao 1b2cf91c5b 完成团课查找功能
# Conflicts:
#	gym-manage-api/manage-app/src/main/java/cn/novalon/gym/manage/app/config/SystemRouter.java
#	gym-manage-api/manage-app/src/main/resources/application-dev.yml
#	gym-manage-api/manage-app/src/main/resources/application.yml

# Conflicts:
#	gym-manage-api/pom.xml
2026-06-02 18:06:59 +08:00
liwentao d9e78f1a72 更新分页查询功能:新增关键词查询 2026-06-02 18:06:55 +08:00
liwentao 8e3e169984 完成模块2 2026-06-02 18:06:54 +08:00
liwentao 5bcf6e26a4 移除已废弃的RedisConfig和RedisService 2026-06-02 18:06:54 +08:00
liwentao 7a7f7b47e1 增加Redis缓存功能
注:/api/groupCourse/cache/get接口为测试接口
2026-06-02 18:06:51 +08:00
liwentao dfadb0e32d 将团课相关代码迁移至gym-GroupCourse模块 2026-06-02 18:06:42 +08:00
liwentao 0bf4741b6a 完成团课查找功能 2026-06-02 18:06:34 +08:00
liwentao 840bd58b35 完成模块2-2.1团课预约 2026-06-02 18:06:25 +08:00
liwentao 6b28c74df3 增加Redis缓存功能
注:/api/groupCourse/cache/get接口为测试接口
2026-06-02 18:06:20 +08:00
liwentao fb2d3ba763 移除测试用接口 2026-06-02 18:06:20 +08:00
liwentao 1c33f0855b 将团课相关代码迁移至gym-GroupCourse模块 2026-06-02 18:06:20 +08:00
liwentao 3a934d975b 完成团课查找功能
# Conflicts:
#	gym-manage-api/manage-app/src/main/java/cn/novalon/gym/manage/app/config/SystemRouter.java
#	gym-manage-api/manage-app/src/main/resources/application-dev.yml
#	gym-manage-api/manage-app/src/main/resources/application.yml

# Conflicts:
#	gym-manage-api/pom.xml
2026-06-02 18:06:16 +08:00
liwentao bd7ca6ff1c Merge remote-tracking branch 'origin/feature/groupCourseSearch' into feature/groupCourseSearch 2026-06-02 17:58:41 +08:00
liwentao 7a41a68e23 更新分页查询功能:新增关键词查询 2026-06-02 17:58:26 +08:00
liwentao 526cc25e0e Merge remote-tracking branch 'origin/feature/groupCourseSearch' into feature/groupCourseSearch
# Conflicts:
#	gym-manage-api/gym-member/pom.xml
#	gym-manage-api/manage-app/src/main/resources/application.yml
2026-06-02 17:25:26 +08:00
liwentao 20bc61b5fe 完成模块2 2026-06-02 16:58:49 +08:00
liwentao ef9105266a 移除已废弃的RedisConfig和RedisService 2026-06-01 19:50:39 +08:00
liwentao 3907fcbffb Merge remote-tracking branch 'origin/feature/groupCourseSearch' into feature/groupCourseSearch
# Conflicts:
#	gym-manage-api/gym-groupCourse/src/main/java/cn/novalon/gym/manage/groupcourse/converter/GroupCourseConverter.java
#	gym-manage-api/gym-groupCourse/src/main/java/cn/novalon/gym/manage/groupcourse/handler/GroupCourseHandler.java
#	gym-manage-api/gym-groupCourse/src/main/java/cn/novalon/gym/manage/groupcourse/service/impl/GroupCourseService.java
#	gym-manage-api/manage-app/pom.xml
#	gym-manage-api/manage-app/src/main/java/cn/novalon/gym/manage/app/ManageApplication.java
#	gym-manage-api/manage-app/src/main/java/cn/novalon/gym/manage/app/config/SystemRouter.java
#	gym-manage-api/manage-app/src/main/resources/application.yml
#	gym-manage-api/manage-db/src/main/resources/db/migration/V6__Create_GroupCourse_table.sql
#	gym-manage-api/manage-db/src/main/resources/db/migration/V7__Insert_GroupCourse_test_data.sql
#	gym-manage-api/manage-sys/src/main/java/cn/novalon/gym/manage/sys/config/SecurityConfig.java
#	gym-manage-api/pom.xml
2026-06-01 19:32:14 +08:00
liwentao 1ef00dcfff 完成模块2-2.1团课预约 2026-06-01 19:28:06 +08:00
liwentao 52d0518892 增加Redis缓存功能
注:/api/groupCourse/cache/get接口为测试接口
2026-05-31 13:35:49 +08:00
liwentao a15712c150 移除测试用接口 2026-05-31 13:35:45 +08:00
liwentao 1a6b894ff3 将团课相关代码迁移至gym-GroupCourse模块 2026-05-31 13:35:40 +08:00
liwentao cd2fc12911 完成团课查找功能
# Conflicts:
#	gym-manage-api/manage-app/src/main/java/cn/novalon/gym/manage/app/config/SystemRouter.java
#	gym-manage-api/manage-app/src/main/resources/application-dev.yml
#	gym-manage-api/manage-app/src/main/resources/application.yml
2026-05-31 13:35:26 +08:00
liwentao 493ecd3021 增加Redis缓存功能
注:/api/groupCourse/cache/get接口为测试接口
2026-05-15 17:32:03 +08:00
liwentao 7340f02102 移除测试用接口 2026-05-15 15:51:46 +08:00
liwentao 68fefae774 将团课相关代码迁移至gym-GroupCourse模块 2026-05-10 18:26:33 +08:00
liwentao ffb3f20774 完成团课查找功能 2026-04-30 15:53:40 +08:00
3 changed files with 93 additions and 2 deletions
@@ -18,6 +18,9 @@ public interface IGroupCourseRepository {
Mono<PageResponse<GroupCourse>> findByPage(PageRequest pageRequest);
Mono<PageResponse<GroupCourse>> findByPageAndNotDeleted(PageRequest pageRequest);
Mono<PageResponse<GroupCourse>> findByPageWithKeyword(PageRequest pageRequest);
Mono<PageResponse<GroupCourse>> findByPageWithKeywordAndNotDeleted(PageRequest pageRequest);
Mono<GroupCourse> save(GroupCourse groupCourse);
Mono<GroupCourse> update(GroupCourse groupCourse);
@@ -10,6 +10,7 @@ import cn.novalon.gym.manage.groupcourse.entity.GroupCourseEntity;
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
import org.springframework.data.domain.Sort;
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
import org.springframework.data.relational.core.query.Criteria;
import org.springframework.data.relational.core.query.Query;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
@@ -178,4 +179,84 @@ public class GroupCourseRepository implements IGroupCourseRepository {
return Mono.empty();
});
}
@Override
public Mono<PageResponse<GroupCourse>> findByPageWithKeyword(PageRequest pageRequest) {
int page = pageRequest.getPage();
int size = pageRequest.getSize();
String sort = pageRequest.getSort();
String order = pageRequest.getOrder();
String keyword = pageRequest.getKeyword();
Sort sortObj = Sort.unsorted();
if (sort != null && !sort.isEmpty()) {
sortObj = Sort.by(Sort.Direction.fromString(order), sort);
}
org.springframework.data.domain.PageRequest pageable = org.springframework.data.domain.PageRequest.of(page, size, sortObj);
Criteria criteria = Criteria.empty();
if (keyword != null && !keyword.isEmpty()) {
criteria = criteria.or(Criteria.where("course_name").like("%" + keyword + "%"))
.or(Criteria.where("location").like("%" + keyword + "%"))
.or(Criteria.where("description").like("%" + keyword + "%"));
}
Query query = Query.query(criteria);
return r2dbcEntityTemplate.select(GroupCourseEntity.class)
.matching(query.with(pageable))
.all()
.collectList()
.zipWith(r2dbcEntityTemplate.count(query, GroupCourseEntity.class))
.map(tuple -> {
long total = tuple.getT2();
int totalPages = (int) Math.ceil((double) total / size);
List<GroupCourse> courseList = tuple.getT1().stream()
.map(groupCourseConverter::toDomain)
.toList();
return new PageResponse<>(courseList, totalPages, total, page, size);
});
}
@Override
public Mono<PageResponse<GroupCourse>> findByPageWithKeywordAndNotDeleted(PageRequest pageRequest) {
int page = pageRequest.getPage();
int size = pageRequest.getSize();
String sort = pageRequest.getSort();
String order = pageRequest.getOrder();
String keyword = pageRequest.getKeyword();
Sort sortObj = Sort.unsorted();
if (sort != null && !sort.isEmpty()) {
sortObj = Sort.by(Sort.Direction.fromString(order), sort);
}
org.springframework.data.domain.PageRequest pageable = org.springframework.data.domain.PageRequest.of(page, size, sortObj);
Criteria criteria = Criteria.where("deleted_at").isNull();
if (keyword != null && !keyword.isEmpty()) {
criteria = criteria.and(
Criteria.where("course_name").like("%" + keyword + "%")
.or(Criteria.where("location").like("%" + keyword + "%"))
.or(Criteria.where("description").like("%" + keyword + "%"))
);
}
Query query = Query.query(criteria);
return r2dbcEntityTemplate.select(GroupCourseEntity.class)
.matching(query.with(pageable))
.all()
.collectList()
.zipWith(r2dbcEntityTemplate.count(query, GroupCourseEntity.class))
.map(tuple -> {
long total = tuple.getT2();
int totalPages = (int) Math.ceil((double) total / size);
List<GroupCourse> courseList = tuple.getT1().stream()
.map(groupCourseConverter::toDomain)
.toList();
return new PageResponse<>(courseList, totalPages, total, page, size);
});
}
}
@@ -139,10 +139,17 @@ public class GroupCourseService implements IGroupCourseService {
Mono.defer(() -> {
logger.debug("缓存未命中,查询数据库 - findByPage: key={}", cacheKey);
Mono<PageResponse<GroupCourse>> resultMono;
boolean hasKeyword = keyword != null && !keyword.isEmpty();
if (includeDeleted) {
resultMono = groupCourseRepository.findByPage(pageRequest);
resultMono = hasKeyword
? groupCourseRepository.findByPageWithKeyword(pageRequest)
: groupCourseRepository.findByPage(pageRequest);
} else {
resultMono = groupCourseRepository.findByPageAndNotDeleted(pageRequest);
resultMono = hasKeyword
? groupCourseRepository.findByPageWithKeywordAndNotDeleted(pageRequest)
: groupCourseRepository.findByPageAndNotDeleted(pageRequest);
}
return resultMono.flatMap(pageResponse -> {