Search in sources :

Example 1 with SchemeFormDataVo

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

the class SchemeResource method formData.

@GetMapping(value = "/form-data")
@PreAuthorize("@pms.hasPermission('gen_scheme_view')")
public Result formData(SchemeDto schemeDto) {
    String username = SecurityUtil.getUser().getUsername();
    SchemeFormDataVo formData = schemeService.findFormData(schemeDto, username);
    return Result.buildOkData(formData);
}
Also used : SchemeFormDataVo(com.albedo.java.modules.gen.domain.vo.SchemeFormDataVo) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 2 with SchemeFormDataVo

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

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