1. 开始迁移 menu 模块,完成 menu 列表的接口
2. 开始迁移 dict 模块,梳理了下整体的表结构,删除无用字段
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
### 请求 /menu/list 接口 => 成功
|
||||
GET {{baseUrl}}//menu/list
|
||||
Authorization: Bearer {{token}}
|
||||
@@ -0,0 +1,119 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.permission;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||
import cn.iocoder.dashboard.modules.system.controller.permission.vo.SysMenuListReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.permission.vo.SysMenuRespVO;
|
||||
import cn.iocoder.dashboard.modules.system.service.permission.SysMenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "菜单 API")
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController {
|
||||
|
||||
@Resource
|
||||
private SysMenuService menuService;
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||
@GetMapping("/list")
|
||||
public CommonResult<List<SysMenuRespVO>> list(SysMenuListReqVO reqVO) {
|
||||
return success(menuService.listMenus(reqVO));
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 根据菜单编号获取详细信息
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||
// @GetMapping(value = "/{menuId}")
|
||||
// public AjaxResult getInfo(@PathVariable Long menuId) {
|
||||
// return AjaxResult.success(menuService.selectMenuById(menuId));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取菜单下拉树列表
|
||||
// */
|
||||
// @GetMapping("/treeselect")
|
||||
// public AjaxResult treeselect(SysMenu menu) {
|
||||
// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// Long userId = loginUser.getUser().getUserId();
|
||||
// List<SysMenu> menus = menuService.selectMenuList(menu, userId);
|
||||
// return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 加载对应角色菜单列表树
|
||||
// */
|
||||
// @GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
// public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
|
||||
// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId());
|
||||
// AjaxResult ajax = AjaxResult.success();
|
||||
// ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
// ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
// return ajax;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 新增菜单
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||
// @Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
// @PostMapping
|
||||
// public AjaxResult add(@Validated @RequestBody SysMenu menu) {
|
||||
// if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||
// return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
// } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
||||
// && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) {
|
||||
// return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
// }
|
||||
// menu.setCreateBy(SecurityUtils.getUsername());
|
||||
// return toAjax(menuService.insertMenu(menu));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 修改菜单
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||
// @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
// @PutMapping
|
||||
// public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
|
||||
// if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||
// return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
// } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
||||
// && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) {
|
||||
// return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
// } else if (menu.getMenuId().equals(menu.getParentId())) {
|
||||
// return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
// }
|
||||
// menu.setUpdateBy(SecurityUtils.getUsername());
|
||||
// return toAjax(menuService.updateMenu(menu));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除菜单
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||
// @Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{menuId}")
|
||||
// public AjaxResult remove(@PathVariable("menuId") Long menuId) {
|
||||
// if (menuService.hasChildByMenuId(menuId)) {
|
||||
// return AjaxResult.error("存在子菜单,不允许删除");
|
||||
// }
|
||||
// if (menuService.checkMenuExistRole(menuId)) {
|
||||
// return AjaxResult.error("菜单已分配,不允许删除");
|
||||
// }
|
||||
// return toAjax(menuService.deleteMenuById(menuId));
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.permission.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 菜单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysMenuBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单名称", required = true, example = "芋道")
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@Size(max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
private String menuName;
|
||||
|
||||
@ApiModelProperty(value = "权限标识", example = "sys:menu:add", notes = "仅菜单类型为按钮时,才需要传递")
|
||||
@Size(max = 100)
|
||||
private String permission;
|
||||
|
||||
@ApiModelProperty(value = "类型", required = true, example = "1", notes = "参见 MenuTypeEnum 枚举类")
|
||||
@NotBlank(message = "菜单类型不能为空")
|
||||
private Integer menuType;
|
||||
|
||||
@ApiModelProperty(value = "显示顺序不能为空", required = true, example = "1024")
|
||||
@NotBlank(message = "显示顺序不能为空")
|
||||
private String sort;
|
||||
|
||||
@ApiModelProperty(value = "父菜单 ID", required = true, example = "1024")
|
||||
@NotNull(message = "父菜单 ID 不能为空")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty(value = "路由地址", example = "post", notes = "仅菜单类型为菜单或者目录时,才需要传")
|
||||
@Size(max = 200, message = "路由地址不能超过200个字符")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "菜单图标", example = "/menu/list", notes = "仅菜单类型为菜单或者目录时,才需要传")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 组件路径
|
||||
*/
|
||||
@ApiModelProperty(value = "组件路径", example = "system/post/index", notes = "仅菜单类型为菜单时,才需要传")
|
||||
@Size(max = 200, message = "组件路径不能超过255个字符")
|
||||
private String component;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.permission.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.*;
|
||||
|
||||
@ApiModel("菜单创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysMenuCreateReqVO extends SysMenuBaseVO {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.permission.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@ApiModel("菜单列表 Request VO")
|
||||
@Data
|
||||
public class SysMenuListReqVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单名称", example = "芋道", notes = "模糊匹配")
|
||||
private String menuName;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 CommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.permission.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("菜单信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysMenuRespVO extends SysMenuBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1024")
|
||||
private Integer menuId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.permission.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("菜单更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysMenuUpdateReqVO extends SysMenuBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1024")
|
||||
@NotNull(message = "菜单编号不能为空")
|
||||
private Integer menuId;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user