mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-07-24 10:19:31 +08:00
删除线上课的同时清空学习记录
This commit is contained in:
parent
d7ae1358b7
commit
b0034fbe94
@ -5,6 +5,8 @@ import org.springframework.context.event.EventListener;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import xyz.playedu.api.event.CourseDestroyEvent;
|
import xyz.playedu.api.event.CourseDestroyEvent;
|
||||||
import xyz.playedu.api.service.CourseDepartmentService;
|
import xyz.playedu.api.service.CourseDepartmentService;
|
||||||
|
import xyz.playedu.api.service.UserCourseHourRecordService;
|
||||||
|
import xyz.playedu.api.service.UserCourseRecordService;
|
||||||
import xyz.playedu.api.service.internal.ResourceCourseCategoryService;
|
import xyz.playedu.api.service.internal.ResourceCourseCategoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,6 +23,12 @@ public class CourseDestroyListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ResourceCourseCategoryService courseCategoryService;
|
private ResourceCourseCategoryService courseCategoryService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserCourseRecordService userCourseRecordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserCourseHourRecordService userCourseHourRecordService;
|
||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
public void departmentRelateRemove(CourseDestroyEvent event) {
|
public void departmentRelateRemove(CourseDestroyEvent event) {
|
||||||
courseDepartmentService.removeByCourseId(event.getCourseId());
|
courseDepartmentService.removeByCourseId(event.getCourseId());
|
||||||
@ -31,4 +39,10 @@ public class CourseDestroyListener {
|
|||||||
courseCategoryService.removeByCourseId(event.getCourseId());
|
courseCategoryService.removeByCourseId(event.getCourseId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventListener
|
||||||
|
public void removeUserRecords(CourseDestroyEvent event) {
|
||||||
|
userCourseRecordService.removeByCourseId(event.getCourseId());
|
||||||
|
userCourseHourRecordService.removeByCourseId(event.getCourseId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,6 @@ public interface UserCourseHourRecordService extends IService<UserCourseHourReco
|
|||||||
List<UserCourseHourRecord> getRecords(Integer userId, Integer courseId);
|
List<UserCourseHourRecord> getRecords(Integer userId, Integer courseId);
|
||||||
|
|
||||||
List<UserCourseHourRecord> getLatestCourseIds(Integer userId, Integer size);
|
List<UserCourseHourRecord> getLatestCourseIds(Integer userId, Integer size);
|
||||||
|
|
||||||
|
void removeByCourseId(Integer courseId);
|
||||||
}
|
}
|
||||||
|
@ -23,4 +23,6 @@ public interface UserCourseRecordService extends IService<UserCourseRecord> {
|
|||||||
PaginationResult<UserCourseRecord> paginate(int page, int size, CourseUserPaginateFilter filter);
|
PaginationResult<UserCourseRecord> paginate(int page, int size, CourseUserPaginateFilter filter);
|
||||||
|
|
||||||
void destroy(Integer courseId, List<Integer> ids);
|
void destroy(Integer courseId, List<Integer> ids);
|
||||||
|
|
||||||
|
void removeByCourseId(Integer courseId);
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,11 @@ public class UserCourseHourRecordServiceImpl extends ServiceImpl<UserCourseHourR
|
|||||||
public List<UserCourseHourRecord> getLatestCourseIds(Integer userId, Integer size) {
|
public List<UserCourseHourRecord> getLatestCourseIds(Integer userId, Integer size) {
|
||||||
return getBaseMapper().getUserLatestRecords(userId, size);
|
return getBaseMapper().getUserLatestRecords(userId, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeByCourseId(Integer courseId) {
|
||||||
|
remove(query().getWrapper().eq("course_id", courseId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,6 +94,11 @@ public class UserCourseRecordServiceImpl extends ServiceImpl<UserCourseRecordMap
|
|||||||
public void destroy(Integer courseId, List<Integer> ids) {
|
public void destroy(Integer courseId, List<Integer> ids) {
|
||||||
remove(query().getWrapper().in("id", ids).eq("course_id", courseId));
|
remove(query().getWrapper().in("id", ids).eq("course_id", courseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeByCourseId(Integer courseId) {
|
||||||
|
remove(query().getWrapper().eq("course_id", courseId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user