mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-22 18:29:51 +08:00
学员批量导入
This commit is contained in:
@@ -23,4 +23,6 @@ public interface DepartmentService extends IService<Department> {
|
||||
|
||||
void update(Department department, String name, Integer parentId, Integer sort) throws NotFoundException;
|
||||
|
||||
List<Integer> allIds();
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import xyz.playedu.api.types.paginate.PaginationResult;
|
||||
import xyz.playedu.api.types.paginate.UserPaginateFilter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tengteng
|
||||
* @description 针对表【users】的数据库操作Service
|
||||
@@ -14,4 +16,6 @@ public interface UserService extends IService<User> {
|
||||
boolean emailIsExists(String email);
|
||||
|
||||
PaginationResult<User> paginate(int page, int size, UserPaginateFilter filter);
|
||||
|
||||
List<String> existsEmailsByEmails(List<String> emails);
|
||||
}
|
||||
|
||||
@@ -115,6 +115,16 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
||||
}
|
||||
updateBatchById(updateRows);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> allIds() {
|
||||
List<Department> departments = list(query().getWrapper().eq("1", "1").select("id"));
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
for (Department department : departments) {
|
||||
ids.add(department.getId());
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ import org.springframework.stereotype.Service;
|
||||
import xyz.playedu.api.types.paginate.PaginationResult;
|
||||
import xyz.playedu.api.types.paginate.UserPaginateFilter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tengteng
|
||||
* @description 针对表【users】的数据库操作Service实现
|
||||
@@ -72,6 +75,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> existsEmailsByEmails(List<String> emails) {
|
||||
List<User> users = list(query().getWrapper().in("email", emails).select("id", "email"));
|
||||
List<String> existsEmails = new ArrayList<>();
|
||||
for (User user : users) {
|
||||
existsEmails.add(user.getEmail());
|
||||
}
|
||||
return existsEmails;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user