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);
}
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;
}
Aggregations