完成了第一版

This commit is contained in:
2025-05-14 19:37:40 +08:00
parent 6e5557d8e0
commit 3c48d562a8
5 changed files with 24 additions and 10 deletions

View File

@ -30,10 +30,10 @@ public class ${entityName}Controller {
@Operation(summary = "web端管理员添加${entityComment}", description = "参数:${entityComment}添加请求体权限管理员方法名add${entityName}")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "${entityComment}管理", content = "web端管理员添加${entityComment}")
public BaseResponse<Boolean> add${entityName}(@Valid @RequestBody ${entityName}AddRequest ${entityNameLower}AddRequest) {
public BaseResponse<Long> add${entityName}(@Valid @RequestBody ${entityName}AddRequest ${entityNameLower}AddRequest) {
${entityName} ${entityNameLower} = commonService.copyProperties(${entityNameLower}AddRequest, ${entityName}.class);
${entityNameLower}Service.save(${entityNameLower});
return ResultUtils.success(true);
return ResultUtils.success(${entityNameLower}.getId());
}
/**
@ -93,7 +93,6 @@ public class ${entityName}Controller {
public BaseResponse<${entityName}VO> query${entityName}ById(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
${entityName} ${entityNameLower} = ${entityNameLower}Service.getById(id);
ThrowUtils.throwIf(${entityNameLower} == null, ErrorCode.OPERATION_ERROR, "当前${entityComment}不存在");
${entityName}VO ${entityNameLower}VO = commonService.copyProperties(${entityNameLower}, ${entityName}VO.class);
return ResultUtils.success(${entityNameLower}VO);
}