mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-22 18:29:51 +08:00
added: 课时重复添加检测
This commit is contained in:
@@ -7,10 +7,10 @@ import xyz.playedu.api.exception.NotFoundException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tengteng
|
||||
* @description 针对表【course_hour】的数据库操作Service
|
||||
* @createDate 2023-03-15 10:16:45
|
||||
*/
|
||||
* @author tengteng
|
||||
* @description 针对表【course_hour】的数据库操作Service
|
||||
* @createDate 2023-03-15 10:16:45
|
||||
*/
|
||||
public interface CourseHourService extends IService<CourseHour> {
|
||||
|
||||
CourseHour findOrFail(Integer id, Integer courseId) throws NotFoundException;
|
||||
@@ -28,4 +28,6 @@ public interface CourseHourService extends IService<CourseHour> {
|
||||
void remove(Integer courseId, Integer chapterId);
|
||||
|
||||
void updateSort(List<Integer> ids, Integer cid);
|
||||
|
||||
List<Integer> getRidsByCourseId(Integer courseId, String type);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author tengteng
|
||||
@@ -93,6 +94,11 @@ public class CourseHourServiceImpl extends ServiceImpl<CourseHourMapper, CourseH
|
||||
}
|
||||
updateBatchById(hours);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getRidsByCourseId(Integer courseId, String type) {
|
||||
return list(query().getWrapper().eq("course_id", courseId).eq("type", type)).stream().map(CourseHour::getRid).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user