ebean相关的查询

薄洪涛4年前JAVA1390

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}")


相关文章

docker-swarm部署java项目

技术栈Java 版本: 17Spring Boot 版本: 3.xMyBatis-Plus: 简化 MyBatis 操作的增强工具PostgreSQL: 关系型数据库Redis: 分布式缓存解决方案R...

spring中什么情况下事务会失效?

事务失效的场景?权限问题,@Transactional 修饰的方法必须为public方法用final修饰或者是static方法,spring事务底层使用了aop,也就是通过jdk动态代理或者cglib...

Intellij IDEA实现热部署

Intellij IDEA实现热部署

每次修改代码都需要重新编译,然后重启Tomcat,比较麻烦,我们可以通过Jrebel实现项目的热部署,从而不需要重启Tomcat首先安装plugin如果在线安装时间比较长,可以选择自己下载包(点我自己...

springboot实现定时任务

springboot实现定时任务

之前做php的时候,如果想做个定时任务,或者想特定时间调用某个脚本/接口,我们都会考虑使用linux的crontab来实现,比较对于单线程脚本语言来说,做定时不是那么容易然后最近因为开始学习java,...

jenkins部署maven项目

1. 环境配置jenkins安装 Maven Integration plugin插件配置maven,java等路径2. 2.新建item,选择构建maven项目a. 2.1 源码管理填入git地址、...

redis缓存雪崩,缓存击穿,缓存穿透

redis缓存雪崩,缓存击穿,缓存穿透

缓存雪崩同一时间大量redis缓存数据失效,造成大量请求涌入数据库,数据库压力增大崩掉解决方案缓存过期时间加随机值增加过期表示,缓存过期后,自动更新缓存缓存穿透缓存和数据库中都没有的数据,每次查询都会...

发表评论    

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