![JAR search and dependency download from the Maven repository](/logo.png)
com.gitee.beiding.template_excel.DB Maven / Gradle / Ivy
package com.gitee.beiding.template_excel;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
class DB {
//所有字段
private Set cols;
private Map map = new HashMap<>();
DB(Set cols) {
this.cols = cols;
}
private String conditionToKey(Map condition) {
return cols.stream().map((k) -> k + "=" + condition.get(k)).collect(Collectors.joining());
}
//使用and条件查询结果
Object andValue(Map condition) {
String key = conditionToKey(condition);
if (map.containsKey(key)) {
return map.get(key);
}
throw InvalidIndexException.INSTANCE;
}
void putValue(Map condition, Object value) {
map.put(conditionToKey(condition), value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy