Search in sources :

Example 1 with SchemeDo

use of com.albedo.java.modules.gen.domain.SchemeDo 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

SchemeDo (com.albedo.java.modules.gen.domain.SchemeDo)1 TableDo (com.albedo.java.modules.gen.domain.TableDo)1 SchemeFormDataVo (com.albedo.java.modules.gen.domain.vo.SchemeFormDataVo)1 GenConfig (com.albedo.java.modules.gen.domain.xml.GenConfig)1 Transactional (org.springframework.transaction.annotation.Transactional)1