Search in sources :

Example 1 with GenSchemeDto

use of com.albedo.java.modules.sys.domain.dto.GenSchemeDto in project albedo by somowhere.

the class SchemeResource method genCode.

@LogOperate(value = "方案生成代码")
@PutMapping(value = "/gen-code")
@PreAuthorize("@pms.hasPermission('gen_scheme_code')")
public Result genCode(@Valid @RequestBody GenCodeDto genCodeDto) {
    SchemeDto genSchemeDto = schemeService.getOneDto(genCodeDto.getId());
    ArgumentAssert.notNull(genSchemeDto, "无法获取代码生成方案信息");
    genSchemeDto.setReplaceFile(genCodeDto.getReplaceFile());
    schemeService.generateCode(genSchemeDto);
    return Result.buildOk("生成", genSchemeDto.getName(), "代码成功");
}
Also used : GenSchemeDto(com.albedo.java.modules.sys.domain.dto.GenSchemeDto) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 2 with GenSchemeDto

use of com.albedo.java.modules.sys.domain.dto.GenSchemeDto in project albedo by somowhere.

the class SchemeResource method genMenu.

@LogOperate(value = "生成方案编辑")
@PostMapping("/gen-menu")
@PreAuthorize("@pms.hasPermission('gen_scheme_menu')")
public Result genMenu(@Valid @RequestBody SchemeGenDto schemeGenDto) {
    SchemeDto schemeDto = schemeService.getOneDto(schemeGenDto.getId());
    TableDto tableDto = schemeDto.getTableDto();
    if (tableDto == null) {
        tableDto = tableService.getOneDto(schemeDto.getTableId());
    }
    String url = StringUtil.toAppendStr(StringUtil.SLASH, StringUtil.lowerCase(schemeDto.getModuleName()), (StringUtil.isNotBlank(schemeDto.getSubModuleName()) ? StringUtil.SLASH + StringUtil.lowerCase(schemeDto.getSubModuleName()) : ""), StringUtil.SLASH, StringUtil.toRevertCamelCase(StringUtil.lowerFirst(tableDto.getClassName()), CharUtil.DASHED), StringUtil.SLASH);
    menuService.saveByGenScheme(new GenSchemeDto(schemeDto.getName(), schemeGenDto.getParentMenuId(), url, tableDto.getClassName()));
    return Result.buildOk("生成", schemeDto.getName(), "菜单成功");
}
Also used : GenSchemeDto(com.albedo.java.modules.sys.domain.dto.GenSchemeDto) GenSchemeDto(com.albedo.java.modules.sys.domain.dto.GenSchemeDto) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

LogOperate (com.albedo.java.common.log.annotation.LogOperate)2 GenSchemeDto (com.albedo.java.modules.sys.domain.dto.GenSchemeDto)2 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)2