ebean相关的查询

薄洪涛4年前JAVA1185

where

// select * from user where name = "boht"List<User> user = new Quser().name.equalTo("boht").findList();

and

// select * from user where name = "boht" and age > 25List<User> user = new Quser().name.equalTo("boht").age.gt(25).findList()

or

// select * from user where name = "boht" or phone = '18615632853'List<User> user = new Quser().or().name.equalTo("boht").phone.equalTo("18615632851").findList()

原始表达式*

List<User> user = QUser().or().raw("(userid = ? or phone = ?)","11696357","18561803625").findList()

// 子查询 in --> select userid xxx
List<User> user = QUser().or().raw("(userid in ('11696357','11696362')").findList()

//

orderBy

List<User> user = QUser().userid.order().userid.desc() / asc()

select

可以在select中使用SUM, MAX, MIN, AVG and COUNT

QUser().select("p_user.userid,p_user.phone,p_user.name")

count

Quser().findCount()

exist

Quser().userid.eq("11696357").exists()

打印sql

logger.info("${query.generatedSql}")


相关文章

基于dubbo改造现有http调用项目

使用zooker作为注册中心,将现有通过http调用的项目改造成dubbo调用公共项目规定接口public interface OrderService {  ...

Ebean报错is not enhanced?

Ebean报错is not enhanced?

使用ebean的时候,会提示某个类没有enhanced,这里我们在idea中安装对应的plugin就可以了(需要看你的gradle的ebean版本)我的版本配置如下classpath("io...

spring循环依赖

spring循环依赖

什么是循环依赖? 很简单,就是A对象依赖了B对象,B对象依赖了A对象在Spring中,⼀个对象并不是简单new出来了,⽽是会经过⼀系列的Bean的⽣命周期,就是因为 Bean的⽣命周期所以才会出现循环...

zookeeper安装

zookeeper安装

1. 下载安装包解压https://archive.apache.org/dist/zookeeper/2. 修改配置文件新建文件夹创建配置文件,修改路径配置文件参数详细介绍tickTime=2000...

Springboot+Kotlin的搭建

Springboot+Kotlin的搭建

不少公司觉得php的性能较低,于是采用java做逻辑处理,php做表现层的做法,个人觉得对于业务量比较复杂,安全性要求较高的项目,可以采用此类做法;于是我学着搭建了一个基于spring boot的接口...

idea 部署Tomcat服务器

idea 部署Tomcat服务器

一、创建一个web项目1.file-new project,选择正确的jdk版本后(没配置的可以先自行google配置),next2.next3.输入项目名字和路径二,创建Module1.鼠标点中项目...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。