Search in sources :

Example 6 with TableDo

use of com.albedo.java.modules.gen.domain.TableDo in project albedo by somowhere.

the class TableServiceImpl method saveOrUpdate.

@Override
public void saveOrUpdate(TableDto tableDto) {
    TableDo tableDo = new TableDo();
    copyDtoToBean(tableDto, tableDo);
    super.saveOrUpdate(tableDo);
    logger.debug("Save Information for Table: {}", tableDo);
    for (TableColumnDo item : tableDo.getColumnFormList()) {
        item.setTableId(tableDo.getId());
    }
    List<TableColumnDo> tableColumnDoEntities = tableColumnService.list(Wrappers.<TableColumnDo>query().eq(TableColumnDo.F_SQL_GENTABLEID, tableDo.getId()));
    for (TableColumnDo item : tableDo.getColumnFormList()) {
        for (TableColumnDo tableColumnDo : tableColumnDoEntities) {
            if (tableColumnDo.getId().equals(item.getId())) {
                item.setVersion(tableColumnDo.getVersion());
                break;
            }
        }
    }
    tableColumnService.saveOrUpdateBatch(tableDo.getColumnFormList());
}
Also used : TableDo(com.albedo.java.modules.gen.domain.TableDo) TableColumnDo(com.albedo.java.modules.gen.domain.TableColumnDo)

Example 7 with TableDo

use of com.albedo.java.modules.gen.domain.TableDo in project albedo by somowhere.

the class SchemeServiceImpl method findFormData.

@Override
@Transactional(readOnly = true)
public SchemeFormDataVo findFormData(SchemeDto schemeDto, String loginId) {
    SchemeFormDataVo schemeFormDataVo = new SchemeFormDataVo();
    ArgumentAssert.notNull(schemeDto, "生成方案不能为空");
    if (StringUtil.isNotEmpty(schemeDto.getId())) {
        schemeDto = super.getOneDto(schemeDto.getId());
    }
    if (StringUtil.isBlank(schemeDto.getPackageName())) {
        schemeDto.setPackageName("com.albedo.java.modules");
    }
    if (StringUtil.isBlank(schemeDto.getFunctionAuthor())) {
        schemeDto.setFunctionAuthor(loginId);
    }
    schemeFormDataVo.setSchemeVo(schemeDto);
    GenConfig config = GenUtil.getConfig();
    schemeFormDataVo.setConfig(config);
    schemeFormDataVo.setCategoryList(CollUtil.convertSelectVoList(config.getCategoryList(), DictDo.F_VAL, DictDo.F_NAME));
    schemeFormDataVo.setViewTypeList(CollUtil.convertSelectVoList(config.getViewTypeList(), DictDo.F_VAL, DictDo.F_NAME));
    List<TableDo> tableDoList = tableService.list(), list = Lists.newArrayList();
    List<String> tableIds = Lists.newArrayList();
    if (StringUtil.isNotEmpty(schemeDto.getId())) {
        List<SchemeDo> schemeDoList = findAllListIdNot(schemeDto.getId());
        tableIds = CollUtil.extractToList(schemeDoList, "tableId");
    }
    for (TableDo tableDo : tableDoList) {
        if (!tableIds.contains(tableDo.getId())) {
            list.add(tableDo);
        }
    }
    schemeFormDataVo.setTableList(CollUtil.convertSelectVoList(list, TableDo.F_ID, TableDo.F_NAMESANDTITLE));
    return schemeFormDataVo;
}
Also used : TableDo(com.albedo.java.modules.gen.domain.TableDo) GenConfig(com.albedo.java.modules.gen.domain.xml.GenConfig) SchemeDo(com.albedo.java.modules.gen.domain.SchemeDo) SchemeFormDataVo(com.albedo.java.modules.gen.domain.vo.SchemeFormDataVo) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

TableDo (com.albedo.java.modules.gen.domain.TableDo)7 TableColumnDo (com.albedo.java.modules.gen.domain.TableColumnDo)5 GenConfig (com.albedo.java.modules.gen.domain.xml.GenConfig)4 TableDto (com.albedo.java.modules.gen.domain.dto.TableDto)3 TemplateVo (com.albedo.java.modules.gen.domain.vo.TemplateVo)2 Transactional (org.springframework.transaction.annotation.Transactional)2 CacheKeyBuilder (com.albedo.java.common.core.cache.model.CacheKeyBuilder)1 BizException (com.albedo.java.common.core.exception.BizException)1 ArgumentAssert (com.albedo.java.common.core.util.ArgumentAssert)1 CollUtil (com.albedo.java.common.core.util.CollUtil)1 ObjectUtil (com.albedo.java.common.core.util.ObjectUtil)1 StringUtil (com.albedo.java.common.core.util.StringUtil)1 TableCacheKeyBuilder (com.albedo.java.modules.gen.cache.TableCacheKeyBuilder)1 DatasourceConfDo (com.albedo.java.modules.gen.domain.DatasourceConfDo)1 SchemeDo (com.albedo.java.modules.gen.domain.SchemeDo)1 SchemeDto (com.albedo.java.modules.gen.domain.dto.SchemeDto)1 TableColumnDto (com.albedo.java.modules.gen.domain.dto.TableColumnDto)1 TableFromDto (com.albedo.java.modules.gen.domain.dto.TableFromDto)1 SchemeFormDataVo (com.albedo.java.modules.gen.domain.vo.SchemeFormDataVo)1 TableFormDataVo (com.albedo.java.modules.gen.domain.vo.TableFormDataVo)1