use of com.baidu.unbiz.common.genericdao.operator.Modify in project disconf by knightliao.
the class ConfigDaoImpl method updateValue.
/**
*
*/
@Override
public void updateValue(Long configId, String value) {
// 时间
String curTime = DateUtils.format(new Date(), DataFormatConstants.COMMON_TIME_FORMAT);
List<Modify> modifyList = new ArrayList<Modify>();
modifyList.add(modify(Columns.VALUE, value));
modifyList.add(modify(Columns.UPDATE_TIME, curTime));
update(modifyList, match(Columns.CONFIG_ID, configId));
}
use of com.baidu.unbiz.common.genericdao.operator.Modify in project disconf by knightliao.
the class QueryGenerator method appendModifytoSQL.
/**
* @param modifies
* @param sb
* @param params
*/
private void appendModifytoSQL(List<Modify> modifies, StringBuilder sb, List<Object> params) {
for (Modify modify : modifies) {
sb.append(modify.getColumn());
Object value = modify.getValue();
if (value instanceof IncrParam) {
sb.append("=(").append(modify.getColumn()).append("+?),");
params.add(((IncrParam) value).getValue());
} else if (value instanceof ExpressionParam) {
sb.append(',');
} else {
sb.append("=?,");
params.add(value);
}
}
}
use of com.baidu.unbiz.common.genericdao.operator.Modify in project disconf by knightliao.
the class QueryGenerator method getUpdateQuery.
public List<Query> getUpdateQuery(List<ENTITY> entities) {
List<Query> queries = new ArrayList<Query>(entities.size());
Set<String> modifiableColumns = orMapping.getModifiableColumns();
for (ENTITY entity : entities) {
List<Match> matches = getKeyMatches(entity.getId());
List<Modify> modifies = new ArrayList<Modify>(modifiableColumns.size());
for (String column : modifiableColumns) {
Object value = getColumnValue(column, entity);
modifies.add(new Modify(column, value));
}
queries.add(getUpdateQuery(modifies, matches));
}
return queries;
}
use of com.baidu.unbiz.common.genericdao.operator.Modify in project disconf by knightliao.
the class ConfigDaoImpl method deleteItem.
/**
* @param configId
*/
@Override
public void deleteItem(Long configId) {
String curTime = DateUtils.format(new Date(), DataFormatConstants.COMMON_TIME_FORMAT);
List<Modify> modifyList = new ArrayList<Modify>();
modifyList.add(modify(Columns.STATUS, Constants.STATUS_DELETE));
modifyList.add(modify(Columns.UPDATE_TIME, curTime));
update(modifyList, match(Columns.CONFIG_ID, configId));
}
Aggregations