Commit 73cb3168 authored by yanzg's avatar yanzg

SQL层级处理的支持

parent ad624ef5
...@@ -1061,10 +1061,28 @@ public class StringHelper { ...@@ -1061,10 +1061,28 @@ public class StringHelper {
* @return 处理后的值对象 * @return 处理后的值对象
*/ */
public static String getCodeString(String from, Object target) { public static String getCodeString(String from, Object target) {
return getCodeStringArray(from, target);
}
/**
* 获取字段替换值
*
* @param from 来源字符串
* @param targets  值对象
* @return 处理后的值对象
*/
public static String getCodeStringArray(String from, Object... targets) {
return getFormat(from, StringHelper.EMPTY, new StringFormatHandle() { return getFormat(from, StringHelper.EMPTY, new StringFormatHandle() {
@Override @Override
public void addPos(StringBuilder sb, String gorup, String fieldFull, String field, String command) { public void addPos(StringBuilder sb, String gorup, String fieldFull, String field, String command) {
String value = StringHelper.getFirst(ObjectHelper.getString(target, field), EMPTY); String value = StringHelper.EMPTY;
for (Object target : targets) {
value = StringHelper.getFirst(ObjectHelper.getString(target, field), EMPTY);
if (!StringHelper.isEmpty(value)) {
break;
}
}
sb.append(value); sb.append(value);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment