JPA specification

filters : [["name" , "like" ,"java"]]

MANY to Many
@GetMapping({"/skill/getlist/", "/skill/getlist"})
public Page<TSkill> getlist(@RequestParam Map<String, String> param) {
    PageableSpec<TSkill> pageableSpec = SpecificationUtils.of(param);
    Specification<TSkill> checkPublish = null;
    if (param.get("iduser").isEmpty()) {
        return tSkillRepo.findAll(pageableSpec.getSpecification().and(checkPublish), pageableSpec.getPageable());
    }
    checkPublish = (Specification<TSkill>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(
            root.join("user", JoinType.INNER).get("id"), param.get("iduser"));
    return tSkillRepo.findAll(pageableSpec.getSpecification().and(checkPublish), pageableSpec.getPageable());
}

Share on Google Plus

About riki aldi pari

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 komentar:

Posting Komentar