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


Java ARMConfigurationInt.getRatingNeutral方法代码示例

本文整理汇总了Java中org.easyrec.plugin.arm.model.ARMConfigurationInt.getRatingNeutral方法的典型用法代码示例。如果您正苦于以下问题:Java ARMConfigurationInt.getRatingNeutral方法的具体用法?Java ARMConfigurationInt.getRatingNeutral怎么用?Java ARMConfigurationInt.getRatingNeutral使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.easyrec.plugin.arm.model.ARMConfigurationInt的用法示例。


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

示例1: defineL1

import org.easyrec.plugin.arm.model.ARMConfigurationInt; //导入方法依赖的package包/类
@Override
public TObjectIntHashMap<ItemVO<Integer, Integer>> defineL1(ARMConfigurationInt configuration, int offset, int batchSize) {
    ActionResultSetExtractor rse = new ActionResultSetExtractor();

    List<Object> args = Lists.newArrayList();
    List<Integer> argt = Lists.newArrayList();

    StringBuilder query = new StringBuilder("SELECT ");
    query.append(BaseActionDAO.DEFAULT_ITEM_COLUMN_NAME).append(", ");
    query.append(BaseActionDAO.DEFAULT_ITEM_TYPE_COLUMN_NAME).append(", ");
    query.append(BaseActionDAO.DEFAULT_TENANT_COLUMN_NAME).append(", ");
    query.append("count(*) as cnt FROM ");
    query.append(BaseActionDAO.DEFAULT_TABLE_NAME);
    query.append(" WHERE ").append(BaseActionDAO.DEFAULT_TENANT_COLUMN_NAME).append("=")
            .append(configuration.getTenantId());
    query.append(" AND ").append(BaseActionDAO.DEFAULT_ACTION_TYPE_COLUMN_NAME).append("=")
            .append(configuration.getActionType());

    if (configuration.getRatingNeutral() != null) {
        query.append(" AND ").append(BaseActionDAO.DEFAULT_RATING_VALUE_COLUMN_NAME).append(">")
                .append(configuration.getRatingNeutral());
    }
    
    if (!configuration.getItemTypes().isEmpty()) {
    query.append(" AND ").append(BaseActionDAO.DEFAULT_ITEM_TYPE_COLUMN_NAME).append(" IN (");

        for (int i = 0; i < configuration.getItemTypes().size(); i++) {
            query.append("?");
            args.add(configuration.getItemTypes().get(i));
            argt.add(Types.INTEGER);
            if (i < configuration.getItemTypes().size() - 1) {
                query.append(",");
            } else {
                query.append(")");
            }
        }
    }
    query.append(" GROUP BY ").append(BaseActionDAO.DEFAULT_ITEM_COLUMN_NAME).append(",").append(BaseActionDAO.DEFAULT_ITEM_TYPE_COLUMN_NAME)
            .append(" HAVING cnt >= ? ORDER BY cnt DESC");

    args.add(configuration.getSupport());
    argt.add(Types.INTEGER);

    query.append(" LIMIT ?,?");

    args.add(offset);
    argt.add(Types.INTEGER);

    args.add(Math.min(offset+batchSize, configuration.getMaxSizeL1()));
    argt.add(Types.INTEGER);
    
    TObjectIntHashMap<ItemVO<Integer, Integer>> ret = getJdbcTemplate()
            .query(query.toString(),  args.toArray(), Ints.toArray(argt), rse);

    return ret;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:57,代码来源:RuleminingActionDAOMysqlImpl.java

示例2: defineL1

import org.easyrec.plugin.arm.model.ARMConfigurationInt; //导入方法依赖的package包/类
public TObjectIntHashMap<ItemVO<Integer, Integer>> defineL1(ARMConfigurationInt configuration) {
    ActionResultSetExtractor rse = new ActionResultSetExtractor();

    List<Object> args = Lists.newArrayList();
    List<Integer> argt = Lists.newArrayList();

    StringBuilder query = new StringBuilder("SELECT ");
    query.append(BaseActionDAO.DEFAULT_ITEM_COLUMN_NAME).append(", ");
    query.append(BaseActionDAO.DEFAULT_ITEM_TYPE_COLUMN_NAME).append(", ");
    query.append(BaseActionDAO.DEFAULT_TENANT_COLUMN_NAME).append(", ");
    query.append("count(*) as cnt FROM ");
    query.append(BaseActionDAO.DEFAULT_TABLE_NAME);
    query.append(" WHERE ").append(BaseActionDAO.DEFAULT_TENANT_COLUMN_NAME).append("=")
            .append(configuration.getTenantId());
    query.append(" AND ").append(BaseActionDAO.DEFAULT_ACTION_TYPE_COLUMN_NAME).append("=")
            .append(configuration.getActionType());

    if (configuration.getRatingNeutral() != null) {
        query.append(" AND ").append(BaseActionDAO.DEFAULT_RATING_VALUE_COLUMN_NAME).append(">")
                .append(configuration.getRatingNeutral());
    }
    
    if (!configuration.getItemTypes().isEmpty()) {
    query.append(" AND ").append(BaseActionDAO.DEFAULT_ITEM_TYPE_COLUMN_NAME).append(" IN (");

        for (int i = 0; i < configuration.getItemTypes().size(); i++) {
            query.append("?");
            args.add(configuration.getItemTypes().get(i));
            argt.add(Types.INTEGER);
            if (i < configuration.getItemTypes().size() - 1) {
                query.append(",");
            } else {
                query.append(")");
            }
        }
    }
    query.append(" GROUP BY ").append(BaseActionDAO.DEFAULT_ITEM_COLUMN_NAME).append(",").append(BaseActionDAO.DEFAULT_ITEM_TYPE_COLUMN_NAME)
            .append(" HAVING cnt >= ? ORDER BY cnt DESC");

    args.add(configuration.getSupport());
    argt.add(Types.INTEGER);

    query.append(" LIMIT ?");

    args.add(configuration.getMaxSizeL1());
    argt.add(Types.INTEGER);
    
    TObjectIntHashMap<ItemVO<Integer, Integer>> ret = getJdbcTemplate()
            .query(query.toString(),  args.toArray(), Ints.toArray(argt), rse);

    //if (ret.size() == configuration.getMaxSizeL1()) configuration.setSupport(rse.getMinSupp());

    return ret;
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:55,代码来源:RuleminingActionDAOMysqlImpl.java


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