package xyz.acmer.repository.contest;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import xyz.acmer.entity.contest.ContestInfo;

/**
 * 比赛信息DAO
 * Created by hypo on 16-2-26.
 */
@Repository
@Transactional
public interface ContestInfoRepository extends JpaRepository<ContestInfo, Long> {
}

@@ -86,32 +86,142 @@
 .JpaRepository;%0A
+import org.springframework.data.jpa.repository.Query;%0Aimport org.springframework.data.repository.query.Param;%0A
 import org.sprin
@@ -363,16 +363,108 @@
 estInfo;
+%0Aimport xyz.acmer.entity.contest.ContestType;%0A%0Aimport java.util.Date;%0Aimport java.util.List;
 %0A%0A/**%0A *
@@ -615,11 +615,799 @@
  Long%3E %7B
+%0A%0A    @Query(%22SELECT c FROM ContestInfo c ORDER BY c.beginTime DESC%22)%0A    List%3CContestInfo%3E getAllContestByBeginTime();%0A%0A    @Query(%22SELECT c FROM ContestInfo c WHERE c.contestType=:type ORDER BY c.beginTime DESC%22)%0A    List%3CContestInfo%3E getContestByContestType(@Param(%22type%22)ContestType contestType);%0A%0A    @Query(%22SELECT c FROM ContestInfo c WHERE c.beginTime%3E:now ORDER BY c.beginTime DESC%22)%0A    List%3CContestInfo%3E getContestScheduled(@Param(%22date%22)Date now);%0A%0A    @Query(%22SELECT c FROM ContestInfo c WHERE c.endTime%3E:now AND c.beginTime%3C:now ORDER BY c.beginTime DESC%22)%0A    List%3CContestInfo%3E getContestRunning(@Param(%22date%22)Date now);%0A%0A    @Query(%22SELECT c FROM ContestInfo c WHERE c.endTime%3C:now ORDER BY c.beginTime DESC%22)%0A    List%3CContestInfo%3E getContestEnded(@Param(%22date%22)Date now);
 %0A%7D%0A

update repository