Java Code Examples for io.jboot.db.model.Columns#isNotNull()

The following examples show how to use io.jboot.db.model.Columns#isNotNull() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArticleApiController.java    From jpress with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 通过 文章属性 获得文章列表
 */
public void list() {
    String flag = getPara("flag");
    Boolean hasThumbnail = getParaToBoolean("hasThumbnail");
    String orderBy = getPara("orderBy", "id desc");
    int count = getParaToInt("count", 10);


    Columns columns = Columns.create("flag", flag);
    if (hasThumbnail != null) {
        if (hasThumbnail) {
            columns.isNotNull("thumbnail");
        } else {
            columns.isNull("thumbnail");
        }
    }

    List<Article> articles = articleService.findListByColumns(columns, orderBy, count);
    renderJson(Ret.ok("articles", articles));
}
 
Example 2
Source File: ProductApiController.java    From jpress with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 获取产品列表
 */
public void list(){
    String flag = getPara("flag");
    Boolean hasThumbnail = getParaToBoolean("hasThumbnail");
    String orderBy = getPara("orderBy", "id desc");
    int count = getParaToInt("count", 10);


    Columns columns = Columns.create("flag", flag);
    if (hasThumbnail != null) {
        if (hasThumbnail) {
            columns.isNotNull("thumbnail");
        } else {
            columns.isNull("thumbnail");
        }
    }

    List<Product> products = productService.findListByColumns(columns, orderBy, count);
    renderOkJson("products", products);
}
 
Example 3
Source File: ArticlesDirective.java    From jpress with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onRender(Env env, Scope scope, Writer writer) {

    String flag = getPara("flag", scope);
    String style = getPara("style", scope);
    Boolean hasThumbnail = getParaToBool("hasThumbnail", scope);
    String orderBy = getPara("orderBy", scope, "id desc");
    int count = getParaToInt("count", scope, 10);


    Columns columns = Columns.create();

    columns.add("flag", flag);
    columns.add("style", style);
    columns.add("status", Article.STATUS_NORMAL);

    if (hasThumbnail != null) {
        if (hasThumbnail) {
            columns.isNotNull("thumbnail");
        } else {
            columns.isNull("thumbnail");
        }
    }

    List<Article> articles = service.findListByColumns(columns, orderBy, count);

    if (articles == null || articles.isEmpty()) {
        return;
    }

    scope.setLocal("articles", articles);
    renderBody(env, scope, writer);
}
 
Example 4
Source File: ProductsDirective.java    From jpress with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onRender(Env env, Scope scope, Writer writer) {

    String flag = getPara("flag", scope);
    String style = getPara("style", scope);
    Boolean hasThumbnail = getParaToBool("hasThumbnail", scope);
    String orderBy = getPara("orderBy", scope, "id desc");
    int count = getParaToInt("count", scope, 10);


    Columns columns = Columns.create("flag", flag);
    columns.add("style", style);

    columns.add("status", Product.STATUS_NORMAL);

    if (hasThumbnail != null) {
        if (hasThumbnail) {
            columns.isNotNull("thumbnail");
        } else {
            columns.isNull("thumbnail");
        }
    }

    List<Product> products = service.findListByColumns(columns, orderBy, count);

    if (products == null || products.isEmpty()) {
        return;
    }

    scope.setLocal("products", products);
    renderBody(env, scope, writer);
}