课程目录迁移

充值记录列表添加vip详细信息
This commit is contained in:
wuchunlei
2024-06-11 16:44:33 +08:00
parent a4956714ab
commit 730693c654
6 changed files with 73 additions and 0 deletions

View File

@@ -155,6 +155,12 @@ public class CourseController {
return R.ok().put("result",sysCourseDirectEntity);
}
//课程目录迁移
@RequestMapping("/courseCatalogueTransfer")
public R courseCatalogueTransfer(@RequestBody Map<String,Object> param){
return courseService.courseCatalogueTransfer(param);
}
@@ -170,4 +176,6 @@ public class CourseController {
return R.ok();
}
}

View File

@@ -26,4 +26,6 @@ public interface CourseService extends IService<CourseEntity> {
void testCourse();
List<CourseEntity> courseAndChildrenList(Map<String, Object> params);
R courseCatalogueTransfer(Map<String,Object> param);
}

View File

@@ -29,6 +29,13 @@ public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalog
wrapper.eq(CourseCatalogueChapterEntity::getCatalogueId,param.getId());
wrapper.orderByAsc(CourseCatalogueChapterEntity::getSort);
Page<CourseCatalogueChapterEntity> page = this.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
if (page.getRecords() != null&&page.getRecords().size() > 0){
for (CourseCatalogueChapterEntity chapter:page.getRecords()){
LambdaQueryWrapper<CourseCatalogueChapterVideoEntity> videoWrapper = new LambdaQueryWrapper<>();
videoWrapper.eq(CourseCatalogueChapterVideoEntity::getChapterId,chapter.getId());
chapter.setVideoList(courseCatalogueChapterVideoDao.selectList(videoWrapper));
}
}
return page;
}

View File

@@ -37,9 +37,13 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
@Autowired
private CourseCatalogueDao courseCatalogueDao;
@Autowired
private CourseCatalogueChapterDao chapterDao;
@Autowired
private ShopProductDao shopProductDao;
@Autowired
private ShopProductCourseDao shopProductCourseDao;
@Autowired
private UserCourseBuyDao userCourseBuyDao;
@Override
public Page getCourseList(Map<String,Object> map) {
@@ -213,6 +217,48 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
return courseList;
}
@Override
public R courseCatalogueTransfer(Map<String, Object> param) {
String courseId = param.get("courseId").toString();
CourseCatalogueEntity catalogueEntity = courseCatalogueDao.selectById(param.get("catalogueId").toString());
if (catalogueEntity!=null){
//修改课程目录
catalogueEntity.setCourseId(Integer.parseInt(courseId));
courseCatalogueDao.updateById(catalogueEntity);
//修改目录下章节的课程字段
LambdaQueryWrapper<CourseCatalogueChapterEntity> chapterWrapper = new LambdaQueryWrapper<>();
chapterWrapper.eq(CourseCatalogueChapterEntity::getCatalogueId,catalogueEntity.getId());
List<CourseCatalogueChapterEntity> chapterList = chapterDao.selectList(chapterWrapper);
if (chapterList != null && chapterList.size() > 0) {
for (CourseCatalogueChapterEntity chapterEntity : chapterList) {
chapterEntity.setCourseId(Integer.parseInt(courseId));
chapterDao.updateById(chapterEntity);
}
}
//修改商品课程下的课程字段
LambdaQueryWrapper<ShopProductCourseEntity> shopProductCourseWrapper = new LambdaQueryWrapper<>();
shopProductCourseWrapper.eq(ShopProductCourseEntity::getCatalogueId,catalogueEntity.getId());
List<ShopProductCourseEntity> shopProductCourseList = shopProductCourseDao.selectList(shopProductCourseWrapper);
if (shopProductCourseList != null && shopProductCourseList.size() > 0) {
for (ShopProductCourseEntity spc : shopProductCourseList) {
spc.setCourseId(Integer.parseInt(courseId));
shopProductCourseDao.updateById(spc);
}
}
//修改user_course_buy下的课程字段
LambdaQueryWrapper<UserCourseBuyEntity> userCourseBuyWrapper = new LambdaQueryWrapper<>();
userCourseBuyWrapper.eq(UserCourseBuyEntity::getCatalogueId,catalogueEntity.getId());
List<UserCourseBuyEntity> userCourseBuyList = userCourseBuyDao.selectList(userCourseBuyWrapper);
if (userCourseBuyList != null && userCourseBuyList.size() > 0) {
for (UserCourseBuyEntity buy : userCourseBuyList) {
buy.setCourseId(Integer.parseInt(courseId));
userCourseBuyDao.updateById(buy);
}
}
}
return R.ok();
}
private List<Integer> sociologyIds(Integer id){
ArrayList<Integer> integers = new ArrayList<>();