mirror of
https://github.com/getrebuild/rebuild.git
synced 2025-09-28 09:36:37 +08:00
be
This commit is contained in:
parent
dd2af25814
commit
43fda5d144
3 changed files with 18 additions and 15 deletions
2
@rbv
2
@rbv
|
@ -1 +1 @@
|
|||
Subproject commit c7521f5df907ed9500d65dd8487b6517cfd7b21d
|
||||
Subproject commit 15c50e7aa0c494e9fa3a9dbf34b2be03ecdc72c9
|
|
@ -21,9 +21,12 @@ import com.rebuild.core.metadata.MetadataHelper;
|
|||
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -75,7 +78,7 @@ public class TransformManager implements ConfigManager {
|
|||
|
||||
JSONObject item = EasyMetaFactory.toJSON(targetEntity);
|
||||
item.put("transid", cb.getID("id"));
|
||||
item.put("transName", cb.getString("name")); // v3.6 重启用
|
||||
item.put("transName", cb.getString("name"));
|
||||
item.put("previewMode", config.getIntValue("transformMode") == 2);
|
||||
data.add(item);
|
||||
}
|
||||
|
@ -104,9 +107,7 @@ public class TransformManager implements ConfigManager {
|
|||
public List<ConfigBean> getRawTransforms(String sourceEntity) {
|
||||
final String cKey = "TransformManager31-" + sourceEntity;
|
||||
Object cached = Application.getCommonsCache().getx(cKey);
|
||||
if (cached != null) {
|
||||
return (List<ConfigBean>) cached;
|
||||
}
|
||||
if (cached != null) return (List<ConfigBean>) cached;
|
||||
|
||||
Object[][] array = Application.createQueryNoFilter(
|
||||
"select belongEntity,targetEntity,configId,config,isDisabled,name from TransformConfig where belongEntity = ?")
|
||||
|
@ -131,6 +132,7 @@ public class TransformManager implements ConfigManager {
|
|||
entries.add(entry);
|
||||
}
|
||||
|
||||
sortByName(entries);
|
||||
Application.getCommonsCache().putx(cKey, entries);
|
||||
return entries;
|
||||
}
|
||||
|
@ -184,10 +186,21 @@ public class TransformManager implements ConfigManager {
|
|||
}
|
||||
}
|
||||
|
||||
sortByName(imports);
|
||||
WEAK_CACHED.put(targetEntity, imports);
|
||||
return imports;
|
||||
}
|
||||
|
||||
// v3.6 排序
|
||||
private void sortByName(List<ConfigBean> list) {
|
||||
if (list == null || list.isEmpty()) return;
|
||||
|
||||
Comparator<Object> comparator = Collator.getInstance(Locale.CHINESE);
|
||||
list.sort((o1, o2) -> comparator.compare(
|
||||
org.apache.commons.lang3.ObjectUtils.defaultIfNull(o1.getString("name"), ""),
|
||||
org.apache.commons.lang3.ObjectUtils.defaultIfNull(o2.getString("name"), "")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clean(Object cfgid) {
|
||||
final String cKey = "TransformManager31-" + getBelongEntity((ID) cfgid);
|
||||
|
|
|
@ -33,7 +33,6 @@ import com.rebuild.web.EntityController;
|
|||
import com.rebuild.web.IdParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -43,12 +42,9 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -156,12 +152,6 @@ public class GeneralModelController extends EntityController {
|
|||
if (modelEntity.getDetailEntity() != null) {
|
||||
List<ConfigBean> imports = TransformManager.instance.getDetailImports(modelEntity.getDetailEntity().getName());
|
||||
if (!imports.isEmpty()) {
|
||||
// v3.6 排序
|
||||
Comparator<Object> comparator = Collator.getInstance(Locale.CHINESE);
|
||||
imports.sort((o1, o2) -> comparator.compare(
|
||||
ObjectUtils.defaultIfNull(o1.getString("name"), ""),
|
||||
ObjectUtils.defaultIfNull(o2.getString("name"), "")));
|
||||
|
||||
List<Object> detailImports = new ArrayList<>();
|
||||
for (ConfigBean cb : imports) {
|
||||
JSONObject trans = (JSONObject) EasyMetaFactory.valueOf(cb.getString("source")).toJSON();
|
||||
|
|
Loading…
Add table
Reference in a new issue