GraphQL + SpringBoot + React應(yīng)用開(kāi)發(fā)


ql編寫(xiě)

??@DgsQuery
??public List<User> users(DataFetchingEnvironment dfe) {
????AuthContext authContext = DgsContext.getCustomContext(dfe);
????authContext.ensureAuthenticated();
????List<UserEntity> userEntityList = userEntityMapper.selectList(null);
????List<User> userList = userEntityList.stream()
????????.map(User::fromEntity)
????????.collect(Collectors.toList());
????return userList;
??}
標(biāo)簽: