package com.boying.dao;
|
|
import com.boying.common.BaseDao;
|
import com.boying.entity.StudyRecord;
|
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.stereotype.Repository;
|
|
import java.util.Date;
|
import java.util.List;
|
|
@Repository("studyRecordDao")
|
public interface StudyRecordDao extends BaseDao<StudyRecord, Long>{
|
@Query(value = "select count(DISTINCT studyId) from StudyRecord where type=:type and userId=:userId")
|
int countByType(int type,Long userId);
|
|
@Query(value = "select sum(time) from StudyRecord where userId=:userId")
|
Integer sumByTime(Long userId);
|
|
@Query(value = "select sum(xueShi) from StudyRecord where userId=:userId and createTime >:date")
|
Integer sumByTime2(Long userId, Date date);
|
|
@Query(nativeQuery = true,value = "select sum(xueShi) as t,userName from studyRecord group by userName order by t desc LIMIT 3")
|
List<Object> paiMing();
|
|
@Query(value = "from StudyRecord where userId=:userId and studyId=:id")
|
StudyRecord findByUserIdAndStudyId(Long userId, Long id);
|
|
@Query(value = "select sum(xueShi) from StudyRecord where userId=:userId")
|
Integer sumByXueShi(Long userId);
|
|
@Query(value = "select sum(time) from StudyRecord where userId=:userId and createTime >:date")
|
Integer sumByTime22(Long userId, Date d);
|
}
|