|
@@ -24,6 +24,9 @@ import com.zhongzheng.modules.collect.mapper.CollectBankMapper;
|
|
|
import com.zhongzheng.modules.collect.mapper.CollectCourseMapper;
|
|
|
import com.zhongzheng.modules.collect.mapper.CollectNoteMapper;
|
|
|
import com.zhongzheng.modules.course.domain.MajorCategory;
|
|
|
+import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
+import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
+import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
|
|
|
import com.zhongzheng.modules.user.bo.*;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
import com.zhongzheng.modules.user.domain.UserBankRecord;
|
|
@@ -79,6 +82,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
@Autowired
|
|
|
private UserMapper userMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IClassGradeUserService iClassGradeUserService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
@@ -140,8 +146,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
|
|
|
@Override
|
|
|
public List<UserVo> selectList(UserQueryBo bo) {
|
|
|
- List<User> list = userMapper.selectList(bo);
|
|
|
- return entity2Vo(list);
|
|
|
+ List<UserVo> list = entity2UserVo(userMapper.selectList(bo));
|
|
|
+ for (UserVo userVo : list) {
|
|
|
+ ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
|
|
|
+ classGradeUserQueryBo.setUserId(userVo.getUserId());
|
|
|
+ List<Integer> status = new ArrayList<>();
|
|
|
+ status.add(1);
|
|
|
+ classGradeUserQueryBo.setStatus(status);
|
|
|
+ List<ClassGradeUserGoodsVo> classGradeUserGoodsVos = iClassGradeUserService.listUser(classGradeUserQueryBo);
|
|
|
+ userVo.setClassGradeUserGoodsVoList(classGradeUserGoodsVos);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -179,6 +194,26 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
return voList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 实体类转化成视图对象
|
|
|
+ *
|
|
|
+ * @param collection 实体类集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<UserVo> entity2UserVo(Collection<User> collection) {
|
|
|
+ List<UserVo> voList = collection.stream()
|
|
|
+ .map(any -> BeanUtil.toBean(any, UserVo.class))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (collection instanceof Page) {
|
|
|
+ Page<User> page = (Page<User>) collection;
|
|
|
+ Page<UserVo> pageVo = new Page<>();
|
|
|
+ BeanUtil.copyProperties(page, pageVo);
|
|
|
+ pageVo.addAll(voList);
|
|
|
+ voList = pageVo;
|
|
|
+ }
|
|
|
+ return voList;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean insertByAddBo(UserAddBo bo) {
|
|
|
User add = BeanUtil.toBean(bo, User.class);
|