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

The following examples show how to use io.jboot.db.model.Columns#likeAppendPercent() . 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: _FinanceController.java    From jpress with GNU Lesser General Public License v3.0 6 votes vote down vote up
@AdminMenu(text = "支付记录", groupId = JPressConsts.SYSTEM_MENU_ORDER, order = 3)
public void paylist() {
    Columns columns = Columns.create();
    columns.likeAppendPercent("trx_no", getPara("ns"));
    columns.likeAppendPercent("product_title", getPara("pt"));
    columns.eq("status", getPara("status"));

    Page<PaymentRecord> page = paymentService.paginate(getPagePara(), 20, columns);
    setAttr("page", page);

    long successCount = paymentService.findCountByColumns(Columns.create("status", PaymentRecord.STATUS_PAY_SUCCESS));
    long prepayCount = paymentService.findCountByColumns(Columns.create("status", PaymentRecord.STATUS_PAY_PRE));
    long failCount = paymentService.findCountByColumns(Columns.create("status", PaymentRecord.STATUS_PAY_FAILURE));

    setAttr("successCount", successCount);
    setAttr("prepayCount", prepayCount);
    setAttr("failCount", failCount);
    setAttr("totalCount", successCount + prepayCount + failCount);

    render("finance/paylist.html");
}
 
Example 2
Source File: DbController.java    From jboot with Apache License 2.0 5 votes vote down vote up
public void find3(){

        User dao = new User();

        Columns columns = Columns.create();
        columns.in("id",1,2,3,4);
        columns.likeAppendPercent("login_name","c");

        List<User> users = dao.findListByColumns(columns);
        renderJson(users);
    }
 
Example 3
Source File: DbController.java    From jboot with Apache License 2.0 5 votes vote down vote up
public void find7(){
        User dao = new User();

        Columns columns = Columns.create();
        columns.in("user.`id`",1,2,3,4);
        columns.likeAppendPercent("login_name","c");


//        List<User> users = dao.leftJoin("article","a","user.id=a.user_id").findListByColumns(columns);
        List<User> users = dao.leftJoin("article").as("a").on("user.id=a.user_id").findListByColumns(columns);
        renderJson(users);
    }
 
Example 4
Source File: DbController.java    From jboot with Apache License 2.0 5 votes vote down vote up
public void safeMode(){
    User dao = new User();

    Columns columns = Columns.safeMode();
    columns.in("user.`id`",1,2,3,4);
    columns.likeAppendPercent("login_name",null);


    List<User> users = dao.leftJoin("article").as("a").on("user.id=a.user_id").findListByColumns(columns);
    renderJson(users);
}
 
Example 5
Source File: WechatReplyServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Page<WechatReply> _paginate(int page, int pageSize, String keyword, String content) {
    Columns columns = new Columns();
    columns.likeAppendPercent("keyword",keyword);
    columns.likeAppendPercent("content",content);
    return DAO.paginateByColumns(page, pageSize, columns, "id desc");
}
 
Example 6
Source File: _UserController.java    From jpress with GNU Lesser General Public License v3.0 5 votes vote down vote up
@AdminMenu(text = "用户管理", groupId = JPressConsts.SYSTEM_MENU_USER, order = 0)
    public void index() {

        Columns columns = Columns.create("status", getPara("status"));
        columns.likeAppendPercent("username", getTrimPara("username"));
//        columns.likeAppendPercent("nickname", getPara("username"));
        columns.likeAppendPercent("email", getTrimPara("email"));
        columns.likeAppendPercent("mobile", getTrimPara("mobile"));
        columns.eq("create_source", getPara("create_source"));


        List<MemberGroup> memberGroups = memberGroupService.findAll();
        setAttr("memberGroups", memberGroups);

        Page<User> page = userService._paginate(getPagePara(), 10, columns, getParaToLong("group_id"), getPara("tag"));

        int lockedCount = userService.findCountByStatus(User.STATUS_LOCK);
        int regCount = userService.findCountByStatus(User.STATUS_REG);
        int okCount = userService.findCountByStatus(User.STATUS_OK);

        setAttr("lockedCount", lockedCount);
        setAttr("regCount", regCount);
        setAttr("okCount", okCount);
        setAttr("totalCount", lockedCount + regCount + okCount);

        setAttr("page", page);

        List<Role> roles = roleService.findAll();
        setAttr("roles", roles);

        render("user/list.html");
    }
 
Example 7
Source File: ArticleServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Page<Article> _paginateByBaseColumns(int page, int pagesize, String title, Long categoryId, Columns baseColumns) {

        Columns columns = baseColumns;
        columns.add("m.category_id", categoryId);
        columns.likeAppendPercent("article.title", title);

        Page<Article> dataPage = DAO.leftJoinIf("article_category_mapping", categoryId != null)
                .as("m")
                .on("article.id = m.article_id")
                .paginateByColumns(page, pagesize, columns, "id desc");


        return joinUserInfo(dataPage);
    }
 
Example 8
Source File: PermissionServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public List<Permission> findListByNode(String node) {
    Columns columns = Columns.create();
    columns.likeAppendPercent("node", node);
    return DAO.findListByColumns(columns);
}