Search in sources :

Example 1 with AgileGeneratorTable

use of com.jeeagile.generator.entity.AgileGeneratorTable in project jeeagile by jeeagile.

the class AgileGeneratorTableServiceImpl method importTable.

@Override
public boolean importTable(List<String> tableNameList) {
    for (String tableName : tableNameList) {
        AgileGeneratorTable agileGeneratorTable = this.getBaseMapper().selectDbTableByTableName(tableName);
        if (agileGeneratorTable == null || AgileStringUtil.isEmpty(agileGeneratorTable.getTableName())) {
            throw new AgileValidateException("表(" + tableName + ")不存在!");
        }
        AgileGeneratorUtil.initGeneratorTable(agileGeneratorTable);
        this.save(agileGeneratorTable);
        List<AgileGeneratorTableColumn> agileGeneratorTableColumnList = this.getBaseMapper().selectDbTableColumnByTableName(tableName);
        if (agileGeneratorTableColumnList != null && !agileGeneratorTableColumnList.isEmpty()) {
            agileGeneratorTableColumnList.forEach(agileGeneratorTableColumn -> AgileGeneratorUtil.initColumnField(agileGeneratorTable, agileGeneratorTableColumn));
        }
        agileGeneratorTableColumnService.saveBatch(agileGeneratorTableColumnList);
    }
    return true;
}
Also used : AgileGeneratorTable(com.jeeagile.generator.entity.AgileGeneratorTable) AgileValidateException(com.jeeagile.core.exception.AgileValidateException) AgileGeneratorTableColumn(com.jeeagile.generator.entity.AgileGeneratorTableColumn)

Example 2 with AgileGeneratorTable

use of com.jeeagile.generator.entity.AgileGeneratorTable 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;
}
Also used : AgileGeneratorTableInfo(com.jeeagile.generator.vo.AgileGeneratorTableInfo) AgileGeneratorTable(com.jeeagile.generator.entity.AgileGeneratorTable)

Aggregations

AgileGeneratorTable (com.jeeagile.generator.entity.AgileGeneratorTable)2 AgileValidateException (com.jeeagile.core.exception.AgileValidateException)1 AgileGeneratorTableColumn (com.jeeagile.generator.entity.AgileGeneratorTableColumn)1 AgileGeneratorTableInfo (com.jeeagile.generator.vo.AgileGeneratorTableInfo)1