本文整理汇总了Java中org.nutz.dao.Condition类的典型用法代码示例。如果您正苦于以下问题:Java Condition类的具体用法?Java Condition怎么用?Java Condition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Condition类属于org.nutz.dao包,在下文中一共展示了Condition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetchLinks
import org.nutz.dao.Condition; //导入依赖的package包/类
public <T> T fetchLinks(final T obj, final String regex, final Condition cnd) {
if (null == obj)
return null;
Lang.each(obj, false, new Each<Object>() {
public void invoke(int index, Object ele, int length) throws ExitLoop, ContinueLoop,
LoopException {
EntityOperator opt = _optBy(ele);
if (null == opt)
return;
opt.entity.visitMany(ele, regex, doLinkQuery(opt, cnd));
opt.entity.visitManyMany(ele, regex, doLinkQuery(opt, cnd));
opt.entity.visitOne(ele, regex, doFetch(opt));
opt.exec();
}
});
return obj;
}
示例2: _count
import org.nutz.dao.Condition; //导入依赖的package包/类
private int _count(Entity<?> en, String tableName, Condition cnd) {
// 如果有条件的话
if (null != cnd) {
Pojo pojo = pojoMaker.makeFunc(tableName, "COUNT", "*");
pojo.setEntity(en);
// 高级条件接口,直接得到 WHERE 子句
if (cnd instanceof Criteria) {
pojo.append(((Criteria) cnd).where());
}
// 否则暴力获取 WHERE 子句
else {
String str = Pojos.formatCondition(en, cnd);
if (!Strings.isBlank(str)) {
String[] ss = str.toUpperCase().split("ORDER BY");
pojo.append(Pojos.Items.wrap(str.substring(0, ss[0].length())));
}
}
// 设置回调,并执行 SQL
pojo.setAfter(_pojo_fetchInt);
_exec(pojo);
return pojo.getInt();
}
// 没有条件,直接生成表达式
return func(tableName, "COUNT", "*");
}
示例3: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Os> queryCache(Condition c,Page p)
{
List<Os> list_os = null;
String cacheKey = "os_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_os = this.query(c, p);
cache.put(new Element(cacheKey, list_os));
}else{
list_os = (List<Os>)cache.get(cacheKey).getObjectValue();
}
return list_os;
}
示例4: listCount
import org.nutz.dao.Condition; //导入依赖的package包/类
public int listCount(Condition c)
{
Long num = 0L;
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(CACHE_COUNT_KEY) == null)
{
num = Long.valueOf(this.count(c));
cache.put(new Element(CACHE_COUNT_KEY, num));
}else{
num = (Long)cache.get(CACHE_COUNT_KEY).getObjectValue();
}
return num.intValue();
}
示例5: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Productlevel> queryCache(Condition c,Page p)
{
List<Productlevel> list_productlevel = null;
String cacheKey = "productlevel_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_productlevel = this.query(c, p);
cache.put(new Element(cacheKey, list_productlevel));
}else{
list_productlevel = (List<Productlevel>)cache.get(cacheKey).getObjectValue();
}
return list_productlevel;
}
示例6: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Language> queryCache(Condition c,Page p)
{
List<Language> list_language = null;
String cacheKey = "language_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_language = this.query(c, p);
cache.put(new Element(cacheKey, list_language));
}else{
list_language = (List<Language>)cache.get(cacheKey).getObjectValue();
}
return list_language;
}
示例7: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Productgroup> queryCache(Condition c,Page p)
{
List<Productgroup> list_productgroup = null;
String cacheKey = "productgroup_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_productgroup = this.query(c, p);
cache.put(new Element(cacheKey, list_productgroup));
}else{
list_productgroup = (List<Productgroup>)cache.get(cacheKey).getObjectValue();
}
return list_productgroup;
}
示例8: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Target> queryCache(Condition c,Page p)
{
List<Target> list_target = null;
String cacheKey = "target_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_target = this.query(c, p);
cache.put(new Element(cacheKey, list_target));
}else{
list_target = (List<Target>)cache.get(cacheKey).getObjectValue();
}
return list_target;
}
示例9: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Aporialevel> queryCache(Condition c,Page p)
{
List<Aporialevel> list_aporialevel = null;
String cacheKey = "aporialevel_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_aporialevel = this.query(c, p);
cache.put(new Element(cacheKey, list_aporialevel));
}else{
list_aporialevel = (List<Aporialevel>)cache.get(cacheKey).getObjectValue();
}
return list_aporialevel;
}
示例10: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Code> queryCache(Condition c,Page p)
{
List<Code> list_code = null;
String cacheKey = "code_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_code = this.query(c, p);
cache.put(new Element(cacheKey, list_code));
}else{
list_code = (List<Code>)cache.get(cacheKey).getObjectValue();
}
return list_code;
}
示例11: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Studio> queryCache(Condition c,Page p)
{
List<Studio> list_studio = null;
String cacheKey = "studio_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_studio = this.query(c, p);
cache.put(new Element(cacheKey, list_studio));
}else{
list_studio = (List<Studio>)cache.get(cacheKey).getObjectValue();
}
return list_studio;
}
示例12: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Technicalpoint> queryCache(Condition c,Page p)
{
List<Technicalpoint> list_technicalpoint = null;
String cacheKey = "technicalpoint_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_technicalpoint = this.query(c, p);
cache.put(new Element(cacheKey, list_technicalpoint));
}else{
list_technicalpoint = (List<Technicalpoint>)cache.get(cacheKey).getObjectValue();
}
return list_technicalpoint;
}
示例13: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Product> queryCache(Condition c,Page p)
{
List<Product> list_product = null;
String cacheKey = "product_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_product = this.query(c, p);
cache.put(new Element(cacheKey, list_product));
}else{
list_product = (List<Product>)cache.get(cacheKey).getObjectValue();
}
return list_product;
}
示例14: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Aporia> queryCache(Condition c,Page p)
{
List<Aporia> list_aporia = null;
String cacheKey = "aporia_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_aporia = this.query(c, p);
cache.put(new Element(cacheKey, list_aporia));
}else{
list_aporia = (List<Aporia>)cache.get(cacheKey).getObjectValue();
}
return list_aporia;
}
示例15: queryCache
import org.nutz.dao.Condition; //导入依赖的package包/类
public List<Img> queryCache(Condition c,Page p)
{
List<Img> list_img = null;
String cacheKey = "img_list_" + p.getPageCurrent();
Cache cache = CacheManager.getInstance().getCache(CACHE_NAME);
if(cache.get(cacheKey) == null)
{
list_img = this.query(c, p);
cache.put(new Element(cacheKey, list_img));
}else{
list_img = (List<Img>)cache.get(cacheKey).getObjectValue();
}
return list_img;
}