style: 返回值警告消除
返回值警告消除 由 Result 为 Result<?> 由 Option 为 Option<Type>
This commit is contained in:
@@ -23,7 +23,7 @@ public class Option<T> {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public Option(T value, String label, List<Option> children) {
|
||||
public Option(T value, String label, List<Option<T>> children) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
this.children= children;
|
||||
@@ -37,6 +37,6 @@ public class Option<T> {
|
||||
|
||||
@Schema(description="子选项列表")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
|
||||
private List<Option> children;
|
||||
private List<Option<T>> children;
|
||||
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class AuthController {
|
||||
@Operation(summary = "注销")
|
||||
@DeleteMapping("/logout")
|
||||
@LogAnnotation(value = "注销", module = LogModuleEnum.LOGIN)
|
||||
public Result logout() {
|
||||
public Result<?> logout() {
|
||||
authService.logout();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FileController {
|
||||
@DeleteMapping
|
||||
@Operation(summary = "文件删除")
|
||||
@SneakyThrows
|
||||
public Result deleteFile(
|
||||
public Result<?> deleteFile(
|
||||
@Parameter(description = "文件路径") @RequestParam String filePath
|
||||
) {
|
||||
boolean result = ossService.deleteFile(filePath);
|
||||
|
||||
@@ -57,14 +57,14 @@ public class GeneratorController {
|
||||
@Operation(summary = "保存代码生成配置")
|
||||
@PostMapping("/{tableName}/config")
|
||||
@LogAnnotation(value = "生成代码", module = LogModuleEnum.OTHER)
|
||||
public Result saveGenConfig(@RequestBody GenConfigForm formData) {
|
||||
public Result<?> saveGenConfig(@RequestBody GenConfigForm formData) {
|
||||
generatorService.saveGenConfig(formData);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "删除代码生成配置")
|
||||
@DeleteMapping("/{tableName}/config")
|
||||
public Result deleteGenConfig(
|
||||
public Result<?> deleteGenConfig(
|
||||
@Parameter(description = "表名", example = "sys_user") @PathVariable String tableName
|
||||
) {
|
||||
generatorService.deleteGenConfig(tableName);
|
||||
@@ -87,7 +87,7 @@ public class GeneratorController {
|
||||
byte[] data = generatorService.downloadCode(tableNames);
|
||||
response.reset();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"youlai-admin-code.zip\"");
|
||||
response.addHeader("Content-Length", "" + data.length);
|
||||
response.addHeader("Content-Length", String.valueOf(data.length));
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
|
||||
@@ -45,8 +45,8 @@ public class SysDeptController {
|
||||
|
||||
@Operation(summary = "部门下拉列表")
|
||||
@GetMapping("/options")
|
||||
public Result<List<Option>> getDeptOptions() {
|
||||
List<Option> list = deptService.listDeptOptions();
|
||||
public Result<List<Option<Long>>> getDeptOptions() {
|
||||
List<Option<Long>> list = deptService.listDeptOptions();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class SysDeptController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:dept:add')")
|
||||
@PreventRepeatSubmit
|
||||
public Result saveDept(
|
||||
public Result<?> saveDept(
|
||||
@Valid @RequestBody DeptForm formData
|
||||
) {
|
||||
Long id = deptService.saveDept(formData);
|
||||
@@ -73,7 +73,7 @@ public class SysDeptController {
|
||||
@Operation(summary = "修改部门")
|
||||
@PutMapping(value = "/{deptId}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:dept:edit')")
|
||||
public Result updateDept(
|
||||
public Result<?> updateDept(
|
||||
@PathVariable Long deptId,
|
||||
@Valid @RequestBody DeptForm formData
|
||||
) {
|
||||
@@ -84,7 +84,7 @@ public class SysDeptController {
|
||||
@Operation(summary = "删除部门")
|
||||
@DeleteMapping("/{ids}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:dept:delete')")
|
||||
public Result deleteDepartments(
|
||||
public Result<?> deleteDepartments(
|
||||
@Parameter(description ="部门ID,多个以英文逗号(,)分割") @PathVariable("ids") String ids
|
||||
) {
|
||||
boolean result = deptService.deleteByIds(ids);
|
||||
|
||||
@@ -46,17 +46,17 @@ public class SysDictController {
|
||||
|
||||
@Operation(summary = "字典列表")
|
||||
@GetMapping("/list")
|
||||
public Result<List<Option>> getDictList() {
|
||||
List<Option> list = dictService.getDictList();
|
||||
public Result<List<Option<String>>> getDictList() {
|
||||
List<Option<String>> list = dictService.getDictList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典数据项列表")
|
||||
@GetMapping("/{code}/options")
|
||||
public Result<List<Option>> getDictOptions(
|
||||
public Result<List<Option<Long>>> getDictOptions(
|
||||
@Parameter(description = "字典编码") @PathVariable String code
|
||||
) {
|
||||
List<Option> options = dictService.listDictItemsByCode(code);
|
||||
List<Option<Long>> options = dictService.listDictItemsByCode(code);
|
||||
return Result.success(options);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class SysDictController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:dict:add')")
|
||||
@PreventRepeatSubmit
|
||||
public Result saveDict(@RequestBody DictForm formData) {
|
||||
public Result<?> saveDict(@RequestBody DictForm formData) {
|
||||
boolean result = dictService.saveDict(formData);
|
||||
return Result.judge(result);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class SysDictController {
|
||||
@Operation(summary = "修改字典")
|
||||
@PutMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:dict:edit')")
|
||||
public Result updateDict(
|
||||
public Result<?> updateDict(
|
||||
@PathVariable Long id,
|
||||
@RequestBody DictForm DictForm
|
||||
) {
|
||||
@@ -92,7 +92,7 @@ public class SysDictController {
|
||||
@Operation(summary = "删除字典")
|
||||
@DeleteMapping("/{ids}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:dict:delete')")
|
||||
public Result deleteDictionaries(
|
||||
public Result<?> deleteDictionaries(
|
||||
@Parameter(description = "字典ID,多个以英文逗号(,)拼接") @PathVariable String ids
|
||||
) {
|
||||
dictService.deleteDictByIds(ids);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SysMenuController {
|
||||
|
||||
@Operation(summary = "菜单下拉列表")
|
||||
@GetMapping("/options")
|
||||
public Result listMenuOptions(
|
||||
public Result<?> listMenuOptions(
|
||||
@Parameter(description = "是否只查询父级菜单")
|
||||
@RequestParam(required = false, defaultValue = "false") boolean onlyParent
|
||||
) {
|
||||
@@ -76,7 +76,7 @@ public class SysMenuController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:menu:add')")
|
||||
@PreventRepeatSubmit
|
||||
public Result addMenu(@RequestBody MenuForm menuForm) {
|
||||
public Result<?> addMenu(@RequestBody MenuForm menuForm) {
|
||||
boolean result = menuService.saveMenu(menuForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class SysMenuController {
|
||||
@Operation(summary = "修改菜单")
|
||||
@PutMapping(value = "/{id}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:menu:edit')")
|
||||
public Result updateMenu(
|
||||
public Result<?> updateMenu(
|
||||
@RequestBody MenuForm menuForm
|
||||
) {
|
||||
boolean result = menuService.saveMenu(menuForm);
|
||||
@@ -94,7 +94,7 @@ public class SysMenuController {
|
||||
@Operation(summary = "删除菜单")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:menu:delete')")
|
||||
public Result deleteMenu(
|
||||
public Result<?> deleteMenu(
|
||||
@Parameter(description = "菜单ID,多个以英文(,)分割") @PathVariable("id") Long id
|
||||
) {
|
||||
boolean result = menuService.deleteMenu(id);
|
||||
@@ -103,7 +103,7 @@ public class SysMenuController {
|
||||
|
||||
@Operation(summary = "修改菜单显示状态")
|
||||
@PatchMapping("/{menuId}")
|
||||
public Result updateMenuVisible(
|
||||
public Result<?> updateMenuVisible(
|
||||
@Parameter(description = "菜单ID") @PathVariable Long menuId,
|
||||
@Parameter(description = "显示状态(1:显示;0:隐藏)") Integer visible
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ public class SysRoleController {
|
||||
|
||||
@Operation(summary = "角色下拉列表")
|
||||
@GetMapping("/options")
|
||||
public Result<List<Option>> listRoleOptions() {
|
||||
List<Option> list = roleService.listRoleOptions();
|
||||
public Result<List<Option<Long>>> listRoleOptions() {
|
||||
List<Option<Long>> list = roleService.listRoleOptions();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SysRoleController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:role:add')")
|
||||
@PreventRepeatSubmit
|
||||
public Result addRole(@Valid @RequestBody RoleForm roleForm) {
|
||||
public Result<?> addRole(@Valid @RequestBody RoleForm roleForm) {
|
||||
boolean result = roleService.saveRole(roleForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class SysRoleController {
|
||||
@Operation(summary = "修改角色")
|
||||
@PutMapping(value = "/{id}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:role:edit')")
|
||||
public Result updateRole(@Valid @RequestBody RoleForm roleForm) {
|
||||
public Result<?> updateRole(@Valid @RequestBody RoleForm roleForm) {
|
||||
boolean result = roleService.saveRole(roleForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class SysRoleController {
|
||||
@Operation(summary = "删除角色")
|
||||
@DeleteMapping("/{ids}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:role:delete')")
|
||||
public Result deleteRoles(
|
||||
public Result<?> deleteRoles(
|
||||
@Parameter(description = "删除角色,多个以英文逗号(,)拼接") @PathVariable String ids
|
||||
) {
|
||||
boolean result = roleService.deleteRoles(ids);
|
||||
@@ -92,7 +92,7 @@ public class SysRoleController {
|
||||
|
||||
@Operation(summary = "修改角色状态")
|
||||
@PutMapping(value = "/{roleId}/status")
|
||||
public Result updateRoleStatus(
|
||||
public Result<?> updateRoleStatus(
|
||||
@Parameter(description = "角色ID") @PathVariable Long roleId,
|
||||
@Parameter(description = "状态(1:启用;0:禁用)") @RequestParam Integer status
|
||||
) {
|
||||
@@ -111,7 +111,7 @@ public class SysRoleController {
|
||||
|
||||
@Operation(summary = "分配菜单(包括按钮权限)给角色")
|
||||
@PutMapping("/{roleId}/menus")
|
||||
public Result assignMenusToRole(
|
||||
public Result<?> assignMenusToRole(
|
||||
@PathVariable Long roleId,
|
||||
@RequestBody List<Long> menuIds
|
||||
) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SysUserController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:user:add')")
|
||||
@PreventRepeatSubmit
|
||||
public Result saveUser(
|
||||
public Result<?> saveUser(
|
||||
@RequestBody @Valid UserForm userForm
|
||||
) {
|
||||
boolean result = userService.saveUser(userForm);
|
||||
@@ -86,7 +86,7 @@ public class SysUserController {
|
||||
@Operation(summary = "修改用户")
|
||||
@PutMapping(value = "/{userId}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:user:edit')")
|
||||
public Result updateUser(
|
||||
public Result<?> updateUser(
|
||||
@Parameter(description = "用户ID") @PathVariable Long userId,
|
||||
@RequestBody @Validated UserForm userForm) {
|
||||
boolean result = userService.updateUser(userId, userForm);
|
||||
@@ -96,7 +96,7 @@ public class SysUserController {
|
||||
@Operation(summary = "删除用户")
|
||||
@DeleteMapping("/{ids}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:user:delete')")
|
||||
public Result deleteUsers(
|
||||
public Result<?> deleteUsers(
|
||||
@Parameter(description = "用户ID,多个以英文逗号(,)分割") @PathVariable String ids
|
||||
) {
|
||||
boolean result = userService.deleteUsers(ids);
|
||||
@@ -106,7 +106,7 @@ public class SysUserController {
|
||||
@Operation(summary = "修改用户密码")
|
||||
@PatchMapping(value = "/{userId}/password")
|
||||
@PreAuthorize("@ss.hasPerm('sys:user:password:reset')")
|
||||
public Result updatePassword(
|
||||
public Result<?> updatePassword(
|
||||
@Parameter(description = "用户ID") @PathVariable Long userId,
|
||||
@RequestParam String password
|
||||
) {
|
||||
@@ -116,7 +116,7 @@ public class SysUserController {
|
||||
|
||||
@Operation(summary = "修改用户状态")
|
||||
@PatchMapping(value = "/{userId}/status")
|
||||
public Result updateUserStatus(
|
||||
public Result<?> updateUserStatus(
|
||||
@Parameter(description = "用户ID") @PathVariable Long userId,
|
||||
@Parameter(description = "用户状态(1:启用;0:禁用)") @RequestParam Integer status
|
||||
) {
|
||||
@@ -152,7 +152,7 @@ public class SysUserController {
|
||||
|
||||
@Operation(summary = "导入用户")
|
||||
@PostMapping("/import")
|
||||
public Result importUsers(MultipartFile file) throws IOException {
|
||||
public Result<?> importUsers(MultipartFile file) throws IOException {
|
||||
UserImportListener listener = new UserImportListener();
|
||||
String msg = ExcelUtils.importExcel(file.getInputStream(), UserImportDTO.class, listener);
|
||||
return Result.success(msg);
|
||||
|
||||
@@ -35,6 +35,6 @@ public interface DictItemConverter {
|
||||
@Mapping(target = "value", source = "id"),
|
||||
@Mapping(target = "label", source = "name")
|
||||
})
|
||||
Option convertToOption(SysDictItem dictItem);
|
||||
List<Option> convertToOption(List<SysDictItem> dictItems);
|
||||
Option<Long> convertToOption(SysDictItem dictItem);
|
||||
List<Option<Long>> convertToOption(List<SysDictItem> dictItems);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ public interface GenConfigConverter {
|
||||
|
||||
GenConfigForm.FieldConfig toGenFieldConfigForm(GenFieldConfig genFieldConfig);
|
||||
|
||||
|
||||
GenConfig toGenConfig(GenConfigForm formData);
|
||||
|
||||
List<GenFieldConfig> toGenFieldConfig(List<GenConfigForm.FieldConfig> fieldConfigs);
|
||||
|
||||
@@ -26,10 +26,9 @@ public interface RoleConverter {
|
||||
@Mapping(target = "value", source = "id"),
|
||||
@Mapping(target = "label", source = "name")
|
||||
})
|
||||
Option entity2Option(SysRole role);
|
||||
Option<Long> entity2Option(SysRole role);
|
||||
|
||||
|
||||
List<Option> entities2Options(List<SysRole> roles);
|
||||
List<Option<Long>> entities2Options(List<SysRole> roles);
|
||||
|
||||
SysRole toEntity(RoleForm roleForm);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.mapstruct.Mapper;
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SysConfigConverter {
|
||||
|
||||
Page<ConfigVO> convertToPageVo(Page<SysConfig> page);
|
||||
|
||||
SysConfig toEntity(ConfigForm configForm);
|
||||
|
||||
@@ -19,31 +19,31 @@ public interface SysDeptService extends IService<SysDept> {
|
||||
/**
|
||||
* 部门列表
|
||||
*
|
||||
* @return
|
||||
* @return 部门列表
|
||||
*/
|
||||
List<DeptVO> getDeptList(DeptQuery queryParams);
|
||||
|
||||
/**
|
||||
* 部门树形下拉选项
|
||||
*
|
||||
* @return
|
||||
* @return 部门树形下拉选项
|
||||
*/
|
||||
List<Option> listDeptOptions();
|
||||
List<Option<Long>> listDeptOptions();
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*
|
||||
* @param formData
|
||||
* @return
|
||||
* @param formData 部门表单
|
||||
* @return 部门ID
|
||||
*/
|
||||
Long saveDept(DeptForm formData);
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*
|
||||
* @param deptId
|
||||
* @param formData
|
||||
* @return
|
||||
* @param deptId 部门ID
|
||||
* @param formData 部门表单
|
||||
* @return 部门ID
|
||||
*/
|
||||
Long updateDept(Long deptId, DeptForm formData);
|
||||
|
||||
@@ -51,15 +51,15 @@ public interface SysDeptService extends IService<SysDept> {
|
||||
* 删除部门
|
||||
*
|
||||
* @param ids 部门ID,多个以英文逗号,拼接字符串
|
||||
* @return
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteByIds(String ids);
|
||||
|
||||
/**
|
||||
* 获取部门详情
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
* @param deptId 部门ID
|
||||
* @return 部门详情
|
||||
*/
|
||||
DeptForm getDeptForm(Long deptId);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public interface SysDictService extends IService<SysDict> {
|
||||
* @param code 字典编码
|
||||
* @return
|
||||
*/
|
||||
List<Option> listDictItemsByCode(String code);
|
||||
List<Option<Long>> listDictItemsByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,5 +77,5 @@ public interface SysDictService extends IService<SysDict> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Option> getDictList();
|
||||
List<Option<String>> getDictList();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface SysRoleService extends IService<SysRole> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Option> listRoleOptions();
|
||||
List<Option<Long>> listRoleOptions();
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.system.common.constant.SymbolConstant;
|
||||
import com.youlai.system.common.constant.SystemConstants;
|
||||
import com.youlai.system.enums.StatusEnum;
|
||||
import com.youlai.system.converter.DeptConverter;
|
||||
@@ -98,7 +99,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
* @return 部门下拉List集合
|
||||
*/
|
||||
@Override
|
||||
public List<Option> listDeptOptions() {
|
||||
public List<Option<Long>> listDeptOptions() {
|
||||
|
||||
List<SysDept> deptList = this.list(new LambdaQueryWrapper<SysDept>()
|
||||
.eq(SysDept::getStatus, StatusEnum.ENABLE.getValue())
|
||||
@@ -208,12 +209,12 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
* @param deptList 部门列表
|
||||
* @return 部门表格层级列表
|
||||
*/
|
||||
public static List<Option> recurDeptTreeOptions(long parentId, List<SysDept> deptList) {
|
||||
public static List<Option<Long>> recurDeptTreeOptions(long parentId, List<SysDept> deptList) {
|
||||
return CollectionUtil.emptyIfNull(deptList).stream()
|
||||
.filter(dept -> dept.getParentId().equals(parentId))
|
||||
.map(dept -> {
|
||||
Option option = new Option(dept.getId(), dept.getName());
|
||||
List<Option> children = recurDeptTreeOptions(dept.getId(), deptList);
|
||||
Option<Long> option = new Option<>(dept.getId(), dept.getName());
|
||||
List<Option<Long>> children = recurDeptTreeOptions(dept.getId(), deptList);
|
||||
if (CollectionUtil.isNotEmpty(children)) {
|
||||
option.setChildren(children);
|
||||
}
|
||||
@@ -233,7 +234,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
public boolean deleteByIds(String ids) {
|
||||
// 删除部门及子部门
|
||||
if (StrUtil.isNotBlank(ids)) {
|
||||
String[] menuIds = ids.split(",");
|
||||
String[] menuIds = ids.split(SymbolConstant.COMMA);
|
||||
for (String deptId : menuIds) {
|
||||
this.remove(new LambdaQueryWrapper<SysDept>()
|
||||
.eq(SysDept::getId, deptId)
|
||||
@@ -258,7 +259,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
} else {
|
||||
SysDept parent = this.getById(parentId);
|
||||
if (parent != null) {
|
||||
treePath = parent.getTreePath() + "," + parent.getId();
|
||||
treePath = parent.getTreePath() + SymbolConstant.COMMA + parent.getId();
|
||||
}
|
||||
}
|
||||
return treePath;
|
||||
|
||||
@@ -200,7 +200,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
* @param code 字典编码
|
||||
*/
|
||||
@Override
|
||||
public List<Option> listDictItemsByCode(String code) {
|
||||
public List<Option<Long>> listDictItemsByCode(String code) {
|
||||
// 根据字典编码获取字典ID
|
||||
SysDict dict = this.getOne(new LambdaQueryWrapper<SysDict>()
|
||||
.eq(SysDict::getCode, code)
|
||||
@@ -226,12 +226,12 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
* 获取字典列表
|
||||
*/
|
||||
@Override
|
||||
public List<Option> getDictList() {
|
||||
public List<Option<String>> getDictList() {
|
||||
return this.list(new LambdaQueryWrapper<SysDict>()
|
||||
.eq(SysDict::getStatus, 1)
|
||||
.select(SysDict::getName, SysDict::getCode)
|
||||
).stream()
|
||||
.map(dict -> new Option(dict.getCode(), dict.getName()))
|
||||
.map(dict -> new Option<>(dict.getCode(), dict.getName()))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,10 +256,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
entity.setParams(null);
|
||||
}
|
||||
if(menuType != MenuTypeEnum.BUTTON){
|
||||
Assert.isTrue(this.count(new LambdaQueryWrapper<SysMenu>()
|
||||
Assert.isFalse(this.exists(new LambdaQueryWrapper<SysMenu>()
|
||||
.eq(SysMenu::getRouteName, entity.getRouteName())
|
||||
.ne(menuForm.getId() != null, SysMenu::getId, menuForm.getId())
|
||||
) == 0, "路由名称已存在");
|
||||
), "路由名称已存在");
|
||||
}
|
||||
|
||||
boolean result = this.saveOrUpdate(entity);
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
* @return {@link List<Option>} – 角色下拉列表
|
||||
*/
|
||||
@Override
|
||||
public List<Option> listRoleOptions() {
|
||||
public List<Option<Long>> listRoleOptions() {
|
||||
// 查询数据
|
||||
List<SysRole> roleList = this.list(new LambdaQueryWrapper<SysRole>()
|
||||
.ne(!SecurityUtils.isRoot(), SysRole::getCode, SystemConstants.ROOT_ROLE_CODE)
|
||||
|
||||
Reference in New Issue
Block a user