
com.gitee.qdbp.jdbc.stream.CrudOnSelectWhereByStream Maven / Gradle / Ivy
package com.gitee.qdbp.jdbc.stream;
import com.gitee.qdbp.able.jdbc.condition.DbWhere;
import com.gitee.qdbp.able.jdbc.fields.Fields;
import com.gitee.qdbp.able.jdbc.ordering.Orderings;
import com.gitee.qdbp.jdbc.api.CrudDao;
/**
* Select+Where后续操作
* 后续操作有: find / orderBy / paging / list
*
* @author zhaohuihua
* @version 20210529
*/
public class CrudOnSelectWhereByStream extends CrudOnSelectOrderByStream {
CrudOnSelectWhereByStream(CrudDao dao, Fields fields, DbWhere where) {
super(dao, fields, where, Orderings.NONE);
}
/**
* 根据查询条件获取对象
*
SysUser user = qdbcBoot.crudStream(SysUser.class)
.select("id,userCode,realName") // 只查某些字段
// .selectExclude("password") // 排除掉密码字段
.where("id").equals("U00001")
.and("userState").in(UserState.NORMAL, UserState.LOCKED)
.end()
.find();
*
*
* @return 实体对象
*/
public T find() {
return dao.find(fields, where);
}
/**
* 设置OrderBy条件
*
List<SysUser> users = qdbcBoot.crudStream(SysUser.class)
.select("id,userCode,realName") // 只查某些字段
// .selectExclude("password") // 排除掉密码字段
.whereBy((where) -> {
...
})
.orderBy("createTime desc")
.list();
*
*
* @param orderings OrderBy条件
* @return 返回后续流式操作对象
*/
public CrudOnSelectOrderByStream orderBy(String orderings) {
return orderBy(Orderings.of(orderings));
}
/**
* 设置OrderBy条件
*
List<SysUser> users = qdbcBoot.crudStream(SysUser.class)
.select("id,userCode,realName") // 只查某些字段
// .selectExclude("password") // 排除掉密码字段
.whereBy((where) -> {
...
})
.orderBy("createTime desc")
.list();
*
*
* @param orderings OrderBy条件
* @return 返回后续流式操作对象
*/
public CrudOnSelectOrderByStream orderBy(Orderings orderings) {
return new CrudOnSelectOrderByStream<>(dao, fields, where, orderings);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy