Search in sources :

Example 6 with Contest

use of com.zzkun.model.Contest in project ACManager by kun368.

the class ContestRepoTest method findAll.

@Test
public void findAll() throws Exception {
    // List<Contest> all = contestRepo.findAll();
    // for (Contest contest : all) {
    // System.out.println(contest);
    // System.out.println(contest.getRanks());
    // }
    // Contest contest = new Contest();
    // contest.setAddUid(1);
    // List<Contest> all = contestRepo.findAll(Example.of(contest));
    // System.out.println(all);
    List<Contest> list = contestRepo.findAll((root, query, cb) -> {
        Predicate p1 = cb.equal(root.get("addUid").as(Integer.class), 1);
        return query.where(p1).getRestriction();
    });
    System.out.println(list);
}
Also used : Contest(com.zzkun.model.Contest) Predicate(javax.persistence.criteria.Predicate) Test(org.junit.Test)

Aggregations

Contest (com.zzkun.model.Contest)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 Test (org.junit.Test)2 JSONArray (com.alibaba.fastjson.JSONArray)1 JSONObject (com.alibaba.fastjson.JSONObject)1 RatingRecord (com.zzkun.model.RatingRecord)1 Stage (com.zzkun.model.Stage)1 Training (com.zzkun.model.Training)1 RankCalculator (com.zzkun.util.rank.RankCalculator)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Predicate (javax.persistence.criteria.Predicate)1 Rating (jskills.Rating)1