添加收藏信息统计接口
This commit is contained in:
parent
0539899129
commit
c20133b410
|
|
@ -33,5 +33,11 @@ public class AppCourseCollectController extends AbstractController {
|
|||
return courseCollectService.selectByUserId(page,limit,userId,classify);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/collectVideoSummary")
|
||||
public Result collectVideoSummary(@RequestAttribute("userId") Long userId){
|
||||
return courseCollectService.collectVideoSummary(userId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CourseCollectDao extends BaseMapper<CourseCollect> {
|
||||
|
|
@ -14,4 +15,5 @@ public interface CourseCollectDao extends BaseMapper<CourseCollect> {
|
|||
List<Course> selectCourseByCollect(@Param("userId") Long userId, @Param("classify") Integer classify);
|
||||
|
||||
|
||||
Map<String, Object> selectSummary(Long userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ public interface CourseCollectService extends IService<CourseCollect> {
|
|||
Result insertCourseCollect(CourseCollect courseCollect);
|
||||
|
||||
Result selectByUserId(Integer page, Integer limit, Long userId,Integer classify);
|
||||
Result collectVideoSummary(Long userId);
|
||||
|
||||
CourseCollect selectCourseCollectUserIdAnd(Long userId,Long courseId,Integer classify,Long courseDetailsId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.sqx.modules.course.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -155,6 +156,10 @@ public class CourseCollectServiceImpl extends ServiceImpl<CourseCollectDao, Cour
|
|||
return Result.success().put("data", PageUtils.page(pageInfo, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result collectVideoSummary(Long userId) {
|
||||
return Result.success().put("data", baseMapper.selectSummary(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseCollect selectCourseCollectUserIdAnd(Long userId, Long courseId, Integer classify, Long courseDetailsId) {
|
||||
|
|
|
|||
|
|
@ -23,5 +23,12 @@
|
|||
GROUP BY u.course_id, c.course_id, d.course_details_name, d.course_details_id
|
||||
ORDER BY produceEndTime DESC
|
||||
</select>
|
||||
<select id="selectSummary" resultType="java.util.Map">
|
||||
SELECT
|
||||
COUNT(CASE WHEN classify = 1 THEN 1 END) AS collectCount,
|
||||
COUNT(CASE WHEN classify = 2 THEN 1 END) AS likecCount
|
||||
FROM course_collect
|
||||
WHERE user_id = #{userId};
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue