-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Added menu && tenant Optimization (#2161)
* added menu web * added menu * Spotless Apply * added menu * added menu * added menu * modify user tenant * Spotless Apply * menu about * Spotless Apply * modify user tenant * Spotless Apply * modify user tenant * menu about * Spotless Apply * modify user * modify user * Spotless Apply * Spotless Apply * added menu * Spotless Apply * added update * modify code * Spotless Apply * modify code * Spotless Apply * support added menu * modify code * modify code * modify code * feat: Add menu mapper * feat: Add role-menu mapper * modify code * Spotless Apply * modify code * Spotless Apply * ADDED I18N --------- Co-authored-by: zhu-mingye <[email protected]> Co-authored-by: G-XD <[email protected]>
- Loading branch information
1 parent
7420707
commit 387ccd0
Showing
89 changed files
with
3,693 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
dinky-admin/src/main/java/org/dinky/configure/SaTokenConfigure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* | ||
* 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.configure; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import cn.dev33.satoken.jwt.StpLogicJwtForSimple; | ||
import cn.dev33.satoken.stp.StpLogic; | ||
|
||
@Configuration | ||
public class SaTokenConfigure { | ||
// Sa-Token 整合 jwt (Simple 简单模式) | ||
@Bean | ||
public StpLogic getStpLogicJwt() { | ||
return new StpLogicJwtForSimple(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
dinky-admin/src/main/java/org/dinky/controller/MenuController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
* | ||
* 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.controller; | ||
|
||
import org.dinky.annotation.Log; | ||
import org.dinky.data.dto.RoleMenuDto; | ||
import org.dinky.data.enums.BusinessType; | ||
import org.dinky.data.enums.Status; | ||
import org.dinky.data.model.Menu; | ||
import org.dinky.data.result.ProTableResult; | ||
import org.dinky.data.result.Result; | ||
import org.dinky.service.MenuService; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
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.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
import io.swagger.annotations.ApiOperation; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequestMapping("/api/menu") | ||
@RequiredArgsConstructor | ||
public class MenuController { | ||
|
||
private final MenuService menuService; | ||
|
||
/** | ||
* save or update menu | ||
* | ||
* @param menu {@link Menu} | ||
* @return {@link Result} with {@link Void} | ||
*/ | ||
@PutMapping("addOrUpdate") | ||
@Log(title = "Insert OR Update Menu ", businessType = BusinessType.INSERT_OR_UPDATE) | ||
@ApiOperation("INSERT OR UPDATE Menu") | ||
public Result<Void> saveOrUpdateMenu(@RequestBody Menu menu) { | ||
if (menuService.saveOrUpdate(menu)) { | ||
return Result.succeed(Status.SAVE_SUCCESS); | ||
} else { | ||
return Result.failed(Status.SAVE_FAILED); | ||
} | ||
} | ||
|
||
/** | ||
* list Menus | ||
* | ||
* @param para {@link JsonNode} | ||
* @return {@link ProTableResult} with {@link Menu} | ||
*/ | ||
@GetMapping("listMenus") | ||
@ApiOperation("Query Menu List") | ||
public Result<List<Menu>> listMenus() { | ||
return Result.data(menuService.list()); | ||
} | ||
|
||
/** | ||
* delete menu by id | ||
* | ||
* @param id {@link Integer} | ||
* @return {@link Result} of {@link Void} | ||
*/ | ||
@DeleteMapping("/delete") | ||
@ApiOperation("Delete Menu By Id") | ||
@Log(title = "Delete Menu By Id", businessType = BusinessType.DELETE) | ||
public Result<Void> deleteMenuById(@RequestParam("id") Integer id) { | ||
if (menuService.deleteMenuById(id)) { | ||
return Result.succeed(Status.DELETE_SUCCESS); | ||
} else { | ||
return Result.failed(Status.DELETE_FAILED); | ||
} | ||
} | ||
|
||
/** | ||
* load role menu tree | ||
* | ||
* @param roleId role id | ||
* @return {@link RoleMenuDto} | ||
*/ | ||
@GetMapping(value = "/roleMenuTreeSelect/{roleId}") | ||
@ApiOperation("Load Role Menu") | ||
public Result<RoleMenuDto> roleMenuTreeSelect(@PathVariable("roleId") Integer roleId) { | ||
List<Menu> menus = menuService.list(); | ||
RoleMenuDto menuVO = | ||
RoleMenuDto.builder() | ||
.roleId(roleId) | ||
.selectedMenuIds(menuService.selectMenuListByRoleId(roleId)) | ||
.menus(menus) | ||
.build(); | ||
return Result.succeed(menuVO); | ||
} | ||
} |
Oops, something went wrong.