use of com.jeeagile.generator.vo.AgileGeneratorTableInfo in project jeeagile by jeeagile.
the class AgileGeneratorTableServiceImpl method selectTableInfoById.
@Override
public AgileGeneratorTableInfo selectTableInfoById(String agileGeneratorTableId) {
AgileGeneratorTableInfo agileGeneratorTableInfo = new AgileGeneratorTableInfo();
AgileGeneratorTable agileGeneratorTable = this.getById(agileGeneratorTableId);
BeanUtils.copyProperties(agileGeneratorTable, agileGeneratorTableInfo);
if (agileGeneratorTable != null && !AgileStringUtil.isEmpty(agileGeneratorTable.getId())) {
agileGeneratorTableInfo.setAgileGeneratorTableColumnList(agileGeneratorTableColumnService.selectListByTableId(agileGeneratorTableId));
}
return agileGeneratorTableInfo;
}
use of com.jeeagile.generator.vo.AgileGeneratorTableInfo in project jeeagile by jeeagile.
the class AgileGeneratorTableServiceImpl method downloadCode.
@Override
public byte[] downloadCode(List<String> agileGeneratorTableIdList) {
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
for (String agileGeneratorTableId : agileGeneratorTableIdList) {
AgileGeneratorTableInfo agileGeneratorTableInfo = this.selectTableInfoById(agileGeneratorTableId);
if (agileGeneratorTableInfo != null && AgileStringUtil.isNotEmpty(agileGeneratorTableInfo.getId())) {
AgileGeneratorUtil.generatorCode(agileGeneratorTableInfo, zipOutputStream);
}
}
IOUtils.close(zipOutputStream);
return outputStream.toByteArray();
} catch (Exception ex) {
throw new AgileFrameException("代码生成异常!");
}
}
use of com.jeeagile.generator.vo.AgileGeneratorTableInfo in project jeeagile by jeeagile.
the class AgileGeneratorTableServiceImpl method syncTableById.
@Override
public boolean syncTableById(String agileGeneratorTableId) {
AgileGeneratorTableInfo tableInfo = this.selectTableInfoById(agileGeneratorTableId);
if (tableInfo != null) {
List<AgileGeneratorTableColumn> tableColumnList = tableInfo.getAgileGeneratorTableColumnList();
List<String> tableColumnNameList = tableColumnList.stream().map(AgileGeneratorTableColumn::getColumnName).collect(Collectors.toList());
List<AgileGeneratorTableColumn> dbTableColumnList = this.getBaseMapper().selectDbTableColumnByTableName(tableInfo.getTableName());
List<String> dbTableColumnNameList = dbTableColumnList.stream().map(AgileGeneratorTableColumn::getColumnName).collect(Collectors.toList());
for (AgileGeneratorTableColumn agileGeneratorTableColumn : dbTableColumnList) {
if (!tableColumnNameList.contains(agileGeneratorTableColumn.getColumnName())) {
AgileGeneratorUtil.initColumnField(tableInfo, agileGeneratorTableColumn);
agileGeneratorTableColumnService.save(agileGeneratorTableColumn);
}
}
List<String> deleteColumnIdList = tableColumnList.stream().filter(genTableColumn -> !dbTableColumnNameList.contains(genTableColumn.getColumnName())).map(AgileGeneratorTableColumn::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(deleteColumnIdList)) {
agileGeneratorTableColumnService.removeByIds(deleteColumnIdList);
}
} else {
throw new AgileValidateException("表生成信息已不存在无法同步!");
}
return true;
}
Aggregations