当前位置: 首页>>代码示例>>Java>>正文


Java TableImpl类代码示例

本文整理汇总了Java中org.jooq.impl.TableImpl的典型用法代码示例。如果您正苦于以下问题:Java TableImpl类的具体用法?Java TableImpl怎么用?Java TableImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TableImpl类属于org.jooq.impl包,在下文中一共展示了TableImpl类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCountStats

import org.jooq.impl.TableImpl; //导入依赖的package包/类
private <T extends CountStats> T getCountStats(final TableImpl table,
                                             final TableField<? extends Record, Timestamp> createdField,
                                             final T countStats) {
    final Field<Integer> totalField = DSL.selectCount().from(table).asField();
    final Field<Integer> last7daysField =
            DSL.selectCount()
               .from(table)
               .where(createdField.ge(DSL.currentTimestamp().minus(7)))
               .asField();
    final Field<Integer> last30daysField =
            DSL.selectCount()
               .from(table)
               .where(createdField.ge(DSL.currentTimestamp().minus(30)))
               .asField();

    return jooq.select(totalField, last7daysField, last30daysField)
               .fetchOne()
               .map(r -> {
                   countStats.setTotal(r.getValue(totalField));
                   countStats.setLast7days(r.getValue(last7daysField));
                   countStats.setLast30days(r.getValue(last30daysField));
                   return countStats;
               });
}
 
开发者ID:kTT,项目名称:adjule,代码行数:25,代码来源:JooqStatsDao.java

示例2: personCmd

import org.jooq.impl.TableImpl; //导入依赖的package包/类
int personCmd(String[] args) throws IllegalArgumentException {
    CmdType type = checkCmd(args);
    String[] field_name = new String[1];
    int[] ids = new int[1];
    TableImpl<PersonsRecord> table = Persons.PERSONS;
    TableField<PersonsRecord, Integer>[] pkey = new TableField[1];
    pkey[0] = Persons.PERSONS.PERSON_ID;

    Object[] out_args = prepareArgs(table.fields().length, type, args, ids, field_name, true);
    if (out_args != null) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        java.util.Date parsed;
        try {
            parsed = format.parse(out_args[3].toString());
        } catch (ParseException e) {
            parsed = new java.util.Date();
        }
        out_args[3] = new java.sql.Date(parsed.getTime());

        PassportRecord passport = new PassportRecord();
        passport.setSerialNumber(Integer.parseInt(out_args[8].toString()));
        passport.setId(Integer.parseInt(out_args[9].toString()));
        out_args[8] = null; // photo
        out_args[9] = passport;
    }

    // person add 123 123 123 2016-01-01 M adsads asdasd adasd 5716 478596 1
    // person update 9 123 123 123 2016-01-01 M adsads asdasd adasd 5718 478596 1
    // person delete 36

    return doCommand(table, pkey, type, ids, field_name[0], out_args, true);

}
 
开发者ID:chebykinn,项目名称:university,代码行数:34,代码来源:Store.java

示例3: generalCmd

import org.jooq.impl.TableImpl; //导入依赖的package包/类
<R extends UpdatableRecord, F extends TableField<R, Integer>>
int generalCmd(TableImpl<R> table, F[] pkey, boolean skipId, String[] args) {
    CmdType type = checkCmd(args);
    String[] field_name = new String[1];
    int[] ids = new int[pkey.length];

    Object[] out_args = prepareArgs(table.fields().length, type, args, ids, field_name, skipId);

    return doCommand(table, pkey, type, ids, field_name[0], out_args, skipId);
}
 
开发者ID:chebykinn,项目名称:university,代码行数:11,代码来源:Store.java

示例4: resetSequence

import org.jooq.impl.TableImpl; //导入依赖的package包/类
public static void resetSequence(final DSLContext jooq,
                                 final Sequence<Long> sequence,
                                 final TableImpl table) {
    jooq.alterSequence(sequence)
        .restartWith(jooq.selectCount().from(table).fetchOne(0, long.class) + 1)
        .execute();
}
 
开发者ID:kTT,项目名称:adjule,代码行数:8,代码来源:TestUtils.java

示例5: sellLogCmd

import org.jooq.impl.TableImpl; //导入依赖的package包/类
int sellLogCmd(String[] args) {
    CmdType type = checkCmd(args);
    String[] field_name = new String[1];
    int[] ids = new int[1];
    TableImpl<SellLogRecord> table = SellLog.SELL_LOG;
    TableField<SellLogRecord, Integer>[] pkey = new TableField[1];
    pkey[0] = SellLog.SELL_LOG.LOG_ID;

    Object[] out_args = prepareArgs(table.fields().length, type, args, ids, field_name, true);

    // sell_log add 9 1 100
    if (out_args != null) {
        out_args[0] = Integer.parseInt(out_args[0].toString());
        out_args[1] = Integer.parseInt(out_args[1].toString());
        out_args[2] = Integer.parseInt(out_args[2].toString());
        if (out_args[3] != null) {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            java.util.Date parsed;
            try {
                parsed = format.parse(out_args[3].toString());
            } catch (ParseException e) {
                parsed = new java.util.Date();
            }
            out_args[3] = new java.sql.Date(parsed.getTime());
        } else {
            out_args[3] = new java.sql.Date(Calendar.getInstance().getTimeInMillis());
        }

        if (type == CmdType.ADD) {
            AddSellLog add = new AddSellLog();
            add.setPId((int) out_args[0]);
            add.setShId((int) out_args[1]);
            add.setInAmount((int) out_args[2]);
            add.setDate((java.sql.Date) out_args[3]);
            return add.execute(ctx.configuration());
        } else {
            UpdateSellLog upd = new UpdateSellLog();
            upd.setPId((int) out_args[0]);
            upd.setShId((int) out_args[1]);
            upd.setInAmount((int) out_args[2]);
            upd.setInDate((Date) out_args[3]);
            return upd.execute(ctx.configuration());
        }
    }
    return doCommand(table, pkey, type, ids, field_name[0], out_args, true);
}
 
开发者ID:chebykinn,项目名称:university,代码行数:47,代码来源:Store.java


注:本文中的org.jooq.impl.TableImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。