chore: 优化菜单初始数据图标

This commit is contained in:
2024-04-13 22:58:48 +08:00
parent fe5735090d
commit c31f2a3d67
4 changed files with 51 additions and 45 deletions

View File

@@ -16,22 +16,18 @@
package top.charles7c.continew.admin.system.model.req;
import java.io.Serial;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import org.hibernate.validator.constraints.Length;
import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum;
import top.charles7c.continew.admin.common.enums.MenuTypeEnum;
import top.charles7c.continew.starter.extension.crud.model.req.BaseReq;
import java.io.Serial;
/**
* 创建或修改菜单信息
*
@@ -103,6 +99,12 @@ public class MenuReq extends BaseReq {
@Length(max = 255, message = "组件路径长度不能超过 {max} 个字符")
private String component;
/**
* 重定向地址
*/
@Schema(description = "重定向地址")
private String redirect;
/**
* 是否外链
*/

View File

@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.charles7c.continew.admin.common.constant.CacheConstants;
import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum;
import top.charles7c.continew.admin.common.enums.MenuTypeEnum;
import top.charles7c.continew.admin.system.mapper.MenuMapper;
import top.charles7c.continew.admin.system.model.entity.MenuDO;
import top.charles7c.continew.admin.system.model.query.MenuQuery;
@@ -51,6 +52,9 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuRes
public Long add(MenuReq req) {
String title = req.getTitle();
CheckUtils.throwIf(this.isNameExists(title, req.getParentId(), null), "新增失败,[{}] 已存在", title);
if (MenuTypeEnum.DIR.equals(req.getType())) {
req.setComponent("Layout");
}
return super.add(req);
}