提交 2ba62cd4 编写于 作者: tony001's avatar tony001

add:新增应用中应用实体资源数据逻辑

上级 3281ee10
package cn.ibizlab.codegen.model;
import cn.ibizlab.codegen.utils.Inflector;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
......@@ -32,6 +34,31 @@ public class AppModel extends BaseModel{
});
}
// 初始化应用实体资源数据Map
if(getApplication().getAllPSAppDataEntities()!=null)
{
getApplication().getAllPSAppDataEntities().forEach(appDataEntity ->{
if(appDataEntity.getMinorPSAppDERSs() != null){
appDataEntity.getMinorPSAppDERSs().forEach(appDERS ->{
JSONObject tempObj = new JSONObject();
String majorCodeName = appDERS.getMajorPSAppDataEntity().getCodeName();
String minorCodeName = appDERS.getMinorPSAppDataEntity().getCodeName();
String path = String.format("%1$s/:%2$s?/%3$s/:%4$s?",Inflector.getInstance().pluralize(majorCodeName),majorCodeName,Inflector.getInstance().pluralize(minorCodeName),minorCodeName).toLowerCase();
tempObj.put("majorCodeName",majorCodeName.toLowerCase());
tempObj.put("curCodeName",minorCodeName.toLowerCase());
tempObj.put("path",path);
tempObj.put("appDataEntity",appDataEntity);
appEntityResourceMap.put(String.format("%1$s:%2$s",majorCodeName,minorCodeName),tempObj);
});
}else{
JSONObject tempObj = new JSONObject();
tempObj.put("curCodeName",appDataEntity.getCodeName().toLowerCase());
tempObj.put("path",String.format("%1$s/:%2$s?",Inflector.getInstance().pluralize(appDataEntity.getCodeName()),appDataEntity.getCodeName()).toLowerCase());
tempObj.put("appDataEntity",appDataEntity);
appEntityResourceMap.put(appDataEntity.getCodeName(),tempObj);
}
});
}
}
......@@ -42,7 +69,7 @@ public class AppModel extends BaseModel{
return (IPSApplication)opt;
}
private Map<String,AppEntityModel> appEntitiesMap=new LinkedHashMap<>();;
private Map<String,AppEntityModel> appEntitiesMap=new LinkedHashMap<>();
private Map<String,PageModel> pagesMap=new LinkedHashMap<>();
......@@ -77,4 +104,19 @@ public class AppModel extends BaseModel{
return null;
}
/**
* 应用实体资源数据Map
*/
private Map<String, JSONObject> appEntityResourceMap =new LinkedHashMap<>();
/**
* 获取应用实体资源数据
* @return
*/
public Collection<JSONObject> getAppEntityResources(){
if(appEntityResourceMap!=null)
return appEntityResourceMap.values();
return new ArrayList<>();
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册