本文整理匯總了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;
}
示例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;
}