| | |
| | | package com.xinquan.user.controller.client; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.user.api.domain.AppUser; |
| | | import com.xinquan.user.domain.AppUserCourse; |
| | | import com.xinquan.user.domain.vo.AppUserVO; |
| | | import com.xinquan.user.service.AppUserCourseService; |
| | | import com.xinquan.user.service.AppUserService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/client/app-user-course") |
| | | public class ClientAppUserCourseController { |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private AppUserCourseService appUserCourseService; |
| | | |
| | | /** |
| | | * 远程调用 根据课程id 查询拥有课程的用户 |
| | | * |
| | | * @return 用户信息 |
| | | * @see com.xinquan.user.domain.vo.AppUserVO |
| | | */ |
| | | @GetMapping("/getUserByCourseId/{courseId}") |
| | | public R<List<String>> getUserByCourseId(@PathVariable("courseId") Long courseId) { |
| | | List<Long> collect = appUserCourseService.lambdaQuery().eq(AppUserCourse::getCourseId, courseId).list() |
| | | .stream().map(AppUserCourse::getAppUserId).collect(Collectors.toList()); |
| | | // 批量查询用户头像 |
| | | List<String> collect1 = appUserService.lambdaQuery().in(!collect.isEmpty(), AppUser::getId, collect).list() |
| | | .stream().map(AppUser::getAvatar).collect(Collectors.toList()); |
| | | return R.ok(collect1); |
| | | } |
| | | |
| | | } |
| | | |