use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutDao method countByJoin.
public <T> int countByJoin(Class<T> classOfT, String regex, Condition cnd) {
Pojo pojo = pojoMaker.makeCountByJoin(holder.getEntity(classOfT), regex).append(Pojos.Items.cnd(cnd)).addParamsBy("*").setAfter(_pojo_fetchInt);
expert.formatQuery(pojo);
_exec(pojo);
return pojo.getInt(0);
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutDao method doFetch.
private LinkVisitor doFetch(final EntityOperator opt) {
return new LinkVisitor() {
public void visit(final Object obj, final LinkField lnk) {
Pojo pojo = opt.maker().makeQuery(lnk.getLinkedEntity());
pojo.setOperatingObject(obj);
pojo.append(Pojos.Items.cnd(lnk.createCondition(obj)));
pojo.setAfter(lnk.getCallback());
_exec(pojo);
lnk.setValue(obj, pojo.getObject(Object.class));
}
};
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutDao method query.
public List<Record> query(String tableName, Condition cnd, Pager pager, String fields) {
Pojo pojo = pojoMaker.makeQuery(tableName, fields).addParamsBy(fields).setPager(pager).append(Pojos.Items.cnd(cnd));
expert.formatQuery(pojo);
pojo.setAfter(_pojo_queryRecord);
_exec(pojo);
return pojo.getList(Record.class);
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutDao method clear.
public int clear(Entity<?> entity, Condition cnd) {
Pojo pojo = pojoMaker.makeDelete(entity).append(Pojos.Items.cnd(cnd));
_exec(pojo);
return pojo.getUpdateCount();
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutDao method each.
public <T> int each(Entity<T> entity, Condition cnd, Pager pager, Each<T> callback) {
Pojo pojo = pojoMaker.makeQuery(entity).append(Pojos.Items.cnd(cnd)).addParamsBy("*").setPager(pager).setAfter(_pojo_queryEntity);
expert.formatQuery(pojo);
pojo.setAfter(_pojo_eachEntity);
pojo.getContext().attr(Each.class.getName(), callback);
pojo.getContext().attr("dao-cache-skip", "true");
_exec(pojo);
return pojo.getInt();
}
Aggregations