|
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
import com.xjrsoft.common.enums.EnabledMark;
|
|
|
import com.xjrsoft.common.enums.RoleEnum;
|
|
@@ -30,6 +31,12 @@ import com.xjrsoft.module.organization.entity.*;
|
|
|
import com.xjrsoft.module.organization.service.*;
|
|
|
import com.xjrsoft.module.organization.vo.*;
|
|
|
import com.xjrsoft.module.oss.factory.OssFactory;
|
|
|
+import com.xjrsoft.module.student.entity.BaseClass;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudent;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentUser;
|
|
|
+import com.xjrsoft.module.student.service.IBaseClassService;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentClassVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -78,6 +85,7 @@ public class UserController {
|
|
|
private final SmsCtcc smsCtcc;
|
|
|
|
|
|
private final IUserStudentService userStudentService;
|
|
|
+ private final IBaseClassService baseClassService;
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/list")
|
|
@@ -192,6 +200,10 @@ public class UserController {
|
|
|
.eq(UserPostRelation::getUserId, user.getId().toString()))
|
|
|
.stream().map(UserPostRelation::getPostId).collect(Collectors.toList());
|
|
|
|
|
|
+ List<Long> studentIds = userStudentService.list(Wrappers.lambdaQuery(UserStudent.class)
|
|
|
+ .eq(UserStudent::getUserId, user.getId().toString()))
|
|
|
+ .stream().map(UserStudent::getStudentId).collect(Collectors.toList());
|
|
|
+
|
|
|
UserInfoVo vo = BeanUtil.toBean(user, UserInfoVo.class);
|
|
|
if (roleIds.size() > 0) {
|
|
|
|
|
@@ -220,6 +232,22 @@ public class UserController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if (studentIds.size() > 0) {
|
|
|
+ MPJLambdaWrapper<BaseClass> queryWrapper = new MPJLambdaWrapper<>();
|
|
|
+ queryWrapper
|
|
|
+ .disableSubLogicDel()
|
|
|
+ .rightJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getClassId, BaseStudent::getId)
|
|
|
+ .innerJoin(BaseStudentUser.class, BaseStudentUser::getId, BaseStudentSchoolRoll::getUserId)
|
|
|
+ .in(BaseStudentSchoolRoll::getUserId, studentIds)
|
|
|
+ .selectAs(BaseClass::getName, UserStudentVo::getClassName)
|
|
|
+ .selectAs(BaseStudentUser::getName, UserStudentVo::getStudentName)
|
|
|
+ .selectAs(BaseStudentUser::getId, UserStudentVo::getStudentId)
|
|
|
+ .selectAs(BaseStudentUser::getAvatar, UserStudentVo::getAvatar);
|
|
|
+
|
|
|
+ List<BaseClass> list = baseClassService.list(queryWrapper);
|
|
|
+ List<UserStudentVo> userStudentVoList = BeanUtil.copyToList(list, UserStudentVo.class);
|
|
|
+ vo.setStudents(userStudentVoList);
|
|
|
+ }
|
|
|
|
|
|
return R.ok(vo);
|
|
|
}
|