Java Code Examples for com.jfinal.plugin.activerecord.Db#queryInt()

The following examples show how to use com.jfinal.plugin.activerecord.Db#queryInt() . 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: WebSite.java    From zrlog with Apache License 2.0 5 votes vote down vote up
public boolean updateByKV(String name, Object value) {
    if (Db.queryInt("select siteId from " + TABLE_NAME + " where name=?", name) != null) {
        Db.update("update " + TABLE_NAME + " set value=? where name=?", value, name);
    } else {
        Db.update("insert " + TABLE_NAME + "(`value`,`name`) value(?,?)", value, name);
    }
    return true;
}
 
Example 2
Source File: UserOrderServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public int queryTotayCount() {
    return Db.queryInt("select count(*) from user_order where created > ?", DateUtils.truncate(new Date(), Calendar.DATE));
}
 
Example 3
Source File: UserOrderServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public int queryMonthCount() {
    return Db.queryInt("select count(*) from user_order where created > ?", DateUtils.truncate(new Date(), Calendar.MONTH));
}
 
Example 4
Source File: UserOrderServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public int queryMonthUserCount() {
    String sql = "select count(distinct buyer_id) from user_order where created > ?";
    return Db.queryInt(sql, DateUtils.truncate(new Date(), Calendar.MONTH));
}
 
Example 5
Source File: PaymentRecordServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public int queryMonthAmount() {
    return Db.queryInt("select coalesce(sum(pay_success_amount),0) from payment_record where created > ? and pay_status >= ?",
            DateUtils.truncate(new Date(), Calendar.MONTH), PayStatus.SUCCESS_ALIPAY.getStatus());
}
 
Example 6
Source File: UserServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public int findCountByStatus(String status) {
    return Db.queryInt("select count(*) from user where status = ?", status);
}
 
Example 7
Source File: SinglePageServiceProvider.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public int findCountByStatus(String status) {
    return Db.queryInt("select count(*) from single_page where status = ?", status);
}