This commit is contained in:
wuchunlei
2024-04-15 09:52:03 +08:00
4 changed files with 11 additions and 9 deletions

View File

@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j @Slf4j
@RestController("sociologyCourse") @RestController("sociologyCourse")
@@ -22,14 +24,14 @@ public class CourseController {
/** /**
* 获取用户最近学习课程列表 * 获取用户最近学习课程列表
* @param param
* @return * @return
*/ */
@RequestMapping("/getUserLateCourseList") @RequestMapping("/getUserLateCourseList")
public R getUserLateCourseList(@RequestBody ParamTo param){ public R getUserLateCourseList(){
ParamTo param = new ParamTo();
Integer userId = ShiroUtils.getUId(); Integer userId = ShiroUtils.getUId();
param.setId(userId); param.setId(userId);
Page userLateCourseList = courseService.getUserLateCourseList(param); List<CourseEntity> userLateCourseList = courseService.getUserLateCourseList(param);
return R.ok().put("page",userLateCourseList); return R.ok().put("page",userLateCourseList);
} }

View File

@@ -15,7 +15,7 @@ public interface CourseService extends IService<CourseEntity> {
Page<CourseEntity> getSociologyCourseList(ParamTo param); Page<CourseEntity> getSociologyCourseList(ParamTo param);
Page<CourseEntity> getUserLateCourseList(ParamTo param); List<CourseEntity> getUserLateCourseList(ParamTo param);
Page<CourseEntity> getMarketCourseList(ParamTo param); Page<CourseEntity> getMarketCourseList(ParamTo param);

View File

@@ -17,7 +17,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@@ -61,14 +60,15 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
} }
@Override @Override
public Page<CourseEntity> getUserLateCourseList(ParamTo param) { public List<CourseEntity> getUserLateCourseList(ParamTo param) {
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>(); MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class); wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId); wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId);
wrapper.eq(UserToCourseEntity::getUserId,param.getId()); wrapper.eq(UserToCourseEntity::getUserId,param.getId());
wrapper.orderByDesc(UserToCourseEntity::getUpdateTime); wrapper.orderByDesc(UserToCourseEntity::getUpdateTime);
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper); wrapper.last("Limit 4");
return courseEntityPage; List<CourseEntity> courseEntities = this.getBaseMapper().selectJoinList(CourseEntity.class, wrapper);
return courseEntities;
} }
@Override @Override

View File

@@ -79,7 +79,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuDao, SysMenuEntity> i
private List<SysMenuEntity> getMenuList(List<Long> menuIdList) { private List<SysMenuEntity> getMenuList(List<Long> menuIdList) {
// 查询拥有的所有菜单 // 查询拥有的所有菜单
List<SysMenuEntity> menus = this.baseMapper.selectList(new QueryWrapper<SysMenuEntity>() List<SysMenuEntity> menus = this.baseMapper.selectList(new QueryWrapper<SysMenuEntity>()
.in(Objects.nonNull(menuIdList), "menu_id", menuIdList).in("type", 0, 1)); .in(Objects.nonNull(menuIdList), "menu_id", menuIdList).in("type", 0, 1).orderByAsc("order_num"));
// 将id和菜单绑定 // 将id和菜单绑定
HashMap<Long, SysMenuEntity> menuMap = new HashMap<>(12); HashMap<Long, SysMenuEntity> menuMap = new HashMap<>(12);
for (SysMenuEntity s : menus) { for (SysMenuEntity s : menus) {