Spring Jpa规范IN封闭

时间:2018-10-04 09:15:42

标签: spring spring-boot spring-data-jpa jpa-criteria

JPA规范查询希望为IN子句创建一个规范。有人可以告诉我如何为IN参数子句

创建JPA规范。
public interface BmsVcashQueryRepository extends JpaRepository<BmsVcashquery, String>, JpaSpecificationExecutor<BmsVcashquery> {

    ...

    class CashQuerySpecification {
        public static Specification<BmsVcashquery> paymentModeIs(String paymentmode) {
            return (root, query, cb) -> cb.like(root.get("paymentmode"), paymentmode);
        }

        public static Specification<BmsVcashquery> paymentIs(String payment) {
            return (root, query, cb) -> cb.like(root.get("inoviceCreditorcash"), payment);
        }
    }

}

0 个答案:

没有答案