Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
计算机应用开发
后
后端
J
Java
后台管理
Ruoyi Vue Pro
提交
fa62ace6
R
Ruoyi Vue Pro
项目概览
计算机应用开发
/
后端
/
Java
/
后台管理
/
Ruoyi Vue Pro
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Ruoyi Vue Pro
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fa62ace6
编写于
2月 23, 2022
作者:
公众号-芋道源码
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【修复】修复不支持根部门的问题
上级
95bb9744
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
7 deletion
+17
-7
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptBaseVO.java
...dule/system/controller/admin/dept/vo/dept/DeptBaseVO.java
+1
-2
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java
...der/yudao/module/system/service/dept/DeptServiceImpl.java
+12
-1
yudao-ui-admin/src/views/system/dept/index.vue
yudao-ui-admin/src/views/system/dept/index.vue
+4
-4
未找到文件。
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptBaseVO.java
浏览文件 @
fa62ace6
...
...
@@ -20,8 +20,7 @@ public class DeptBaseVO {
@Size
(
max
=
30
,
message
=
"部门名称长度不能超过30个字符"
)
private
String
name
;
@ApiModelProperty
(
value
=
"父菜单 ID"
,
required
=
true
,
example
=
"1024"
)
@NotNull
(
message
=
"父菜单 ID 不能为空"
)
@ApiModelProperty
(
value
=
"父菜单 ID"
,
example
=
"1024"
)
private
Long
parentId
;
@ApiModelProperty
(
value
=
"显示顺序不能为空"
,
required
=
true
,
example
=
"1024"
)
...
...
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java
浏览文件 @
fa62ace6
...
...
@@ -17,6 +17,7 @@ import com.google.common.collect.ImmutableMap;
import
com.google.common.collect.ImmutableMultimap
;
import
com.google.common.collect.Multimap
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -71,6 +72,10 @@ public class DeptServiceImpl implements DeptService {
@Resource
private
DeptProducer
deptProducer
;
@Resource
@Lazy
// 注入自己,所以延迟加载
private
DeptService
self
;
@Override
@PostConstruct
@TenantIgnore
// 初始化缓存,无需租户过滤
...
...
@@ -97,7 +102,7 @@ public class DeptServiceImpl implements DeptService {
@Scheduled
(
fixedDelay
=
SCHEDULER_PERIOD
,
initialDelay
=
SCHEDULER_PERIOD
)
public
void
schedulePeriodicRefresh
()
{
initLocalCache
();
self
.
initLocalCache
();
}
/**
...
...
@@ -124,6 +129,9 @@ public class DeptServiceImpl implements DeptService {
@Override
public
Long
createDept
(
DeptCreateReqVO
reqVO
)
{
// 校验正确性
if
(
reqVO
.
getParentId
()
==
null
)
{
reqVO
.
setParentId
(
DeptIdEnum
.
ROOT
.
getId
());
}
checkCreateOrUpdate
(
null
,
reqVO
.
getParentId
(),
reqVO
.
getName
());
// 插入部门
DeptDO
dept
=
DeptConvert
.
INSTANCE
.
convert
(
reqVO
);
...
...
@@ -136,6 +144,9 @@ public class DeptServiceImpl implements DeptService {
@Override
public
void
updateDept
(
DeptUpdateReqVO
reqVO
)
{
// 校验正确性
if
(
reqVO
.
getParentId
()
==
null
)
{
reqVO
.
setParentId
(
DeptIdEnum
.
ROOT
.
getId
());
}
checkCreateOrUpdate
(
reqVO
.
getId
(),
reqVO
.
getParentId
(),
reqVO
.
getName
());
// 更新部门
DeptDO
updateObj
=
DeptConvert
.
INSTANCE
.
convert
(
reqVO
);
...
...
yudao-ui-admin/src/views/system/dept/index.vue
浏览文件 @
fa62ace6
...
...
@@ -57,7 +57,7 @@
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"600px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-row>
<el-col
:span=
"24"
v-if=
"form.parentId !== 0"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"上级部门"
prop=
"parentId"
>
<treeselect
v-model=
"form.parentId"
:options=
"deptOptions"
:normalizer=
"normalizer"
placeholder=
"选择上级部门"
/>
</el-form-item>
...
...
@@ -152,9 +152,6 @@ export default {
form
:
{},
// 表单校验
rules
:
{
parentId
:
[
{
required
:
true
,
message
:
"
上级部门不能为空
"
,
trigger
:
"
blur
"
}
],
name
:
[
{
required
:
true
,
message
:
"
部门名称不能为空
"
,
trigger
:
"
blur
"
}
],
...
...
@@ -278,6 +275,9 @@ export default {
this
.
reset
();
getDept
(
row
.
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
if
(
this
.
form
.
parentId
===
0
)
{
// 无父部门时,标记为 undefined,避免展示为 Unknown
this
.
form
.
parentId
=
undefined
;
}
this
.
open
=
true
;
this
.
title
=
"
修改部门
"
;
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录