返回学习统计

This commit is contained in:
none
2023-03-24 11:50:47 +08:00
parent 83717baafe
commit 761458c370
5 changed files with 79 additions and 15 deletions

View File

@@ -18,4 +18,8 @@ public interface UserLearnDurationStatsService extends IService<UserLearnDuratio
Long yesterdayTotal();
List<UserLearnDurationStats> top10();
Integer todayUserDuration(Integer userId);
Integer userDuration(Integer userId);
}

View File

@@ -66,6 +66,17 @@ public class UserLearnDurationStatsServiceImpl extends ServiceImpl<UserLearnDura
String today = simpleDateFormat.format(new Date());
return list(query().getWrapper().eq("created_date", today).orderByDesc("duration").last("limit 10"));
}
@Override
public Integer todayUserDuration(Integer userId) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
return getBaseMapper().getUserDateDuration(userId, simpleDateFormat.format(new Date()));
}
@Override
public Integer userDuration(Integer userId) {
return getBaseMapper().getUserDuration(userId);
}
}