//从前台获取:subTabParamIn,并设置外键字段
try{
//step.3 填充主表的所有智能表单配置
String mainTable = codeParamEntityIn.getTableName();
//主表的智能表单配置
GenerateEntity mainG = new GenerateEntity();
mainG.setProjectPath(subTableListEntity.getProjectPath());
CgFormHeadEntity mCgFormHead = cgFormFieldService.getCgFormHeadByTableName(mainTable);
getCgformConfig(mCgFormHead, mainG);
//step.4 填充子表的所有智能表单配置
Map<String,GenerateEntity> subsG = new HashMap<String,GenerateEntity>();
List<SubTableEntity> subTabParamIn = subTableListEntity.getSubTabParamIn();
for(SubTableEntity po:subTabParamIn){
String sTableName = po.getTableName();
CgFormHeadEntity cgSubHead = cgFormFieldService.getCgFormHeadByTableName(sTableName);
List<CgFormFieldEntity> colums = cgSubHead.getColumns();
String[] foreignKeys =getForeignkeys(colums);
po.setForeignKeys(foreignKeys);
GenerateEntity subG = new GenerateEntity();
getCgformConfig(cgSubHead, subG);
subG.setEntityName(po.getEntityName());
subG.setEntityPackage(po.getEntityPackage());
subG.setFieldRowNum(1);
subG.setFtlDescription(po.getFtlDescription());
subG.setForeignKeys(foreignKeys);
subG.setTableName(po.getTableName());
subG.setProjectPath(subTableListEntity.getProjectPath());
subsG.put(sTableName, subG);
}
codeParamEntityIn.setSubTabParam(subTabParamIn);
//step.5 一对多(父子表)数据模型,代码生成
CgformCodeGenerateOneToMany.oneToManyCreate(subTabParamIn, codeParamEntityIn,mainG,subsG);