批量开课

This commit is contained in:
wangjinlei
2025-04-01 09:52:21 +08:00
parent 97ad8c910a
commit 62fdec7810
2 changed files with 5 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ import java.util.ArrayList;
@Data
public class AddCourses {
private String catalogueId;
private String catalogue_id;
private Integer days;
private ArrayList<MyUserEntity> list;
}

View File

@@ -84,8 +84,9 @@ public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, User
HashMap<String, ArrayList<AddCoursesFrag>> frag = new HashMap<>();
ArrayList<AddCoursesFrag> falseList = new ArrayList<>();
ArrayList<AddCoursesFrag> successList = new ArrayList<>();
String[] cata = (addCourses.getCatalogueId()).split(",");
String[] cata = (addCourses.getCatalogue_id()).split(",");
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueDao.selectById(cata[0]);
ArrayList<UserCourseBuyEntity> l = new ArrayList<>();
for (MyUserEntity m : addCourses.getList()){
for (String s : cata) {
int check = this.getBaseMapper().selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>()
@@ -106,7 +107,7 @@ public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, User
userCourseBuyEntity.setCatalogueId(Integer.valueOf(s));
userCourseBuyEntity.setDays(addCourses.getDays());
userCourseBuyEntity.setUserId(m.getId());
this.getBaseMapper().insert(userCourseBuyEntity);
l.add(userCourseBuyEntity);
AddCoursesFrag addCoursesFrag = new AddCoursesFrag();
addCoursesFrag.setUserId(m.getId());
@@ -119,6 +120,7 @@ public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, User
}
}
}
this.saveBatch(l);
frag.put("successList",successList);
frag.put("failList",falseList);
return frag;