Merge branch 'master' of gitee.com:youlaiorg/youlai-boot
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +255,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
} else {
|
||||
entity.setParams(null);
|
||||
}
|
||||
if(menuType != MenuTypeEnum.BUTTON){
|
||||
Assert.isFalse(this.exists(new LambdaQueryWrapper<SysMenu>()
|
||||
.eq(SysMenu::getRouteName, entity.getRouteName())
|
||||
.ne(menuForm.getId() != null, SysMenu::getId, menuForm.getId())
|
||||
), "路由名称已存在");
|
||||
}
|
||||
|
||||
boolean result = this.saveOrUpdate(entity);
|
||||
if (result) {
|
||||
|
||||
@@ -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