Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -25,7 +25,6 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.modules.common.utils.SecurityUtils;
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
import org.nl.modules.logging.annotation.Log;
|
||||||
import org.nl.modules.system.domain.Menu;
|
|
||||||
import org.nl.modules.system.service.MenuService;
|
import org.nl.modules.system.service.MenuService;
|
||||||
import org.nl.modules.system.service.dto.MenuDto;
|
import org.nl.modules.system.service.dto.MenuDto;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -35,7 +34,6 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ludj
|
* @author ludj
|
||||||
@@ -82,8 +80,8 @@ public class MenuController {
|
|||||||
List<MenuDto> menuList = menuService.getMenus(id);
|
List<MenuDto> menuList = menuService.getMenus(id);
|
||||||
menuSet.add(menuService.findById(id));
|
menuSet.add(menuService.findById(id));
|
||||||
menuSet = menuService.getChildMenus(menuList, menuSet);
|
menuSet = menuService.getChildMenus(menuList, menuSet);
|
||||||
Set<String> ids = menuSet.stream().map(MenuDto::getMenu_id).collect(Collectors.toSet());
|
// Set<String> ids = menuSet.stream().map(MenuDto::getMenuId).collect(Collectors.toSet());
|
||||||
return new ResponseEntity<>(ids, HttpStatus.OK);
|
return new ResponseEntity<>(null, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.modules.system.service.dto;
|
package org.nl.modules.system.service.dto;
|
||||||
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.nl.modules.common.base.BaseDTO;
|
import org.nl.modules.common.base.BaseDTO;
|
||||||
@@ -32,7 +31,7 @@ import java.util.Objects;
|
|||||||
@Setter
|
@Setter
|
||||||
public class MenuDto extends BaseDTO implements Serializable {
|
public class MenuDto extends BaseDTO implements Serializable {
|
||||||
|
|
||||||
private String menu_id;
|
private Long menuId;
|
||||||
|
|
||||||
private List<MenuDto> children;
|
private List<MenuDto> children;
|
||||||
|
|
||||||
@@ -42,25 +41,25 @@ public class MenuDto extends BaseDTO implements Serializable {
|
|||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
private Integer menu_sort;
|
private Integer menuSort;
|
||||||
|
|
||||||
private String path;
|
private String path;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String component;
|
private String component;
|
||||||
|
|
||||||
private String pid;
|
private Long pid;
|
||||||
|
|
||||||
private Integer sub_count;
|
private Integer subCount;
|
||||||
|
|
||||||
private Boolean i_frame;
|
private Boolean iFrame;
|
||||||
|
|
||||||
|
|
||||||
private Boolean cache;
|
private Boolean cache;
|
||||||
|
|
||||||
private Boolean hidden;
|
private Boolean hidden;
|
||||||
|
|
||||||
private String component_name;
|
private String componentName;
|
||||||
|
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
@@ -69,11 +68,11 @@ public class MenuDto extends BaseDTO implements Serializable {
|
|||||||
private boolean leaf;
|
private boolean leaf;
|
||||||
|
|
||||||
public Boolean getHasChildren() {
|
public Boolean getHasChildren() {
|
||||||
return sub_count > 0;
|
return subCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getLeaf() {
|
public Boolean getLeaf() {
|
||||||
return sub_count <= 0;
|
return subCount <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
@@ -89,11 +88,11 @@ public class MenuDto extends BaseDTO implements Serializable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MenuDto menuDto = (MenuDto) o;
|
MenuDto menuDto = (MenuDto) o;
|
||||||
return Objects.equals(menu_id, menuDto.menu_id);
|
return Objects.equals(menuId, menuDto.menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(menu_id);
|
return Objects.hash(menuId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import org.nl.modules.tools.IdUtil;
|
|||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.WqlUtil;
|
import org.nl.modules.wql.util.WqlUtil;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -69,21 +68,21 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
@Override
|
@Override
|
||||||
public MenuDto menuJsonToMenuDto(JSONObject json) {
|
public MenuDto menuJsonToMenuDto(JSONObject json) {
|
||||||
MenuDto menuDto = new MenuDto();
|
MenuDto menuDto = new MenuDto();
|
||||||
menuDto.setMenu_id(json.getString("menu_id"));
|
menuDto.setMenuId(json.getLong("menu_id"));
|
||||||
menuDto.setType(json.getInteger("type"));
|
menuDto.setType(json.getInteger("type"));
|
||||||
menuDto.setPermission(json.getString("permission"));
|
menuDto.setPermission(json.getString("permission"));
|
||||||
menuDto.setTitle(json.getString("title"));
|
menuDto.setTitle(json.getString("title"));
|
||||||
menuDto.setMenu_sort(json.getInteger("menu_sort"));
|
menuDto.setMenuSort(json.getInteger("menu_sort"));
|
||||||
menuDto.setPath(json.getString("path"));
|
menuDto.setPath(json.getString("path"));
|
||||||
menuDto.setComponent(json.getString("component"));
|
menuDto.setComponent(json.getString("component"));
|
||||||
menuDto.setPid(json.getString("pid"));
|
menuDto.setPid(json.getLong("pid"));
|
||||||
menuDto.setIcon(json.getString("icon"));
|
menuDto.setIcon(json.getString("icon"));
|
||||||
|
|
||||||
menuDto.setSub_count(json.getInteger("sub_count"));
|
menuDto.setSubCount(json.getInteger("sub_count"));
|
||||||
menuDto.setI_frame("1".equals(json.getString("i_frame")));
|
menuDto.setIFrame("1".equals(json.getString("i_frame")));
|
||||||
menuDto.setCache("1".equals(json.getString("cache")));
|
menuDto.setCache("1".equals(json.getString("cache")));
|
||||||
menuDto.setHidden("1".equals(json.getString("hidden")));
|
menuDto.setHidden("1".equals(json.getString("hidden")));
|
||||||
menuDto.setComponent_name(json.getString("component_name"));
|
menuDto.setComponentName(json.getString("component_name"));
|
||||||
|
|
||||||
//构建前端需要的数据结构树
|
//构建前端需要的数据结构树
|
||||||
Integer sub_count = json.getInteger("sub_count");
|
Integer sub_count = json.getInteger("sub_count");
|
||||||
@@ -194,11 +193,11 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
WQLObject menuTab = WQLObject.getWQLObject("sys_menu");
|
WQLObject menuTab = WQLObject.getWQLObject("sys_menu");
|
||||||
|
|
||||||
MenuDto newMenu = this.menuJsonToMenuDto(form);
|
MenuDto newMenu = this.menuJsonToMenuDto(form);
|
||||||
if (newMenu.getMenu_id().equals(newMenu.getPid())) {
|
if (newMenu.getMenuId().equals(newMenu.getPid())) {
|
||||||
throw new BadRequestException("上级不能为自己");
|
throw new BadRequestException("上级不能为自己");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newMenu.getI_frame()) {
|
if (newMenu.getIFrame()) {
|
||||||
String http = "http://", https = "https://";
|
String http = "http://", https = "https://";
|
||||||
if (!(newMenu.getPath().toLowerCase().startsWith(http) || newMenu.getPath().toLowerCase().startsWith(https))) {
|
if (!(newMenu.getPath().toLowerCase().startsWith(http) || newMenu.getPath().toLowerCase().startsWith(https))) {
|
||||||
throw new BadRequestException("外链必须以http://或者https://开头");
|
throw new BadRequestException("外链必须以http://或者https://开头");
|
||||||
@@ -212,15 +211,15 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
JSONObject oldMenuJson = menuTab.query("menu_id = '" + form.getString("menu_id") + "'").uniqueResult(0);
|
JSONObject oldMenuJson = menuTab.query("menu_id = '" + form.getString("menu_id") + "'").uniqueResult(0);
|
||||||
MenuDto oldMenu = this.menuJsonToMenuDto(oldMenuJson);
|
MenuDto oldMenu = this.menuJsonToMenuDto(oldMenuJson);
|
||||||
// 记录的父节点ID
|
// 记录的父节点ID
|
||||||
String oldPid = oldMenu.getPid();
|
// String oldPid = oldMenu.getPid();
|
||||||
String newPid = newMenu.getPid();
|
// String newPid = newMenu.getPid();
|
||||||
menuTab.update(form);
|
// menuTab.update(form);
|
||||||
|
//
|
||||||
|
// // 计算父级菜单节点数目
|
||||||
|
// updateSubCnt(oldPid);
|
||||||
|
// updateSubCnt(newPid);
|
||||||
|
|
||||||
// 计算父级菜单节点数目
|
// updateSystemType(newMenu.getMenuId());
|
||||||
updateSubCnt(oldPid);
|
|
||||||
updateSubCnt(newPid);
|
|
||||||
|
|
||||||
updateSystemType(newMenu.getMenu_id());
|
|
||||||
// 清理缓存
|
// 清理缓存
|
||||||
// delCaches(resources.getId());
|
// delCaches(resources.getId());
|
||||||
}
|
}
|
||||||
@@ -242,13 +241,13 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(Set<MenuDto> menuSet) {
|
public void delete(Set<MenuDto> menuSet) {
|
||||||
for (MenuDto menu : menuSet) {
|
/* for (MenuDto menu : menuSet) {
|
||||||
// 清理缓存
|
// 清理缓存
|
||||||
delCaches(menu.getMenu_id());
|
delCaches(menu.getMenu_id());
|
||||||
// roleService.untiedMenu(menu.getMenu_id());
|
// roleService.untiedMenu(menu.getMenu_id());
|
||||||
WQLObject.getWQLObject("sys_menu").delete("menu_id = '" + menu.getMenu_id() + "'");
|
WQLObject.getWQLObject("sys_menu").delete("menu_id = '" + menu.getMenu_id() + "'");
|
||||||
updateSubCnt(menu.getPid());
|
updateSubCnt(menu.getPid());
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -274,7 +273,7 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
@Override
|
@Override
|
||||||
public List<MenuDto> getSuperior(MenuDto menuDto, List<MenuDto> menus) {
|
public List<MenuDto> getSuperior(MenuDto menuDto, List<MenuDto> menus) {
|
||||||
WQLObject menuTab = WQLObject.getWQLObject("sys_menu");
|
WQLObject menuTab = WQLObject.getWQLObject("sys_menu");
|
||||||
if (StrUtil.isEmpty(menuDto.getPid())) {
|
if (ObjectUtil.isEmpty(menuDto.getPid())) {
|
||||||
JSONArray arr = menuTab.query("pid is null").getResultJSONArray(0);
|
JSONArray arr = menuTab.query("pid is null").getResultJSONArray(0);
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
JSONObject json = arr.getJSONObject(i);
|
JSONObject json = arr.getJSONObject(i);
|
||||||
@@ -288,7 +287,7 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
JSONObject json = arr.getJSONObject(i);
|
JSONObject json = arr.getJSONObject(i);
|
||||||
menus.add(this.menuJsonToMenuDto(json));
|
menus.add(this.menuJsonToMenuDto(json));
|
||||||
}
|
}
|
||||||
return getSuperior(findById(menuDto.getPid()), menus);
|
return getSuperior(findById(String.valueOf(menuDto.getPid())), menus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -300,17 +299,17 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
trees.add(menuDTO);
|
trees.add(menuDTO);
|
||||||
}
|
}
|
||||||
for (MenuDto it : menuDtos) {
|
for (MenuDto it : menuDtos) {
|
||||||
if (menuDTO.getMenu_id().equals(it.getPid())) {
|
if (menuDTO.getMenuId().equals(it.getPid())) {
|
||||||
if (menuDTO.getChildren() == null) {
|
if (menuDTO.getChildren() == null) {
|
||||||
menuDTO.setChildren(new ArrayList<>());
|
menuDTO.setChildren(new ArrayList<>());
|
||||||
}
|
}
|
||||||
menuDTO.getChildren().add(it);
|
menuDTO.getChildren().add(it);
|
||||||
ids.add(it.getMenu_id());
|
// ids.add(it.getMenuId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trees.size() == 0) {
|
if (trees.size() == 0) {
|
||||||
trees = menuDtos.stream().filter(s -> !ids.contains(s.getMenu_id())).collect(Collectors.toList());
|
trees = menuDtos.stream().filter(s -> !ids.contains(s.getMenuId())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return trees;
|
return trees;
|
||||||
}
|
}
|
||||||
@@ -322,15 +321,15 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
if (menuDTO != null) {
|
if (menuDTO != null) {
|
||||||
List<MenuDto> menuDtoList = menuDTO.getChildren();
|
List<MenuDto> menuDtoList = menuDTO.getChildren();
|
||||||
MenuVo menuVo = new MenuVo();
|
MenuVo menuVo = new MenuVo();
|
||||||
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getTitle());
|
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponentName()) ? menuDTO.getComponentName() : menuDTO.getTitle());
|
||||||
// 一级目录需要加斜杠,不然会报警告
|
// 一级目录需要加斜杠,不然会报警告
|
||||||
menuVo.setPath(StrUtil.isEmpty(menuDTO.getPid()) ? "/" + menuDTO.getPath() : menuDTO.getPath());
|
menuVo.setPath(ObjectUtil.isEmpty(menuDTO.getPid()) ? "/" + menuDTO.getPath() : menuDTO.getPath());
|
||||||
menuVo.setHidden(menuDTO.getHidden());
|
menuVo.setHidden(menuDTO.getHidden());
|
||||||
// 如果不是外链
|
// 如果不是外链
|
||||||
if (!menuDTO.getI_frame()) {
|
if (!menuDTO.getIFrame()) {
|
||||||
if (StrUtil.isEmpty(menuDTO.getPid())) {
|
if (ObjectUtil.isEmpty(menuDTO.getPid())) {
|
||||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent());
|
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent());
|
||||||
} else if (!StrUtil.isEmpty(menuDTO.getPid()) && menuDTO.getType() == 0) {
|
} else if (!ObjectUtil.isEmpty(menuDTO.getPid()) && menuDTO.getType() == 0) {
|
||||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent());
|
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent());
|
||||||
|
|
||||||
} else if (!StrUtil.isEmpty(menuDTO.getComponent())) {
|
} else if (!StrUtil.isEmpty(menuDTO.getComponent())) {
|
||||||
@@ -343,11 +342,11 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
menuVo.setRedirect("noredirect");
|
menuVo.setRedirect("noredirect");
|
||||||
menuVo.setChildren(buildMenus(menuDtoList));
|
menuVo.setChildren(buildMenus(menuDtoList));
|
||||||
// 处理是一级菜单并且没有子菜单的情况
|
// 处理是一级菜单并且没有子菜单的情况
|
||||||
} else if (StrUtil.isEmpty(menuDTO.getPid())) {
|
} else if (ObjectUtil.isEmpty(menuDTO.getPid())) {
|
||||||
MenuVo menuVo1 = new MenuVo();
|
MenuVo menuVo1 = new MenuVo();
|
||||||
menuVo1.setMeta(menuVo.getMeta());
|
menuVo1.setMeta(menuVo.getMeta());
|
||||||
// 非外链
|
// 非外链
|
||||||
if (!menuDTO.getI_frame()) {
|
if (!menuDTO.getIFrame()) {
|
||||||
menuVo1.setPath("index");
|
menuVo1.setPath("index");
|
||||||
menuVo1.setName(menuVo.getName());
|
menuVo1.setName(menuVo.getName());
|
||||||
menuVo1.setComponent(menuVo.getComponent());
|
menuVo1.setComponent(menuVo.getComponent());
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package org.nl.system.controller.menu;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.system.service.menu.ISysMenuService;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/sysMenu")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SysMenuController {
|
||||||
|
private final ISysMenuService baseService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@ApiOperation("查询菜单")
|
||||||
|
@SaCheckPermission("menu:list")
|
||||||
|
public ResponseEntity<Object> pageQuery(@RequestParam Map param, Pageable page) throws Exception {
|
||||||
|
return new ResponseEntity<>(baseService.queryAll(param),HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package org.nl.system.controller.role;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.common.domain.query.PageQuery;
|
||||||
|
import org.nl.system.service.role.ISysRoleService;
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysRole")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SysRoleController {
|
||||||
|
private final ISysRoleService baseService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询角色")
|
||||||
|
@GetMapping
|
||||||
|
@SaCheckPermission("roles:list")
|
||||||
|
public ResponseEntity<Object> pageQuery(Map param, PageQuery page) {
|
||||||
|
/*QueryWrapper<SysRole> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.like("name", MapUtil.getStr(param, "name"));*/
|
||||||
|
|
||||||
|
LambdaQueryWrapper<SysRole> queryWrapper= new LambdaQueryWrapper<SysRole>()
|
||||||
|
.like(SysRole::getName, MapUtil.getStr(param, "name"));
|
||||||
|
|
||||||
|
|
||||||
|
Page<SysRole> roleList = baseService.page(page.build());
|
||||||
|
|
||||||
|
return new ResponseEntity<>(baseService.page(page.build(), queryWrapper), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package org.nl.system.service.menu;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.nl.modules.system.service.dto.MenuDto;
|
||||||
|
import org.nl.system.service.menu.dao.SysMenu;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
public interface ISysMenuService extends IService<SysMenu> {
|
||||||
|
/**
|
||||||
|
* 查询全部数据,菜单不适用分页
|
||||||
|
*
|
||||||
|
* @param param 条件
|
||||||
|
* @return /
|
||||||
|
* @throws Exception /
|
||||||
|
*/
|
||||||
|
List<MenuDto> queryAll(Map<String, Object> param) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 懒加载菜单数据
|
||||||
|
*
|
||||||
|
* @param pid /
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
List<MenuDto> getMenus(Long pid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sysMenu
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MenuDto doToDto(SysMenu sysMenu);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package org.nl.system.service.menu.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("sys_menu")
|
||||||
|
public class SysMenu implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单标识
|
||||||
|
*/
|
||||||
|
@TableId(value = "menu_id", type = IdType.AUTO)
|
||||||
|
private Long menuId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级菜单ID
|
||||||
|
*/
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子菜单数目
|
||||||
|
*/
|
||||||
|
private Integer subCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属系统
|
||||||
|
*/
|
||||||
|
private String systemType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单分类
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件名称
|
||||||
|
*/
|
||||||
|
private String componentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件
|
||||||
|
*/
|
||||||
|
private String component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer menuSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图标
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链接地址
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否外链
|
||||||
|
*/
|
||||||
|
private Boolean iFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否缓存
|
||||||
|
*/
|
||||||
|
private Boolean cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否隐藏
|
||||||
|
*/
|
||||||
|
private Boolean hidden;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限
|
||||||
|
*/
|
||||||
|
private String permission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人标识
|
||||||
|
*/
|
||||||
|
private Long createId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人标识
|
||||||
|
*/
|
||||||
|
private Long updateOptid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String updateOptname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.system.service.menu.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.nl.system.service.menu.dao.SysMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.nl.system.service.menu.dao.mapper.SysMenuMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package org.nl.system.service.menu.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.modules.system.service.dto.MenuDto;
|
||||||
|
import org.nl.system.service.menu.ISysMenuService;
|
||||||
|
import org.nl.system.service.menu.dao.SysMenu;
|
||||||
|
import org.nl.system.service.menu.dao.mapper.SysMenuMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {
|
||||||
|
private final SysMenuMapper baseMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MenuDto> queryAll(Map<String, Object> param) throws Exception {
|
||||||
|
/*List<SysMenu> sysMenus = baseMapper.selectList(null);
|
||||||
|
List<MenuDto> menus = sysMenus.stream().map(menu -> doToDto(menu)).collect(Collectors.toList());*/
|
||||||
|
return getMenus(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MenuDto> getMenus(Long pid) {
|
||||||
|
QueryWrapper<SysMenu> queryWrapper;
|
||||||
|
if (pid != null && !pid.equals(0L)) {
|
||||||
|
queryWrapper = new QueryWrapper<SysMenu>().eq("pid", pid);
|
||||||
|
} else {
|
||||||
|
queryWrapper = new QueryWrapper<SysMenu>().isNull("pid");
|
||||||
|
}
|
||||||
|
return baseMapper.selectList(queryWrapper).stream().map(menu -> doToDto(menu)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MenuDto doToDto(SysMenu entity) {
|
||||||
|
|
||||||
|
MenuDto menuDto = new MenuDto();
|
||||||
|
menuDto.setMenuId(entity.getMenuId());
|
||||||
|
menuDto.setType(Integer.parseInt(entity.getType()));
|
||||||
|
menuDto.setPermission(entity.getPermission());
|
||||||
|
menuDto.setTitle(entity.getTitle());
|
||||||
|
menuDto.setMenuSort(entity.getMenuSort());
|
||||||
|
menuDto.setPath(entity.getPath());
|
||||||
|
menuDto.setComponent(entity.getComponent());
|
||||||
|
menuDto.setPid(entity.getPid());
|
||||||
|
menuDto.setSubCount(entity.getSubCount());
|
||||||
|
menuDto.setIFrame(entity.getIFrame());
|
||||||
|
menuDto.setCache(entity.getCache());
|
||||||
|
menuDto.setHidden(entity.getHidden());
|
||||||
|
menuDto.setComponentName(entity.getComponentName());
|
||||||
|
menuDto.setIcon(entity.getIcon());
|
||||||
|
|
||||||
|
//构建前端需要的数据结构树
|
||||||
|
Integer sub_count = entity.getSubCount();
|
||||||
|
if (sub_count <= 0) {
|
||||||
|
menuDto.setLeaf(true);
|
||||||
|
menuDto.setHasChildren(false);
|
||||||
|
} else {
|
||||||
|
menuDto.setLeaf(false);
|
||||||
|
menuDto.setHasChildren(true);
|
||||||
|
}
|
||||||
|
return menuDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.system.service.role;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
public interface ISysRoleService extends IService<SysRole> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package org.nl.system.service.role.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("sys_role")
|
||||||
|
public class SysRole implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色级别
|
||||||
|
*/
|
||||||
|
private BigDecimal level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private BigDecimal orderSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private String isUsed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private String isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人标识
|
||||||
|
*/
|
||||||
|
private Long createId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人标识
|
||||||
|
*/
|
||||||
|
private Long updateOptid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String updateOptname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.system.service.role.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.nl.system.service.role.dao.mapper.SysRoleMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package org.nl.system.service.role.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.nl.system.service.role.ISysRoleService;
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
import org.nl.system.service.role.dao.mapper.SysRoleMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package org.nl.system.controller.menu;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysMenu")
|
||||||
|
public class SysMenuController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package org.nl.system.controller.role;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysRole")
|
||||||
|
public class SysRoleController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.system.service.menu;
|
||||||
|
|
||||||
|
import org.nl.system.service.menu.dao.SysMenu;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
public interface ISysMenuService extends IService<SysMenu> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package org.nl.system.service.menu.dao;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("sys_menu")
|
||||||
|
public class SysMenu implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单标识
|
||||||
|
*/
|
||||||
|
@TableId(value = "menu_id", type = IdType.AUTO)
|
||||||
|
private Long menuId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级菜单ID
|
||||||
|
*/
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子菜单数目
|
||||||
|
*/
|
||||||
|
private BigDecimal subCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属系统
|
||||||
|
*/
|
||||||
|
private String systemType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单分类
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件名称
|
||||||
|
*/
|
||||||
|
private String componentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件
|
||||||
|
*/
|
||||||
|
private String component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private BigDecimal menuSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图标
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链接地址
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否外链
|
||||||
|
*/
|
||||||
|
private String iFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否缓存
|
||||||
|
*/
|
||||||
|
private String cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否隐藏
|
||||||
|
*/
|
||||||
|
private String hidden;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限
|
||||||
|
*/
|
||||||
|
private String permission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人标识
|
||||||
|
*/
|
||||||
|
private Long createId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人标识
|
||||||
|
*/
|
||||||
|
private Long updateOptid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String updateOptname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.system.service.menu.dao.mapper;
|
||||||
|
|
||||||
|
import org.nl.system.service.menu.dao.SysMenu;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.nl.system.service.menu.dao.mapper.SysMenuMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package org.nl.system.service.menu.impl;
|
||||||
|
|
||||||
|
import org.nl.system.service.menu.dao.SysMenu;
|
||||||
|
import org.nl.system.service.menu.dao.mapper.SysMenuMapper;
|
||||||
|
import org.nl.system.service.menu.ISysMenuService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 菜单表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.system.service.role;
|
||||||
|
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
public interface ISysRoleService extends IService<SysRole> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package org.nl.system.service.role.dao;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("sys_role")
|
||||||
|
public class SysRole implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色级别
|
||||||
|
*/
|
||||||
|
private BigDecimal level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private BigDecimal orderSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private String isUsed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private String isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人标识
|
||||||
|
*/
|
||||||
|
private Long createId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人标识
|
||||||
|
*/
|
||||||
|
private Long updateOptid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String updateOptname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.system.service.role.dao.mapper;
|
||||||
|
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.nl.system.service.role.dao.mapper.SysRoleMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package org.nl.system.service.role.impl;
|
||||||
|
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
import org.nl.system.service.role.dao.mapper.SysRoleMapper;
|
||||||
|
import org.nl.system.service.role.ISysRoleService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 角色表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -55,8 +55,8 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-show="form.type.toString() !== '2' && form.type.toString() !== '1'" label="外链菜单" prop="i_frame">
|
<el-form-item v-show="form.type.toString() !== '2' && form.type.toString() !== '1'" label="外链菜单" prop="iframe">
|
||||||
<el-radio-group v-model="form.i_frame" size="mini">
|
<el-radio-group v-model="form.iframe" size="mini">
|
||||||
<el-radio-button label="1">是</el-radio-button>
|
<el-radio-button label="1">是</el-radio-button>
|
||||||
<el-radio-button label="0">否</el-radio-button>
|
<el-radio-button label="0">否</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
<el-input v-model="form.title" placeholder="按钮名称" style="width: 190px;" />
|
<el-input v-model="form.title" placeholder="按钮名称" style="width: 190px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-show="form.type.toString() !== '1' " label="权限标识" prop="permission">
|
<el-form-item v-show="form.type.toString() !== '1' " label="权限标识" prop="permission">
|
||||||
<el-input v-model="form.permission" :disabled="form.i_frame=='1'" placeholder="权限标识" style="width: 190px;" />
|
<el-input v-model="form.permission" :disabled="form.iframe=='1'" placeholder="权限标识" style="width: 190px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.type.toString() !== '1' && form.type.toString() !== '2'" label="路由地址" prop="path">
|
<el-form-item v-if="form.type.toString() !== '1' && form.type.toString() !== '2'" label="路由地址" prop="path">
|
||||||
<el-input v-model="form.path" placeholder="路由地址" style="width: 190px;" />
|
<el-input v-model="form.path" placeholder="路由地址" style="width: 190px;" />
|
||||||
@@ -98,10 +98,10 @@
|
|||||||
style="width: 190px;"
|
style="width: 190px;"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-show="!form.i_frame && form.type.toString() === '3' " label="组件名称" prop="componentName">
|
<el-form-item v-show="!form.iframe && form.type.toString() === '3' " label="组件名称" prop="componentName">
|
||||||
<el-input v-model="form.componentName" style="width: 190px;" placeholder="匹配组件内Name字段" />
|
<el-input v-model="form.componentName" style="width: 190px;" placeholder="匹配组件内Name字段" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-show="!form.i_frame && (form.type.toString() === '2' ||form.type.toString() === '3' ) " label="组件路径" prop="component">
|
<el-form-item v-show="!form.iframe && (form.type.toString() === '2' ||form.type.toString() === '3' ) " label="组件路径" prop="component">
|
||||||
<el-input v-model="form.component" style="width: 190px;" placeholder="组件路径" />
|
<el-input v-model="form.component" style="width: 190px;" placeholder="组件路径" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="上级类目" prop="pid">
|
<el-form-item label="上级类目" prop="pid">
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
:auto-load-root-options="false"
|
:auto-load-root-options="false"
|
||||||
:data="crud.data"
|
:data="crud.data"
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
row-key="menu_id"
|
row-key="menuId"
|
||||||
|
|
||||||
@select="crud.selectChange"
|
@select="crud.selectChange"
|
||||||
@select-all="crud.selectAllChange"
|
@select-all="crud.selectAllChange"
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="permission" label="权限标识" :min-width="flexWidth('permission',crud.data,'权限标识')" />
|
<el-table-column prop="permission" label="权限标识" :min-width="flexWidth('permission',crud.data,'权限标识')" />
|
||||||
<el-table-column prop="component" label="组件路径" min-width="120" />
|
<el-table-column prop="component" label="组件路径" min-width="120" />
|
||||||
<el-table-column prop="i_frame" label="外链" :formatter="crud.formatIsOrNot" :min-width="flexWidth('i_frame',crud.data,'外链')" />
|
<el-table-column prop="iframe" label="外链" :formatter="crud.formatIsOrNot" :min-width="flexWidth('iframe',crud.data,'外链')" />
|
||||||
|
|
||||||
<el-table-column prop="cache" label="缓存" :formatter="crud.formatIsOrNot" :min-width="flexWidth('cache',crud.data,'缓存')" />
|
<el-table-column prop="cache" label="缓存" :formatter="crud.formatIsOrNot" :min-width="flexWidth('cache',crud.data,'缓存')" />
|
||||||
<el-table-column prop="hidden" label="可见" :formatter="crud.formatIsOrNot" :min-width="flexWidth('hidden',crud.data,'可见')" />
|
<el-table-column prop="hidden" label="可见" :formatter="crud.formatIsOrNot" :min-width="flexWidth('hidden',crud.data,'可见')" />
|
||||||
@@ -189,7 +189,7 @@ import DateRangePicker from '@/components/DateRangePicker'
|
|||||||
|
|
||||||
// crud交由presenter持有
|
// crud交由presenter持有
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
menu_id: null,
|
menuId: null,
|
||||||
title: null,
|
title: null,
|
||||||
menuSort: 999,
|
menuSort: 999,
|
||||||
path: null,
|
path: null,
|
||||||
@@ -197,7 +197,7 @@ const defaultForm = {
|
|||||||
category: null,
|
category: null,
|
||||||
component: null,
|
component: null,
|
||||||
componentName: null,
|
componentName: null,
|
||||||
i_frame: 0,
|
iframe: 0,
|
||||||
roles: [],
|
roles: [],
|
||||||
pid: 0,
|
pid: 0,
|
||||||
icon: null,
|
icon: null,
|
||||||
@@ -210,7 +210,7 @@ export default {
|
|||||||
name: 'Menu',
|
name: 'Menu',
|
||||||
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker },
|
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '菜单', idField: 'menu_id', url: 'api/menus', crudMethod: { ...crudMenu }})
|
return CRUD({ title: '菜单', idField: 'menuId', url: 'api/sysMenu', crudMethod: { ...crudMenu }})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
data() {
|
data() {
|
||||||
@@ -223,7 +223,7 @@ export default {
|
|||||||
},
|
},
|
||||||
normalizer(node) {
|
normalizer(node) {
|
||||||
return {
|
return {
|
||||||
id: node.menu_id,
|
id: node.menuId,
|
||||||
label: node.title,
|
label: node.title,
|
||||||
children: node.children
|
children: node.children
|
||||||
}
|
}
|
||||||
@@ -242,37 +242,37 @@ export default {
|
|||||||
// 新增与编辑前做的操作
|
// 新增与编辑前做的操作
|
||||||
[CRUD.HOOK.afterToCU](crud, form) {
|
[CRUD.HOOK.afterToCU](crud, form) {
|
||||||
this.menus = []
|
this.menus = []
|
||||||
if (form.menu_id) { // 修改
|
if (form.menuId) { // 修改
|
||||||
if (!form.pid) { // 一级菜单,一级的父级菜单的pid为0.
|
if (!form.pid) { // 一级菜单,一级的父级菜单的pid为0.
|
||||||
form.pid = 0
|
form.pid = 0
|
||||||
}
|
}
|
||||||
this.getSupDepts(form.menu_id)
|
this.getSupDepts(form.menuId)
|
||||||
} else { // 新增
|
} else { // 新增
|
||||||
this.menus.push({ menu_id: 0, title: '顶级类目', children: null })
|
this.menus.push({ menuId: 0, title: '顶级类目', children: null })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getMenus(tree, treeNode, resolve) {
|
getMenus(tree, treeNode, resolve) {
|
||||||
const params = { pid: tree.menu_id }
|
const params = { pid: tree.menuId }
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
crudMenu.getMenus(params).then(res => {
|
crudMenu.getMenus(params).then(res => {
|
||||||
resolve(res.content)
|
resolve(res.content)
|
||||||
})
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
},
|
},
|
||||||
getSupDepts(menu_id) {
|
getSupDepts(menuId) {
|
||||||
crudMenu.getMenuSuperior(menu_id).then(res => {
|
crudMenu.getMenuSuperior(menuId).then(res => {
|
||||||
const children = res.map(function(obj) {
|
const children = res.map(function(obj) {
|
||||||
if (!obj.leaf && !obj.children) {
|
if (!obj.leaf && !obj.children) {
|
||||||
obj.children = null
|
obj.children = null
|
||||||
}
|
}
|
||||||
return obj
|
return obj
|
||||||
})
|
})
|
||||||
this.menus = [{ menu_id: 0, title: '顶级类目', children: children }]
|
this.menus = [{ menuId: 0, title: '顶级类目', children: children }]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadMenus({ action, parentNode, callback }) {
|
loadMenus({ action, parentNode, callback }) {
|
||||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
crudMenu.getMenusTree(parentNode.menu_id).then(res => {
|
crudMenu.getMenusTree(parentNode.menuId).then(res => {
|
||||||
parentNode.children = res.map(function(obj) {
|
parentNode.children = res.map(function(obj) {
|
||||||
if (!obj.leaf) {
|
if (!obj.leaf) {
|
||||||
obj.children = null
|
obj.children = null
|
||||||
|
|||||||
Reference in New Issue
Block a user