zhangzhenhuajack/spring-data-jpa-guide

Spring Data JPA动态查询的例子

zhangzhenhuajack opened this issue · 0 comments

    @Query(value = "select w From WorkflowInfo w where w.deleted = false " +
            "and (:#{#param.projectId} is null or w.projectId = :#{#param.projectId}) " +
            "and (:#{#param.projectIds[0]} = -1L or w.projectId in :#{#param.projectIds}) " +
            "and (:#{#param.workflowTemplateInfoIds[0]} = -1L or w.workflowTemplateInfoId in :#{#param.workflowTemplateInfoIds}) " +
            "and (:#{#param.createdBy} is null or w.createdBy = :#{#param.createdBy}) " +
            "and (:#{#param.status} is null or w.status = :#{#param.status})" +
            "and (:#{#param.ownerUserId} is null or w.ownerUserId = :#{#param.ownerUserId})" +
            "and (:#{#param.workflowName} is null or w.workflowName like %:#{#param.workflowName}%)")
    Page<WorkflowInfo> findWorkflowInfoAll(@Param("param") WorkflowInfo param, Pageable pageable);