Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzou
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzou
提交
79d5f090
提交
79d5f090
编写于
12月 25, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码表支持参数
上级
c6fa8e3e
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
116 行增加
和
69 行删除
+116
-69
OUCoreService.java
.../cn/ibizlab/core/ou/extensions/service/OUCoreService.java
+78
-0
OUCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/OUCoreResource.java
+38
-69
未找到文件。
ibzou-core/src/main/java/cn/ibizlab/core/ou/extensions/service/OUCoreService.java
浏览文件 @
79d5f090
...
@@ -7,11 +7,23 @@ import cn.ibizlab.core.ou.extensions.domain.*;
...
@@ -7,11 +7,23 @@ import cn.ibizlab.core.ou.extensions.domain.*;
import
cn.ibizlab.core.ou.extensions.mapping.SysDept2NodeMapping
;
import
cn.ibizlab.core.ou.extensions.mapping.SysDept2NodeMapping
;
import
cn.ibizlab.core.ou.extensions.mapping.SysEmp2NodeMapping
;
import
cn.ibizlab.core.ou.extensions.mapping.SysEmp2NodeMapping
;
import
cn.ibizlab.core.ou.extensions.mapping.SysOrg2NodeMapping
;
import
cn.ibizlab.core.ou.extensions.mapping.SysOrg2NodeMapping
;
import
cn.ibizlab.core.ou.filter.SysDepartmentSearchContext
;
import
cn.ibizlab.core.ou.filter.SysEmployeeSearchContext
;
import
cn.ibizlab.core.ou.filter.SysOrganizationSearchContext
;
import
cn.ibizlab.core.ou.service.ISysDepartmentService
;
import
cn.ibizlab.core.ou.service.ISysEmployeeService
;
import
cn.ibizlab.core.ou.service.ISysEmployeeService
;
import
cn.ibizlab.core.ou.service.ISysOrganizationService
;
import
cn.ibizlab.util.filter.QueryWrapperContext
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
import
java.util.*
;
...
@@ -333,4 +345,70 @@ public class OUCoreService
...
@@ -333,4 +345,70 @@ public class OUCoreService
}
}
}
}
@Autowired
private
ISysOrganizationService
iibzOrganizationService
;
@Autowired
private
ISysDepartmentService
iibzDepartmentService
;
@Cacheable
(
value
=
"ibzou-model"
,
key
=
"'catalog:'+#p0"
)
public
JSONObject
getItems
(
String
catalog
)
{
return
getItems
(
catalog
,
null
);
}
public
JSONObject
getItems
(
String
catalog
,
QueryWrapperContext
context
)
{
JSONObject
jo
=
new
JSONObject
();
jo
.
put
(
"srfkey"
,
catalog
);
jo
.
put
(
"emptytext"
,
""
);
List
<
JSONObject
>
list
=
new
ArrayList
<>();
if
(
"IbzouOrg"
.
equalsIgnoreCase
(
catalog
))
{
QueryWrapper
<
SysOrganization
>
queryWrapper
=
context
==
null
?
Wrappers
.
query
():
context
.
getSelectCond
();
queryWrapper
.
orderByAsc
(
"showorder"
);
iibzOrganizationService
.
list
(
queryWrapper
).
forEach
(
item
->
{
JSONObject
option
=
new
JSONObject
();
option
.
put
(
"id"
,
item
.
getOrgid
());
option
.
put
(
"value"
,
item
.
getOrgid
());
option
.
put
(
"label"
,
item
.
getOrgname
());
option
.
put
(
"text"
,
item
.
getOrgname
());
list
.
add
(
option
);
});
}
else
if
(
"IbzouDept"
.
equalsIgnoreCase
(
catalog
)||
"IbzouOrgSector"
.
equalsIgnoreCase
(
catalog
))
{
QueryWrapper
<
SysDepartment
>
queryWrapper
=
context
==
null
?
Wrappers
.
query
():
context
.
getSelectCond
();
queryWrapper
.
orderByAsc
(
"showorder"
);
iibzDepartmentService
.
list
(
queryWrapper
).
forEach
(
item
->
{
JSONObject
option
=
new
JSONObject
();
option
.
put
(
"id"
,
item
.
getDeptid
());
option
.
put
(
"value"
,
item
.
getDeptid
());
option
.
put
(
"label"
,
item
.
getDeptname
());
option
.
put
(
"text"
,
item
.
getDeptname
());
option
.
put
(
"filter"
,
item
.
getOrgid
());
list
.
add
(
option
);
});
}
else
if
(
"IbzouUser"
.
equalsIgnoreCase
(
catalog
)||
"IbzouOperator"
.
equalsIgnoreCase
(
catalog
)||
"IbzouEmp"
.
equalsIgnoreCase
(
catalog
)||
"IbzouPerson"
.
equalsIgnoreCase
(
catalog
))
{
QueryWrapper
<
SysEmployee
>
queryWrapper
=
context
==
null
?
Wrappers
.
query
():
context
.
getSelectCond
();
queryWrapper
.
orderByAsc
(
"showorder"
);
iibzEmployeeService
.
list
(
queryWrapper
).
forEach
(
item
->
{
JSONObject
option
=
new
JSONObject
();
option
.
put
(
"id"
,
item
.
getUserid
());
option
.
put
(
"value"
,
item
.
getUserid
());
option
.
put
(
"label"
,
item
.
getPersonname
());
option
.
put
(
"text"
,
item
.
getPersonname
());
option
.
put
(
"code"
,
item
.
getUsercode
());
option
.
put
(
"name"
,
item
.
getUsername
());
option
.
put
(
"filter"
,
item
.
getOrgid
());
list
.
add
(
option
);
});
}
jo
.
put
(
"items"
,
list
);
return
jo
;
}
}
}
ibzou-provider/ibzou-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/OUCoreResource.java
浏览文件 @
79d5f090
...
@@ -5,11 +5,22 @@ import cn.ibizlab.core.ou.domain.SysEmployee;
...
@@ -5,11 +5,22 @@ import cn.ibizlab.core.ou.domain.SysEmployee;
import
cn.ibizlab.core.ou.domain.SysOrganization
;
import
cn.ibizlab.core.ou.domain.SysOrganization
;
import
cn.ibizlab.core.ou.extensions.domain.*
;
import
cn.ibizlab.core.ou.extensions.domain.*
;
import
cn.ibizlab.core.ou.extensions.service.OUCoreService
;
import
cn.ibizlab.core.ou.extensions.service.OUCoreService
;
import
cn.ibizlab.core.ou.filter.SysDepartmentSearchContext
;
import
cn.ibizlab.core.ou.filter.SysEmployeeSearchContext
;
import
cn.ibizlab.core.ou.filter.SysOrganizationSearchContext
;
import
cn.ibizlab.core.ou.service.ISysDepartmentService
;
import
cn.ibizlab.core.ou.service.ISysDepartmentService
;
import
cn.ibizlab.core.ou.service.ISysEmployeeService
;
import
cn.ibizlab.core.ou.service.ISysEmployeeService
;
import
cn.ibizlab.core.ou.service.ISysOrganizationService
;
import
cn.ibizlab.core.ou.service.ISysOrganizationService
;
import
cn.ibizlab.util.domain.DTOBase
;
import
cn.ibizlab.util.domain.EntityBase
;
import
cn.ibizlab.util.filter.QueryWrapperContext
;
import
cn.ibizlab.util.filter.SearchContextBase
;
import
cn.ibizlab.util.helper.DataObject
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
...
@@ -187,99 +198,57 @@ public class OUCoreResource
...
@@ -187,99 +198,57 @@ public class OUCoreResource
@Cacheable
(
value
=
"ibzou-model"
,
key
=
"'catalog:'+#p0"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/dictionarys/catalogs/Ibzou{catalog}"
,
"/dictionarys/codelist/Ibzou{catalog}"
})
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictionarys/catalogs/Ibzou{catalog}"
)
public
ResponseEntity
<
JSONObject
>
getCodeList
(
@PathVariable
(
"catalog"
)
String
catalog
,
SearchContextBase
context
)
{
public
ResponseEntity
<
JSONObject
>
getCatalog
(
@PathVariable
(
"catalog"
)
String
catalog
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
getItems
(
"Ibzou"
+
catalog
,
context
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
getItems
(
"Ibzou"
+
catalog
));
}
}
@Cacheable
(
value
=
"ibzou-model"
,
key
=
"'codelist:'+#p0"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictionarys/codelist/Ibzou{catalog}"
)
public
ResponseEntity
<
JSONObject
>
getCodeList
(
@PathVariable
(
"catalog"
)
String
catalog
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
getItems
(
"Ibzou"
+
catalog
));
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictionarys/catalogs/Ibzou{code}/options"
)
@RequestMapping
(
method
=
{
RequestMethod
.
GET
},
value
=
{
"/dictionarys/catalogs/Ibzou{code}/options"
,
"/dictionarys/codelist/Ibzou{code}/items"
}
)
public
ResponseEntity
<
List
>
get
Options
(
@PathVariable
(
"code"
)
String
code
)
{
public
ResponseEntity
<
List
>
get
CodeItems
(
@PathVariable
(
"code"
)
String
code
,
SearchContextBase
context
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
((
List
)
getItems
(
"Ibzou"
+
code
).
get
(
"items"
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
((
List
)
getItems
(
"Ibzou"
+
code
,
context
).
get
(
"items"
));
}
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictionarys/codelist/Ibzou{code}/items"
)
public
ResponseEntity
<
List
>
getCodeItems
(
@PathVariable
(
"code"
)
String
code
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
((
List
)
getItems
(
"Ibzou"
+
code
).
get
(
"items"
));
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictionarys/catalogs/Ibzou{code}/options"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/dictionarys/catalogs/Ibzou{catalog}"
,
"/dictionarys/codelist/Ibzou{catalog}"
}
)
public
ResponseEntity
<
List
>
getOptions
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
List
<
String
>
values
)
{
public
ResponseEntity
<
JSONObject
>
codeList
(
@PathVariable
(
"catalog"
)
String
catalog
,
@RequestBody
(
required
=
false
)
SearchContextBase
context
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
(
List
)
getItems
(
"Ibzou"
+
code
,
values
).
get
(
"items"
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
getItems
(
"Ibzou"
+
catalog
,
context
));
}
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictionarys/codelist/Ibzou{code}/items"
)
public
ResponseEntity
<
List
>
getCodeItems
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
List
<
String
>
values
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
((
List
)
getItems
(
"Ibzou"
+
code
,
values
).
get
(
"items"
));
}
public
JSONObject
getItems
(
String
catalog
)
{
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
{
"/dictionarys/catalogs/Ibzou{code}/options"
,
"/dictionarys/codelist/Ibzou{code}/items"
})
return
getItems
(
catalog
,
null
);
public
ResponseEntity
<
List
>
codeItems
(
@PathVariable
(
"code"
)
String
code
,
@RequestBody
(
required
=
false
)
SearchContextBase
context
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
((
List
)
getItems
(
"Ibzou"
+
code
,
context
).
get
(
"items"
));
}
}
public
JSONObject
getItems
(
String
catalog
,
List
<
String
>
values
)
{
JSONObject
jo
=
new
JSONObject
();
jo
.
put
(
"srfkey"
,
catalog
);
jo
.
put
(
"emptytext"
,
""
);
List
<
JSONObject
>
list
=
new
ArrayList
<>();
public
JSONObject
getItems
(
String
catalog
,
SearchContextBase
context
)
{
QueryWrapperContext
searchContext
=
null
;
if
(
"IbzouOrg"
.
equalsIgnoreCase
(
catalog
))
if
(
"IbzouOrg"
.
equalsIgnoreCase
(
catalog
))
{
{
LambdaQueryWrapper
<
SysOrganization
>
queryWrapper
=
Wrappers
.<
SysOrganization
>
lambdaQuery
();
if
(
context
!=
null
)
if
(!
ObjectUtils
.
isEmpty
(
values
))
searchContext
=
JSON
.
toJavaObject
((
JSONObject
)
JSON
.
toJSON
(
context
.
getParams
()),
SysOrganizationSearchContext
.
class
);
queryWrapper
.
in
(
SysOrganization:
:
getOrgid
,
values
);
queryWrapper
.
orderByAsc
(
SysOrganization:
:
getShoworder
);
iibzOrganizationService
.
list
(
queryWrapper
).
forEach
(
item
->
{
JSONObject
option
=
new
JSONObject
();
option
.
put
(
"id"
,
item
.
getOrgid
());
option
.
put
(
"value"
,
item
.
getOrgid
());
option
.
put
(
"label"
,
item
.
getOrgname
());
option
.
put
(
"text"
,
item
.
getOrgname
());
list
.
add
(
option
);
});
}
}
else
if
(
"IbzouDept"
.
equalsIgnoreCase
(
catalog
)||
"IbzouOrgSector"
.
equalsIgnoreCase
(
catalog
))
else
if
(
"IbzouDept"
.
equalsIgnoreCase
(
catalog
)||
"IbzouOrgSector"
.
equalsIgnoreCase
(
catalog
))
{
{
LambdaQueryWrapper
<
SysDepartment
>
queryWrapper
=
Wrappers
.<
SysDepartment
>
lambdaQuery
();
if
(
context
!=
null
)
if
(!
ObjectUtils
.
isEmpty
(
values
))
searchContext
=
JSON
.
toJavaObject
((
JSONObject
)
JSON
.
toJSON
(
context
),
SysDepartmentSearchContext
.
class
);
queryWrapper
.
in
(
SysDepartment:
:
getDeptid
,
values
);
queryWrapper
.
orderByAsc
(
SysDepartment:
:
getShoworder
);
iibzDepartmentService
.
list
(
queryWrapper
).
forEach
(
item
->
{
JSONObject
option
=
new
JSONObject
();
option
.
put
(
"id"
,
item
.
getDeptid
());
option
.
put
(
"value"
,
item
.
getDeptid
());
option
.
put
(
"label"
,
item
.
getDeptname
());
option
.
put
(
"text"
,
item
.
getDeptname
());
list
.
add
(
option
);
});
}
}
else
if
(
"IbzouUser"
.
equalsIgnoreCase
(
catalog
)||
"IbzouOperator"
.
equalsIgnoreCase
(
catalog
)||
"IbzouEmp"
.
equalsIgnoreCase
(
catalog
)||
"IbzouPerson"
.
equalsIgnoreCase
(
catalog
))
else
if
(
"IbzouUser"
.
equalsIgnoreCase
(
catalog
)||
"IbzouOperator"
.
equalsIgnoreCase
(
catalog
)||
"IbzouEmp"
.
equalsIgnoreCase
(
catalog
)||
"IbzouPerson"
.
equalsIgnoreCase
(
catalog
))
{
{
LambdaQueryWrapper
<
SysEmployee
>
queryWrapper
=
Wrappers
.<
SysEmployee
>
lambdaQuery
();
if
(
context
!=
null
)
if
(!
ObjectUtils
.
isEmpty
(
values
))
searchContext
=
JSON
.
toJavaObject
((
JSONObject
)
JSON
.
toJSON
(
context
),
SysEmployeeSearchContext
.
class
);
queryWrapper
.
in
(
SysEmployee:
:
getUserid
,
values
);
queryWrapper
.
orderByAsc
(
SysEmployee:
:
getShoworder
);
iibzEmployeeService
.
list
(
queryWrapper
).
forEach
(
item
->
{
JSONObject
option
=
new
JSONObject
();
option
.
put
(
"id"
,
item
.
getUserid
());
option
.
put
(
"value"
,
item
.
getUserid
());
option
.
put
(
"label"
,
item
.
getPersonname
());
option
.
put
(
"text"
,
item
.
getPersonname
());
list
.
add
(
option
);
});
}
}
if
(
searchContext
==
null
||
StringUtils
.
isEmpty
(
searchContext
.
getSelectCond
().
getSqlSegment
()))
return
ouCoreService
.
getItems
(
catalog
);
else
return
ouCoreService
.
getItems
(
catalog
,
searchContext
);
jo
.
put
(
"items"
,
list
);
return
jo
;
}
}
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录