All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gitee.qdbp.jdbc.stream.CrudOnSelectPagingStream 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.OrderPaging;
import com.gitee.qdbp.able.jdbc.ordering.Orderings;
import com.gitee.qdbp.able.jdbc.paging.PageList;
import com.gitee.qdbp.able.jdbc.paging.Paging;
import com.gitee.qdbp.jdbc.api.CrudDao;

/**
 * Select分页后续操作
* paging后续操作有 list * * @author zhaohuihua * @version 20210529 */ public class CrudOnSelectPagingStream { protected final CrudDao dao; protected final Fields fields; protected final DbWhere where; protected final Orderings orderings; protected final Paging paging; CrudOnSelectPagingStream(CrudDao dao, Fields fields, DbWhere where, Orderings orderings, Paging paging) { this.dao = dao; this.fields = fields; this.where = where; this.orderings = orderings; this.paging = paging; } /** * 根据条件查询实体列表
*
    List<SysUser> users = qdbcBoot.crudStream(SysUser.class)
        .select("id,userCode,realName") // 只查某些字段
        // .selectExclude("password") // 排除掉密码字段
        .where("userType").equals(1)
            .and("createTime").between(DateTools.addDay(now, -1), DateTools.addDay(now, +1))
            .and().subCondition((w) -> {
                w.on("userCode").like("test")
                 .or("realName").like("test");
            })
            .end()
        .orderBy("createTime desc")
        .pageBy(1, 10) // 分页查询
        .list().asPartList(); // 分页后返回的是PageList, 需要转换为普通List
     * 
* * @return 列表数据 */ public PageList list() { OrderPaging odpg = OrderPaging.of(paging, orderings); return dao.list(fields, where, odpg); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy