Unverified Commit 6fdf8577 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Feature] support assign menu (#2197)

support assign menu
parent 013f615d
...@@ -68,12 +68,30 @@ public class WebExceptionHandler { ...@@ -68,12 +68,30 @@ public class WebExceptionHandler {
} }
@ExceptionHandler @ExceptionHandler
public Result<Void> notLoginException(NotLoginException e) { public Result<Void> notLoginException(NotLoginException notLoginException) {
ServletRequestAttributes servletRequestAttributes = ServletRequestAttributes servletRequestAttributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse(); HttpServletResponse response = servletRequestAttributes.getResponse();
response.setStatus(CodeEnum.NOTLOGIN.getCode()); if (response != null) {
return Result.failed(Status.USER_NOT_LOGIN); response.setStatus(CodeEnum.NOTLOGIN.getCode());
}
if (notLoginException.getType().equals(NotLoginException.NOT_TOKEN)) {
return Result.failed(Status.NOT_TOKEN);
} else if (notLoginException.getType().equals(NotLoginException.INVALID_TOKEN)) {
return Result.failed(Status.INVALID_TOKEN);
} else if (notLoginException.getType().equals(NotLoginException.TOKEN_TIMEOUT)) {
return Result.failed(Status.EXPIRED_TOKEN);
} else if (notLoginException.getType().equals(NotLoginException.BE_REPLACED)) {
return Result.failed(Status.BE_REPLACED);
} else if (notLoginException.getType().equals(NotLoginException.KICK_OUT)) {
return Result.failed(Status.KICK_OUT);
} else if (notLoginException.getType().equals(NotLoginException.TOKEN_FREEZE)) {
return Result.failed(Status.TOKEN_FREEZED);
} else if (notLoginException.getType().equals(NotLoginException.NO_PREFIX)) {
return Result.failed(Status.NO_PREFIX);
} else {
return Result.failed(Status.USER_NOT_LOGIN);
}
} }
/** /**
......
...@@ -32,7 +32,6 @@ import java.util.List; ...@@ -32,7 +32,6 @@ import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -99,10 +98,10 @@ public class MenuController { ...@@ -99,10 +98,10 @@ public class MenuController {
* @param roleId role id * @param roleId role id
* @return {@link RoleMenuDto} * @return {@link RoleMenuDto}
*/ */
@GetMapping(value = "/roleMenuTreeSelect/{roleId}") @GetMapping(value = "/roleMenus/")
@ApiOperation("Load Role Menu") @ApiOperation("Load Role Menu")
public Result<RoleMenuDto> roleMenuTreeSelect(@PathVariable("roleId") Integer roleId) { public Result<RoleMenuDto> roleMenuTreeSelect(@RequestParam("id") Integer roleId) {
List<Menu> menus = menuService.list(); List<Menu> menus = menuService.buildMenuTree(menuService.list());
RoleMenuDto menuVO = RoleMenuDto menuVO =
RoleMenuDto.builder() RoleMenuDto.builder()
.roleId(roleId) .roleId(roleId)
......
...@@ -20,16 +20,14 @@ ...@@ -20,16 +20,14 @@
package org.dinky.controller; package org.dinky.controller;
import org.dinky.data.annotation.Log; import org.dinky.data.annotation.Log;
import org.dinky.data.dto.RoleMenuDto; import org.dinky.data.dto.AssignMenuToRoleDto;
import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.BusinessType;
import org.dinky.data.enums.Status;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.service.RoleMenuService; import org.dinky.service.RoleMenuService;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -52,27 +50,10 @@ public class RoleMenuController { ...@@ -52,27 +50,10 @@ public class RoleMenuController {
* @return {@link Result} with {@link Void} * @return {@link Result} with {@link Void}
* @throws Exception {@link Exception} * @throws Exception {@link Exception}
*/ */
@PutMapping @PostMapping("assignMenuToRole")
@Log(title = "Assign Menus to Role ", businessType = BusinessType.GRANT) @Log(title = "Assign Menus to Role ", businessType = BusinessType.GRANT)
@ApiOperation("Assign Menus to Role") @ApiOperation("Assign Menus to Role")
public Result<Void> assignMenuToRole( public Result<Void> assignMenuToRole(@RequestBody AssignMenuToRoleDto assignMenuToRoleDto) {
@RequestParam Integer roleId, @RequestParam Integer[] menus) { return roleMenuService.assignMenuToRole(assignMenuToRoleDto);
if (roleMenuService.assignMenuToRole(roleId, menus)) {
return Result.succeed(Status.SAVE_SUCCESS);
} else {
return Result.failed(Status.SAVE_FAILED);
}
}
/**
* Query menus by role ID
*
* @param roleId role ID
* @return {@link Result} with {@link RoleMenuDto}
*/
@GetMapping("/queryMenusByRoleId")
@ApiOperation("Query Menus by Role ID")
public Result<RoleMenuDto> queryMenusByRoleId(@RequestParam Integer roleId) {
return Result.succeed(roleMenuService.queryMenusByRoleId(roleId));
} }
} }
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.data.dto;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AssignMenuToRoleDto {
private Integer roleId;
private List<Integer> menuIds;
}
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
package org.dinky.service; package org.dinky.service;
import org.dinky.data.dto.RoleMenuDto; import org.dinky.data.dto.AssignMenuToRoleDto;
import org.dinky.data.model.RoleMenu; import org.dinky.data.model.RoleMenu;
import org.dinky.data.result.Result;
import org.dinky.mybatis.service.ISuperService; import org.dinky.mybatis.service.ISuperService;
public interface RoleMenuService extends ISuperService<RoleMenu> { public interface RoleMenuService extends ISuperService<RoleMenu> {
...@@ -32,13 +33,5 @@ public interface RoleMenuService extends ISuperService<RoleMenu> { ...@@ -32,13 +33,5 @@ public interface RoleMenuService extends ISuperService<RoleMenu> {
* @param menuId menu id * @param menuId menu id
* @return boolean {@code true} if success, {@code false} if failed * @return boolean {@code true} if success, {@code false} if failed
*/ */
boolean assignMenuToRole(Integer roleId, Integer[] menuId); Result<Void> assignMenuToRole(AssignMenuToRoleDto assignMenuToRoleDto);
/**
* Query menus by role id
*
* @param roleId role id
* @return {@link RoleMenuDto}
*/
RoleMenuDto queryMenusByRoleId(Integer roleId);
} }
...@@ -19,8 +19,10 @@ ...@@ -19,8 +19,10 @@
package org.dinky.service.impl; package org.dinky.service.impl;
import org.dinky.data.dto.RoleMenuDto; import org.dinky.data.dto.AssignMenuToRoleDto;
import org.dinky.data.enums.Status;
import org.dinky.data.model.RoleMenu; import org.dinky.data.model.RoleMenu;
import org.dinky.data.result.Result;
import org.dinky.mapper.RoleMenuMapper; import org.dinky.mapper.RoleMenuMapper;
import org.dinky.mybatis.service.impl.SuperServiceImpl; import org.dinky.mybatis.service.impl.SuperServiceImpl;
import org.dinky.service.RoleMenuService; import org.dinky.service.RoleMenuService;
...@@ -31,41 +33,48 @@ import org.springframework.stereotype.Service; ...@@ -31,41 +33,48 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.collection.CollUtil;
@Service @Service
public class RoleMenuServiceImpl extends SuperServiceImpl<RoleMenuMapper, RoleMenu> public class RoleMenuServiceImpl extends SuperServiceImpl<RoleMenuMapper, RoleMenu>
implements RoleMenuService { implements RoleMenuService {
@Override @Override
public boolean assignMenuToRole(Integer roleId, Integer[] menuId) { public Result<Void> assignMenuToRole(AssignMenuToRoleDto assignMenuToRoleDto) {
if (CollUtil.isEmpty(assignMenuToRoleDto.getMenuIds())) {
return Result.failed(Status.SELECT_MENU);
}
int insertSize = 0; int insertSize = 0;
// 先删除原有的关系 // 先删除原有的关系
List<RoleMenu> roleMenus = List<RoleMenu> roleMenus =
getBaseMapper() getBaseMapper()
.selectList( .selectList(
new LambdaQueryWrapper<RoleMenu>().eq(RoleMenu::getRoleId, roleId)); new LambdaQueryWrapper<RoleMenu>()
getBaseMapper().deleteBatchIds(roleMenus); .eq(RoleMenu::getRoleId, assignMenuToRoleDto.getRoleId()));
// 重新建立关系
for (Integer id : menuId) { // if not empty , delete all role menus
if (CollUtil.isNotEmpty(roleMenus)) {
roleMenus.forEach(
rm -> {
getBaseMapper()
.delete(
new LambdaQueryWrapper<RoleMenu>()
.eq(RoleMenu::getMenuId, rm.getMenuId()));
});
}
// then insert new role menus
for (Integer id : assignMenuToRoleDto.getMenuIds()) {
RoleMenu roleMenu = new RoleMenu(); RoleMenu roleMenu = new RoleMenu();
roleMenu.setRoleId(roleId); roleMenu.setRoleId(assignMenuToRoleDto.getRoleId());
roleMenu.setMenuId(id); roleMenu.setMenuId(id);
insertSize += getBaseMapper().insert(roleMenu); insertSize += getBaseMapper().insert(roleMenu);
} }
return menuId.length == insertSize;
}
@Override if (assignMenuToRoleDto.getMenuIds().size() == insertSize) {
public RoleMenuDto queryMenusByRoleId(Integer roleId) { return Result.succeed(Status.ASSIGN_MENU_SUCCESS);
List<RoleMenu> roleMenuList = }
getBaseMapper() return Result.failed(Status.ASSIGN_MENU_FAILED);
.selectList(
new LambdaQueryWrapper<RoleMenu>().eq(RoleMenu::getRoleId, roleId));
RoleMenuDto roleMenuDto = new RoleMenuDto();
roleMenuDto.setRoleId(roleId);
roleMenuList.forEach(
roleMenu -> roleMenuDto.getSelectedMenuIds().add(roleMenu.getMenuId()));
return roleMenuDto;
} }
} }
...@@ -63,6 +63,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -63,6 +63,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.dev33.satoken.secure.SaSecureUtil; import cn.dev33.satoken.secure.SaSecureUtil;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
/** /**
...@@ -134,6 +135,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen ...@@ -134,6 +135,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
} }
user.setPassword(SaSecureUtil.md5(modifyPasswordDTO.getNewPassword())); user.setPassword(SaSecureUtil.md5(modifyPasswordDTO.getNewPassword()));
if (updateById(user)) { if (updateById(user)) {
StpUtil.logout(user.getId());
return Result.succeed(Status.CHANGE_PASSWORD_SUCCESS); return Result.succeed(Status.CHANGE_PASSWORD_SUCCESS);
} }
return Result.failed(Status.CHANGE_PASSWORD_FAILED); return Result.failed(Status.CHANGE_PASSWORD_FAILED);
...@@ -161,7 +163,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen ...@@ -161,7 +163,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
user = loginDTO.isLdapLogin() ? ldapLogin(loginDTO) : localLogin(loginDTO); user = loginDTO.isLdapLogin() ? ldapLogin(loginDTO) : localLogin(loginDTO);
} catch (AuthException e) { } catch (AuthException e) {
// Handle authentication exceptions and return the corresponding error status // Handle authentication exceptions and return the corresponding error status
return Result.failed(e.getStatus()); return Result.failed(e.getStatus() + e.getMessage());
} }
// Check if the user is enabled // Check if the user is enabled
...@@ -366,7 +368,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen ...@@ -366,7 +368,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
@Override @Override
public void outLogin() { public void outLogin() {
StpUtil.logout(); StpUtil.logout(StpUtil.getLoginIdAsInt());
} }
@Override @Override
...@@ -466,7 +468,8 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen ...@@ -466,7 +468,8 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
roleMenus.forEach( roleMenus.forEach(
roleMenu -> { roleMenu -> {
Menu menu = menuService.getById(roleMenu.getMenuId()); Menu menu = menuService.getById(roleMenu.getMenuId());
if (Asserts.isNotNull(menu) && !menu.getType().equals("M")) { if (Asserts.isNotNull(menu)
&& !StrUtil.equals("M", menu.getType())) {
menuList.add(menu); menuList.add(menu);
} }
}); });
......
...@@ -1731,6 +1731,7 @@ create table `dinky_sys_menu` ( ...@@ -1731,6 +1731,7 @@ create table `dinky_sys_menu` (
`order_num` int default null comment 'sort', `order_num` int default null comment 'sort',
`create_time` datetime not null default current_timestamp comment 'create time', `create_time` datetime not null default current_timestamp comment 'create time',
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time', `update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
`note` varchar(255) collate utf8mb4_general_ci default null comment 'note',
primary key (`id`) using btree primary key (`id`) using btree
) engine=innodb ; ) engine=innodb ;
......
...@@ -101,8 +101,17 @@ public enum Status { ...@@ -101,8 +101,17 @@ public enum Status {
USER_ASSIGN_ROLE_FAILED(10016, "User Assign Role Failed", "用户分配角色失败"), USER_ASSIGN_ROLE_FAILED(10016, "User Assign Role Failed", "用户分配角色失败"),
GET_TENANT_FAILED(10017, "Get Tenant Info Failed", "获取租户信息失败"), GET_TENANT_FAILED(10017, "Get Tenant Info Failed", "获取租户信息失败"),
SWITCHING_TENANT_SUCCESS(10018, "Select Tenant Success", "选择租户成功"), SWITCHING_TENANT_SUCCESS(10018, "Select Tenant Success", "选择租户成功"),
// user.superadmin.cannot.disable
USER_SUPERADMIN_CANNOT_DISABLE(10019, "User SuperAdmin Cannot Disable", "超级管理员用户不能停用"), USER_SUPERADMIN_CANNOT_DISABLE(10019, "User SuperAdmin Cannot Disable", "超级管理员用户不能停用"),
NOT_TOKEN(10020, "Can Not Read Token", "未能读取到有效 Token"),
INVALID_TOKEN(10021, "Invalid Token", "无效的 Token"),
EXPIRED_TOKEN(10022, "Expired Token", "Token 已过期"),
BE_REPLACED(10023, "token has been pushed offline", "token 已被顶下线"),
KICK_OUT(10024, "token has been kicked offline", "token 已被踢下线"),
TOKEN_FREEZED(10025, "token has been frozen", "token 已被冻结"),
NO_PREFIX(
10026,
"The token was not submitted according to the specified prefix",
"未按照指定前缀提交 token"),
// role // role
ROLE_ALREADY_EXISTS(10101, "Role Already Exists", "角色已存在"), ROLE_ALREADY_EXISTS(10101, "Role Already Exists", "角色已存在"),
...@@ -133,6 +142,9 @@ public enum Status { ...@@ -133,6 +142,9 @@ public enum Status {
MENU_NOT_EXIST(10302, "Menu Not Exists", "菜单不存在"), MENU_NOT_EXIST(10302, "Menu Not Exists", "菜单不存在"),
MENU_HAS_CHILD(10303, "Menu Has Child, Can Not Delete", "存在子菜单 不允许删除"), MENU_HAS_CHILD(10303, "Menu Has Child, Can Not Delete", "存在子菜单 不允许删除"),
MENU_HAS_ASSIGN(10304, "Menu Has Assign , Can Not Delete", "菜单已分配,不允许删除"), MENU_HAS_ASSIGN(10304, "Menu Has Assign , Can Not Delete", "菜单已分配,不允许删除"),
SELECT_MENU(10305, "Please Select Menu", "请选择菜单"),
ASSIGN_MENU_SUCCESS(10306, "Assign Menu Success", "分配菜单成功"),
ASSIGN_MENU_FAILED(10307, "Assign Menu Failed", "分配菜单失败"),
/** database */ /** database */
DATASOURCE_CONNECT_SUCCESS(11001, "DataSource Connect Success", "数据源连接测试成功"), DATASOURCE_CONNECT_SUCCESS(11001, "DataSource Connect Success", "数据源连接测试成功"),
......
...@@ -216,6 +216,7 @@ export default { ...@@ -216,6 +216,7 @@ export default {
'role.EnterNote': 'Please enter Role Note!', 'role.EnterNote': 'Please enter Role Note!',
'role.delete': 'Delete Role', 'role.delete': 'Delete Role',
'role.deleteConfirm': 'Are you sure you want to delete this Role?', 'role.deleteConfirm': 'Are you sure you want to delete this Role?',
'role.assignMenu': 'Role: [{roleName}] Assign Permissions',
// menu // menu
'menu.management': 'Menu Management', 'menu.management': 'Menu Management',
......
...@@ -208,6 +208,7 @@ export default { ...@@ -208,6 +208,7 @@ export default {
'role.EnterNote': '请输入角色的备注/描述信息!', 'role.EnterNote': '请输入角色的备注/描述信息!',
'role.delete': '删除角色', 'role.delete': '删除角色',
'role.deleteConfirm': '您确定要删除此角色吗?', 'role.deleteConfirm': '您确定要删除此角色吗?',
'role.assignMenu': '角色: [{roleName}] 分配权限',
// menu // menu
'menu.management': '菜单管理', 'menu.management': '菜单管理',
......
...@@ -25,12 +25,12 @@ import {ProCard} from "@ant-design/pro-components"; ...@@ -25,12 +25,12 @@ import {ProCard} from "@ant-design/pro-components";
import {MenuInfo} from "rc-menu/es/interface"; import {MenuInfo} from "rc-menu/es/interface";
import {RIGHT_CONTEXT_MENU} from "@/pages/AuthCenter/Menu/components/MenuList/constants"; import {RIGHT_CONTEXT_MENU} from "@/pages/AuthCenter/Menu/components/MenuList/constants";
import {SysMenu} from "@/types/RegCenter/data"; import {SysMenu} from "@/types/RegCenter/data";
import MenuTree from "@/pages/AuthCenter/Menu/components/MenuTree";
import {PlusSquareTwoTone, ReloadOutlined} from "@ant-design/icons"; import {PlusSquareTwoTone, ReloadOutlined} from "@ant-design/icons";
import OpHelper from "@/pages/AuthCenter/Menu/components/MenuList/OpHelper"; import OpHelper from "@/pages/AuthCenter/Menu/components/MenuList/OpHelper";
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
import RightContextMenu from "@/components/RightContextMenu"; import RightContextMenu from "@/components/RightContextMenu";
import MenuForm from "@/pages/AuthCenter/Menu/components/MenuForm"; import MenuForm from "@/pages/AuthCenter/Menu/components/MenuForm";
import MenuTree from "@/pages/AuthCenter/Menu/components/MenuTree";
const MenuList: React.FC = () => { const MenuList: React.FC = () => {
/** /**
......
...@@ -29,8 +29,7 @@ import * as React from "react"; ...@@ -29,8 +29,7 @@ import * as React from "react";
*/ */
const renderIcon = (iconName: string) => { const renderIcon = (iconName: string) => {
// @ts-ignore // @ts-ignore
const RenderIcon = Icons[iconName]; // get icon component return iconName ? React.createElement(Icons[iconName]): null;
return <RenderIcon key={iconName}/>;
} }
/** /**
......
...@@ -19,34 +19,62 @@ ...@@ -19,34 +19,62 @@
import React, {useCallback, useEffect, useState} from "react"; import React, {useCallback, useEffect, useState} from "react";
import {Button, Drawer, Empty, Input, Space, Tree} from "antd"; import {Button, Drawer, Empty, Input, Space, Spin, Tree} from "antd";
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
import {UserBaseInfo} from "@/types/User/data"; import {UserBaseInfo} from "@/types/User/data";
import {SysMenu} from "@/types/RegCenter/data"; import {SysMenu} from "@/types/RegCenter/data";
import { buildMenuTree } from "@/pages/AuthCenter/Menu/function"; import {buildMenuTree} from "@/pages/AuthCenter/Menu/function";
import {Key} from "@ant-design/pro-components";
import {queryDataByParams} from "@/services/BusinessCrud";
type AssignMenuProps = { type AssignMenuProps = {
values: Partial<UserBaseInfo.Role>, values: Partial<UserBaseInfo.Role>,
open: boolean, open: boolean,
onClose: () => void onClose: () => void,
onSubmit: (value: any) => void onSubmit: (values: Key[]) => void,
} }
const {DirectoryTree} = Tree; const {DirectoryTree} = Tree;
const AssignMenu: React.FC<AssignMenuProps> = (props) => { const AssignMenu: React.FC<AssignMenuProps> = (props) => {
const {open, onClose, onSubmit , values} = props const {open, onClose, onSubmit, values } = props
const [loading, setLoading] = useState(false);
const [searchValue, setSearchValue] = useState(''); const [searchValue, setSearchValue] = useState('');
const [menuData, setMenuData] = useState<SysMenu[]>([]); const [selectValue, handleSelectValue] = useState<Key[]>([]);
const [menuData, setMenuData] = useState<{ menus: SysMenu[], selectedMenuIds: number[] }>({
menus: [],
selectedMenuIds: [],
});
useEffect(()=> {
setLoading(true)
queryDataByParams(`/api/menu/roleMenus/`, {id: values.id}).then((res) => setMenuData(res))
setLoading(false)
},[values.id])
/**
* close
* @type {() => void}
*/
const handleClose = useCallback(() => {
onClose()
setMenuData({menus:[],selectedMenuIds: []})
}, [values, onClose]);
/**
* when submit menu , use loading
*/
const handleSubmit = () => {
setLoading(true)
onSubmit(selectValue)
setLoading(false)
}
useEffect(()=>{
// todo: 获取菜单列表 通过角色 id
// queryDataByParams('/api/menu/listByRoleId', values.id).then((res)=>setMenuData(res))
},[values])
/** /**
...@@ -56,8 +84,8 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => { ...@@ -56,8 +84,8 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
const renderExtraButtons = () => { const renderExtraButtons = () => {
return <> return <>
<Space> <Space>
<Button onClick={onClose}>{l('button.cancel')}</Button> <Button onClick={handleClose}>{l('button.cancel')}</Button>
<Button type="primary" onClick={onSubmit}>{l('button.submit')}</Button> <Button type="primary" loading={loading} onClick={handleSubmit}>{l('button.submit')}</Button>
</Space> </Space>
</> </>
} }
...@@ -68,43 +96,42 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => { ...@@ -68,43 +96,42 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
*/ */
const onSearchChange = useCallback((e: { target: { value: React.SetStateAction<string>; }; }) => { const onSearchChange = useCallback((e: { target: { value: React.SetStateAction<string>; }; }) => {
setSearchValue(e.target.value) setSearchValue(e.target.value)
},[searchValue]) }, [searchValue])
const onCheck = (checkedKeys: any, e: any) => { const onCheck = (selectKeys: any) => {
console.log(checkedKeys, e,'0000') handleSelectValue(selectKeys)
} };
return <> return <>
<Drawer <Drawer
title={'分配菜单权限'} title={l('role.assignMenu','',{roleName: values.roleName})}
open={open} open={open}
width={'45%'} width={'55%'}
maskClosable={false} maskClosable={false}
onClose={onClose} onClose={handleClose}
extra={renderExtraButtons()} extra={renderExtraButtons()}
> >
{ {
(menuData.length > 0) ? (menuData.menus.length > 0) ?
<> <>
<Input <Input
placeholder={l('global.search.text')} placeholder={l('global.search.text')}
allowClear allowClear
style={{marginBottom: 8}} style={{marginBottom: 16}}
value={searchValue} value={searchValue}
onChange={onSearchChange} onChange={onSearchChange}
/> />
<DirectoryTree <Spin spinning={loading}>
// expandedKeys={expandKeys} <DirectoryTree
// selectedKeys={selectKeys} selectable defaultCheckedKeys={[...menuData.selectedMenuIds]}
// onExpand={(keys) => onExpand(keys)} checkable defaultExpandAll
checkable defaultExpandAll onCheck={(keys) => onCheck(keys)}
onCheck={onCheck} multiple={true}
multiple={true} className={'treeList'}
className={'treeList'} treeData={buildMenuTree(menuData.menus, searchValue)}
// onSelect={onNodeClick} />
treeData={buildMenuTree(menuData, searchValue)} </Spin>
/>
</> : <Empty className={'code-content-empty'}/> </> : <Empty className={'code-content-empty'}/>
} }
......
...@@ -18,11 +18,17 @@ ...@@ -18,11 +18,17 @@
*/ */
import React, {useRef, useState} from "react"; import React, {Key, useRef, useState} from "react";
import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table"; import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table";
import {Tag} from 'antd'; import {Tag} from 'antd';
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
import {handleAddOrUpdate, handleRemoveById} from "@/services/BusinessCrud"; import {
handleAddOrUpdate,
handleOption,
handlePutDataByParams,
handleRemoveById,
queryDataByParams
} from "@/services/BusinessCrud";
import {queryList} from "@/services/api"; import {queryList} from "@/services/api";
import {API_CONSTANTS, PROTABLE_OPTIONS_PUBLIC} from "@/services/constants"; import {API_CONSTANTS, PROTABLE_OPTIONS_PUBLIC} from "@/services/constants";
import {getTenantByLocalStorage} from "@/utils/function"; import {getTenantByLocalStorage} from "@/utils/function";
...@@ -33,6 +39,7 @@ import {PopconfirmDeleteBtn} from "@/components/CallBackButton/PopconfirmDeleteB ...@@ -33,6 +39,7 @@ import {PopconfirmDeleteBtn} from "@/components/CallBackButton/PopconfirmDeleteB
import {EditBtn} from "@/components/CallBackButton/EditBtn"; import {EditBtn} from "@/components/CallBackButton/EditBtn";
import {AssignBtn} from "@/components/CallBackButton/AssignBtn"; import {AssignBtn} from "@/components/CallBackButton/AssignBtn";
import AssignMenu from "@/pages/AuthCenter/Role/components/AssignMenu"; import AssignMenu from "@/pages/AuthCenter/Role/components/AssignMenu";
import {SysMenu} from "@/types/RegCenter/data";
const RoleProTable: React.FC = () => { const RoleProTable: React.FC = () => {
...@@ -45,6 +52,7 @@ const RoleProTable: React.FC = () => { ...@@ -45,6 +52,7 @@ const RoleProTable: React.FC = () => {
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
const [assignMenu , setAssignMenu] = useState<boolean>(false); const [assignMenu , setAssignMenu] = useState<boolean>(false);
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const executeAndCallbackRefresh = async (callback: () => void) => { const executeAndCallbackRefresh = async (callback: () => void) => {
...@@ -71,16 +79,28 @@ const RoleProTable: React.FC = () => { ...@@ -71,16 +79,28 @@ const RoleProTable: React.FC = () => {
*/ */
const handleAddOrUpdateSubmit = async (value: any) => { const handleAddOrUpdateSubmit = async (value: any) => {
await executeAndCallbackRefresh(async () => { await executeAndCallbackRefresh(async () => {
// TODO: added or update role interface is use /api/role/addedOrUpdateRole , because of the backend interface 'saveOrUpdate' is repeat , in the future, we need to change the interface to /api/role (ROLE)
await handleAddOrUpdate(API_CONSTANTS.ROLE_ADDED_OR_UPDATE, {...value, tenantId: getTenantByLocalStorage()}); await handleAddOrUpdate(API_CONSTANTS.ROLE_ADDED_OR_UPDATE, {...value, tenantId: getTenantByLocalStorage()});
handleModalVisible(false); handleModalVisible(false);
}); });
} }
/**
* cancel
*/
const handleCancel = () => {
handleModalVisible(false);
handleUpdateModalVisible(false);
setAssignMenu(false);
}
const handleAssignMenuSubmit = async (value: any) => { const handleAssignMenuSubmit = async (selectKeys: Key[]) => {
// TODO : SAVE DATA await executeAndCallbackRefresh(async () => {
setAssignMenu(false) await handleOption('/api/roleMenu/assignMenuToRole', '分配菜单',{
roleId: formValues.id,
menuIds: selectKeys
});
handleCancel();
});
} }
...@@ -94,13 +114,7 @@ const RoleProTable: React.FC = () => { ...@@ -94,13 +114,7 @@ const RoleProTable: React.FC = () => {
handleUpdateModalVisible(true); handleUpdateModalVisible(true);
} }
/**
* cancel
*/
const handleCancel = () => {
handleModalVisible(false);
handleUpdateModalVisible(false);
}
/** /**
* assign user visible change * assign user visible change
...@@ -109,7 +123,7 @@ const RoleProTable: React.FC = () => { ...@@ -109,7 +123,7 @@ const RoleProTable: React.FC = () => {
const handleAssignVisible = (record: Partial<UserBaseInfo.Role>) => { const handleAssignVisible = (record: Partial<UserBaseInfo.Role>) => {
setFormValues(record); setFormValues(record);
setAssignMenu(true); setAssignMenu(true);
} };
/** /**
...@@ -161,7 +175,7 @@ const RoleProTable: React.FC = () => { ...@@ -161,7 +175,7 @@ const RoleProTable: React.FC = () => {
<PopconfirmDeleteBtn key={`${record.id}_delete`} onClick={() => handleDeleteSubmit(record.id)} <PopconfirmDeleteBtn key={`${record.id}_delete`} onClick={() => handleDeleteSubmit(record.id)}
description={l("role.deleteConfirm")}/>} description={l("role.deleteConfirm")}/>}
<AssignBtn key={`${record.id}_ass`} onClick={() => handleAssignVisible(record)} <AssignBtn key={`${record.id}_ass`} onClick={() => handleAssignVisible(record)}
title={l('role.AssignMenu')}/> title={l('role.assignMenu','',{roleName: record.roleName})}/>
</> </>
], ],
}, },
...@@ -195,7 +209,14 @@ const RoleProTable: React.FC = () => { ...@@ -195,7 +209,14 @@ const RoleProTable: React.FC = () => {
modalVisible={updateModalVisible} modalVisible={updateModalVisible}
values={formValues} values={formValues}
/> />
<AssignMenu values={formValues} open={assignMenu} onSubmit={handleAssignMenuSubmit} onClose={() => setAssignMenu(false)}/> {Object.keys(formValues).length> 0 &&
<AssignMenu
values={formValues}
open={assignMenu}
onSubmit={handleAssignMenuSubmit}
onClose={() => setAssignMenu(false)}
/>
}
</> </>
} }
; ;
......
...@@ -1157,9 +1157,46 @@ create table `dinky_sys_menu` ( ...@@ -1157,9 +1157,46 @@ create table `dinky_sys_menu` (
`order_num` int default null comment 'sort', `order_num` int default null comment 'sort',
`create_time` datetime not null default current_timestamp comment 'create time', `create_time` datetime not null default current_timestamp comment 'create time',
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time', `update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
`note` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
primary key (`id`) using btree primary key (`id`) using btree
) engine=innodb auto_increment=1 default charset=utf8mb4 collate=utf8mb4_general_ci; ) engine=innodb auto_increment=1 default charset=utf8mb4 collate=utf8mb4_general_ci;
-- ----------------------------
-- Records of dinky_sys_menu
-- ----------------------------
BEGIN;
INSERT INTO `dinky_sys_menu` VALUES (1, -1, '首页', '/home', './Home', NULL, 'HomeOutlined', 'C', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (2, -1, '运维中心', '/devops', NULL, NULL, 'ControlOutlined', 'M', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (3, -1, '注册中心', '/registration', NULL, NULL, 'AppstoreOutlined', 'M', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (4, -1, '认证中心', '/auth', NULL, NULL, 'SafetyCertificateOutlined', 'M', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (5, -1, '数据开发', '/datastudio', './DataStudio', NULL, 'CodeOutlined', 'C', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (6, -1, '配置中心', '/settings', NULL, NULL, 'SettingOutlined', 'M', 0, NULL, '2023-08-11 14:06:53', '2023-08-11 14:06:53', NULL);
INSERT INTO `dinky_sys_menu` VALUES (7, -1, '关于', '/about', './Other/About', NULL, 'SmileOutlined', 'C', 0, NULL, '2023-08-11 14:06:53', '2023-08-11 14:06:53', NULL);
INSERT INTO `dinky_sys_menu` VALUES (8, -1, '监控', '/metrics', './Metrics', NULL, 'DashboardOutlined', 'C', 0, NULL, '2023-08-11 14:06:53', '2023-08-11 14:06:53', NULL);
INSERT INTO `dinky_sys_menu` VALUES (9, 3, 'cluster', '/registration/cluster', NULL, NULL, 'GoldOutlined', 'M', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (10, 3, 'database', '/registration/database', './RegCenter/DataSource', NULL, 'DatabaseOutlined', 'M', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (11, -1, 'center', '/account/center', './Other/PersonCenter', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (12, 3, 'alert', '/registration/alert', NULL, NULL, 'AlertOutlined', 'M', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (13, 3, 'document', '/registration/document', './RegCenter/Document', NULL, 'BookOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (14, 3, 'fragment', '/registration/fragment', './RegCenter/GlobalVar', NULL, 'RocketOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (15, 3, 'gitprojects', '/registration/gitprojects', './RegCenter/GitProject', NULL, 'GithubOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (16, 3, 'udf', '/registration/udf', './RegCenter/UDF', NULL, 'ToolOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (17, 2, 'job-detail', '/devops/job-detail', './DevOps/JobDetail', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (18, 2, 'job', '/devops/joblist', './DevOps', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (19, 3, 'resource', '/registration/resource', './RegCenter/Resource', NULL, 'FileZipOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (20, 4, 'role', '/auth/role', './AuthCenter/Role', NULL, 'TeamOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (21, 4, 'user', '/auth/user', './AuthCenter/User', NULL, 'UserOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (22, 4, '菜单', '/auth/menu', './AuthCenter/Menu', NULL, 'MenuOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (23, 4, 'tenant', '/auth/tenant', './AuthCenter/Tenant', NULL, 'SecurityScanOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (24, 6, 'globalsetting', '/settings/globalsetting', './SettingCenter/GlobalSetting', NULL, 'SettingOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (25, 6, 'systemlog', '/settings/systemlog', './SettingCenter/SystemLogs', NULL, 'InfoCircleOutlined', 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (26, 6, 'process', '/settings/process', './SettingCenter/Process', NULL, 'ReconciliationOutlined', 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (27, 4, 'rowpermissions', '/auth/rowpermissions', './AuthCenter/RowPermissions', NULL, 'SafetyCertificateOutlined', 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (28, 9, 'cluster-instance', '/registration/cluster/instance', './RegCenter/Cluster/Instance', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (29, 12, 'group', '/registration/alert/group', './RegCenter/Alert/AlertGroup', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (30, 9, 'cluster-config', '/registration/cluster/config', './RegCenter/Cluster/Configuration', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (31, 12, 'instance', '/registration/alert/instance', './RegCenter/Alert/AlertInstance', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
COMMIT;
-- ---------------------------- -- ----------------------------
-- Table structure dinky_sys_role_menu -- Table structure dinky_sys_role_menu
......
...@@ -2187,7 +2187,8 @@ create table public.dinky_sys_menu ( ...@@ -2187,7 +2187,8 @@ create table public.dinky_sys_menu (
display smallint, display smallint,
order_num integer, order_num integer,
create_time timestamp without time zone, create_time timestamp without time zone,
update_time timestamp without time zone update_time timestamp without time zone,
note character varying(500),
); );
COMMENT on table public.dinky_sys_menu is 'dinky_sys_menu'; COMMENT on table public.dinky_sys_menu is 'dinky_sys_menu';
COMMENT on column public.dinky_sys_menu.id is 'id'; COMMENT on column public.dinky_sys_menu.id is 'id';
...@@ -2202,6 +2203,7 @@ COMMENT on column public.dinky_sys_menu.display is 'display'; ...@@ -2202,6 +2203,7 @@ COMMENT on column public.dinky_sys_menu.display is 'display';
COMMENT on column public.dinky_sys_menu.order_num is 'order num'; COMMENT on column public.dinky_sys_menu.order_num is 'order num';
COMMENT on column public.dinky_sys_menu.create_time is 'create time'; COMMENT on column public.dinky_sys_menu.create_time is 'create time';
COMMENT on column public.dinky_sys_menu.update_time is 'update time'; COMMENT on column public.dinky_sys_menu.update_time is 'update time';
COMMENT on column public.dinky_sys_menu.note is 'note';
-- ---------------------------- -- ----------------------------
......
...@@ -208,4 +208,44 @@ drop table dinky_role_namespace; ...@@ -208,4 +208,44 @@ drop table dinky_role_namespace;
-- ----------------------------
-- Table structure for dinky_sys_menu
-- ----------------------------
drop table if exists `dinky_sys_menu`;
create table `dinky_sys_menu` (
`id` bigint not null auto_increment comment ' id',
`parent_id` bigint not null comment 'parent menu id',
`name` varchar(64) collate utf8mb4_general_ci not null comment 'menu button name',
`path` varchar(64) collate utf8mb4_general_ci default null comment 'routing path',
`component` varchar(64) collate utf8mb4_general_ci default null comment 'routing component component',
`perms` varchar(64) collate utf8mb4_general_ci default null comment 'authority id',
`icon` varchar(64) collate utf8mb4_general_ci default null comment 'icon',
`type` char(1) collate utf8mb4_general_ci default null comment 'type(M:directory C:menu F:button)',
`display` tinyint collate utf8mb4_general_ci not null default 1 comment 'whether the menu is displayed',
`order_num` int default null comment 'sort',
`create_time` datetime not null default current_timestamp comment 'create time',
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
`note` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
primary key (`id`) using btree
) engine=innodb auto_increment=1 default charset=utf8mb4 collate=utf8mb4_general_ci;
-- ----------------------------
-- Table structure dinky_sys_role_menu
-- ----------------------------
drop table if exists `dinky_sys_role_menu`;
CREATE TABLE `dinky_sys_role_menu` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`role_id` bigint NOT NULL COMMENT 'role id',
`menu_id` bigint NOT NULL COMMENT 'menu id',
`create_time` datetime not null default current_timestamp comment 'create time',
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `un_role_menu_inx` (`role_id`,`menu_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
...@@ -60,4 +60,45 @@ UPDATE `dinky_sys_config` SET `name` = 'flink.settings.jobIdWait' where `name` ...@@ -60,4 +60,45 @@ UPDATE `dinky_sys_config` SET `name` = 'flink.settings.jobIdWait' where `name`
INSERT INTO `dinky_resources` (`id`, `file_name`, `description`, `user_id`, `type`, `size`, `pid`, `full_name`, `is_directory`) VALUES (0, 'Root', 'main folder', 1, 0, 0, -1, '/Root', 1); INSERT INTO `dinky_resources` (`id`, `file_name`, `description`, `user_id`, `type`, `size`, `pid`, `full_name`, `is_directory`) VALUES (0, 'Root', 'main folder', 1, 0, 0, -1, '/Root', 1);
-- ----------------------------
-- Records of dinky_sys_menu
-- ----------------------------
BEGIN;
INSERT INTO `dinky_sys_menu` VALUES (1, -1, '首页', '/home', './Home', NULL, 'HomeOutlined', 'C', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (2, -1, '运维中心', '/devops', NULL, NULL, 'ControlOutlined', 'M', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (3, -1, '注册中心', '/registration', NULL, NULL, 'AppstoreOutlined', 'M', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (4, -1, '认证中心', '/auth', NULL, NULL, 'SafetyCertificateOutlined', 'M', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (5, -1, '数据开发', '/datastudio', './DataStudio', NULL, 'CodeOutlined', 'C', 0, NULL, '2023-08-11 14:06:52', '2023-08-11 14:06:52', NULL);
INSERT INTO `dinky_sys_menu` VALUES (6, -1, '配置中心', '/settings', NULL, NULL, 'SettingOutlined', 'M', 0, NULL, '2023-08-11 14:06:53', '2023-08-11 14:06:53', NULL);
INSERT INTO `dinky_sys_menu` VALUES (7, -1, '关于', '/about', './Other/About', NULL, 'SmileOutlined', 'C', 0, NULL, '2023-08-11 14:06:53', '2023-08-11 14:06:53', NULL);
INSERT INTO `dinky_sys_menu` VALUES (8, -1, '监控', '/metrics', './Metrics', NULL, 'DashboardOutlined', 'C', 0, NULL, '2023-08-11 14:06:53', '2023-08-11 14:06:53', NULL);
INSERT INTO `dinky_sys_menu` VALUES (9, 3, 'cluster', '/registration/cluster', NULL, NULL, 'GoldOutlined', 'M', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (10, 3, 'database', '/registration/database', './RegCenter/DataSource', NULL, 'DatabaseOutlined', 'M', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (11, -1, 'center', '/account/center', './Other/PersonCenter', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (12, 3, 'alert', '/registration/alert', NULL, NULL, 'AlertOutlined', 'M', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (13, 3, 'document', '/registration/document', './RegCenter/Document', NULL, 'BookOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (14, 3, 'fragment', '/registration/fragment', './RegCenter/GlobalVar', NULL, 'RocketOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (15, 3, 'gitprojects', '/registration/gitprojects', './RegCenter/GitProject', NULL, 'GithubOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (16, 3, 'udf', '/registration/udf', './RegCenter/UDF', NULL, 'ToolOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (17, 2, 'job-detail', '/devops/job-detail', './DevOps/JobDetail', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (18, 2, 'job', '/devops/joblist', './DevOps', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (19, 3, 'resource', '/registration/resource', './RegCenter/Resource', NULL, 'FileZipOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (20, 4, 'role', '/auth/role', './AuthCenter/Role', NULL, 'TeamOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (21, 4, 'user', '/auth/user', './AuthCenter/User', NULL, 'UserOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (22, 4, '菜单', '/auth/menu', './AuthCenter/Menu', NULL, 'MenuOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (23, 4, 'tenant', '/auth/tenant', './AuthCenter/Tenant', NULL, 'SecurityScanOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (24, 6, 'globalsetting', '/settings/globalsetting', './SettingCenter/GlobalSetting', NULL, 'SettingOutlined', 'C', 0, NULL, '2023-08-11 14:06:54', '2023-08-11 14:06:54', NULL);
INSERT INTO `dinky_sys_menu` VALUES (25, 6, 'systemlog', '/settings/systemlog', './SettingCenter/SystemLogs', NULL, 'InfoCircleOutlined', 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (26, 6, 'process', '/settings/process', './SettingCenter/Process', NULL, 'ReconciliationOutlined', 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (27, 4, 'rowpermissions', '/auth/rowpermissions', './AuthCenter/RowPermissions', NULL, 'SafetyCertificateOutlined', 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (28, 9, 'cluster-instance', '/registration/cluster/instance', './RegCenter/Cluster/Instance', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (29, 12, 'group', '/registration/alert/group', './RegCenter/Alert/AlertGroup', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (30, 9, 'cluster-config', '/registration/cluster/config', './RegCenter/Cluster/Configuration', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
INSERT INTO `dinky_sys_menu` VALUES (31, 12, 'instance', '/registration/alert/instance', './RegCenter/Alert/AlertInstance', NULL, NULL, 'C', 0, NULL, '2023-08-11 14:06:55', '2023-08-11 14:06:55', NULL);
COMMIT;
update dinky_user set super_admin_flag =1 where id =1; update dinky_user set super_admin_flag =1 where id =1;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment