|
@@ -61,10 +61,13 @@ class ClassService extends CrudService {
|
|
|
|
|
|
// 自动分组
|
|
|
async groupcreate(termid, batchid, classid) {
|
|
|
- for (let i = 1; i < 8; i++) {
|
|
|
- const name = i + '组';
|
|
|
- const newdata = { name, termid, batchid, classid };
|
|
|
- await this.gmodel.create(newdata);
|
|
|
+ const group = await this.gmodel.find({ termid, batchid, classid });
|
|
|
+ if (group.length === 0) {
|
|
|
+ for (let i = 1; i < 8; i++) {
|
|
|
+ const name = i + '组';
|
|
|
+ const newdata = { name, termid, batchid, classid };
|
|
|
+ await this.gmodel.create(newdata);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|