<commit_before>package org.nutz.dao.util.cri;

import org.nutz.dao.Condition;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Entity;
import org.nutz.dao.impl.sql.pojo.AbstractPItem;
import org.nutz.dao.jdbc.ValueAdaptor;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Criteria;
import org.nutz.dao.sql.GroupBy;
import org.nutz.dao.sql.OrderBy;
import org.nutz.dao.sql.Pojo;

public class SimpleCriteria extends AbstractPItem implements Criteria, OrderBy, GroupBy {

    private SqlExpressionGroup where;

    private OrderBySet orderBy;
    
    private GroupBySet groupBy;

    private Pager pager;

    public SimpleCriteria() {
        where = new SqlExpressionGroup();
        orderBy = new OrderBySet();
    }

    public void joinSql(Entity<?> en, StringBuilder sb) {
        where.joinSql(en, sb);
        if (groupBy != null)
        	groupBy.joinSql(en, sb);
        orderBy.joinSql(en, sb);
    }

    public void setPojo(Pojo pojo) {
        where.setPojo(pojo);
        orderBy.setPojo(pojo);
        groupBy.setPojo(pojo);
    }

    public void setPager(int pageNumber, int pageSize) {
        pager = new Pager();
        pager.setPageNumber(pageNumber);
        pager.setPageSize(pageSize);
    }

    public void setPager(Pager pager) {
        this.pager = pager;<commit_msg>fix: SimpleCriteria的GrpBy爆NPE<commit_after>package org.nutz.dao.util.cri;

import org.nutz.dao.Condition;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Entity;
import org.nutz.dao.impl.sql.pojo.AbstractPItem;
import org.nutz.dao.jdbc.ValueAdaptor;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Criteria;
import org.nutz.dao.sql.GroupBy;
import org.nutz.dao.sql.OrderBy;
import org.nutz.dao.sql.Pojo;

public class SimpleCriteria extends AbstractPItem implements Criteria, OrderBy, GroupBy {

    private SqlExpressionGroup where;

    private OrderBySet orderBy;
    
    private GroupBySet groupBy;

    private Pager pager;

    public SimpleCriteria() {
        where = new SqlExpressionGroup();
        orderBy = new OrderBySet();
    }

    public void joinSql(Entity<?> en, StringBuilder sb) {
        where.joinSql(en, sb);
        if (groupBy != null)
        	groupBy.joinSql(en, sb);
        orderBy.joinSql(en, sb);
    }

    public void setPojo(Pojo pojo) {
        where.setPojo(pojo);
        orderBy.setPojo(pojo);
        if (groupBy != null)
        	groupBy.setPojo(pojo);
    }

    public void setPager(int pageNumber, int pageSize) {
        pager = new Pager();
        pager.setPageNumber(pageNumber);
        pager.setPageSize(pageSize);
    }

    public void setPager(Pager pager) {
        this.pager = pager;
{'fraction_non_alphanumeric': 0.10923423423423423, 'fraction_numerical': 0.0, 'mean_word_length': 2.959881129271917, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7549338', 'n_tokens_mistral': 917, 'n_tokens_neox': 926, 'n_words': 183}