Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
37899421
提交
37899421
编写于
6月 10, 2020
作者:
ibiz4j
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'dev' 到 'master'
Dev 查看合并请求
!9
上级
1c596b5c
f66a1bfb
变更
21
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
1011 行增加
和
71 行删除
+1011
-71
%PUBPRJ%-app-%APP_PKGPATH%.yaml.ftl
...PATH%/src/main/docker/%PUBPRJ%-app-%APP_PKGPATH%.yaml.ftl
+10
-0
application-%APP_PKGPATH%-prod.yml.ftl
...src/main/resources/application-%APP_PKGPATH%-prod.yml.ftl
+4
-0
application-dev.yml.ftl
SLN/%PUBPRJ%-boot/src/main/resources/application-dev.yml.ftl
+4
-0
pom.xml.ftl
SLN/%PUBPRJ%-core/pom.xml.ftl
+1
-1
%DE%.java.ftl
...ava/%SYS_PKGPATH%/core/%MOD_PKGPATH%/domain/%DE%.java.ftl
+135
-1
%DE%SearchContext.java.ftl
...ATH%/core/%MOD_PKGPATH%/filter/%DE%SearchContext.java.ftl
+28
-28
%DE%InheritMapping.java.ftl
...H%/core/%MOD_PKGPATH%/mapping/%DE%InheritMapping.java.ftl
+94
-0
%DE%ServiceImpl.java.ftl
.../core/%MOD_PKGPATH%/service/impl/%DE%ServiceImpl.java.ftl
+60
-0
MybatisConfiguration.java.ftl
...S_PKGPATH%/core/util/config/MybatisConfiguration.java.ftl
+1
-0
${de.codeName}Mapper.xml.ftl
...r/%MOD_PKGPATH%/%DE_PKGPATH%/${de.codeName}Mapper.xml.ftl
+5
-1
pom.xml.ftl
SLN/%PUBPRJ%-dependencies/pom.xml.ftl
+36
-17
%PUBPRJ%-provider-%SYSAPI_PKGPATH%.yaml.ftl
...c/main/docker/%PUBPRJ%-provider-%SYSAPI_PKGPATH%.yaml.ftl
+11
-1
SwaggerConfiguration.java.ftl
.../java/%SYS_PKGPATH%/swagger/SwaggerConfiguration.java.ftl
+2
-0
DEFieldDefaultValueAspect.java.ftl
...S_PKGPATH%/util/aspect/DEFieldDefaultValueAspect.java.ftl
+1
-1
DEPredefinedFieldType.java.ftl
...a/%SYS_PKGPATH%/util/enums/DEPredefinedFieldType.java.ftl
+4
-0
QueryBuildContext.java.ftl
...java/%SYS_PKGPATH%/util/filter/QueryBuildContext.java.ftl
+163
-0
QueryFilter.java.ftl
.../main/java/%SYS_PKGPATH%/util/filter/QueryFilter.java.ftl
+273
-0
QueryWrapperContext.java.ftl
...va/%SYS_PKGPATH%/util/filter/QueryWrapperContext.java.ftl
+148
-4
SearchContextBase.java.ftl
...java/%SYS_PKGPATH%/util/filter/SearchContextBase.java.ftl
+6
-4
AppController.java.ftl
.../main/java/%SYS_PKGPATH%/util/rest/AppController.java.ftl
+7
-5
IBZConfigService.java.ftl
...java/%SYS_PKGPATH%/util/service/IBZConfigService.java.ftl
+18
-8
未找到文件。
SLN/%PUBPRJ%-app/%PUBPRJ%-app-%APP_PKGPATH%/src/main/docker/%PUBPRJ%-app-%APP_PKGPATH%.yaml.ftl
浏览文件 @
37899421
...
@@ -102,6 +102,16 @@ services:
...
@@ -102,6 +102,16 @@ services:
memory: 256M
memory: 256M
mode: replicated
mode: replicated
replicas: 1
replicas: 1
volumes:
- "nfs:/app/file"
volumes:
nfs:
driver: local
driver_opts:
type: "nfs"
o: "addr=172.16.240.109,rw"
device: ":/nfs"
networks:
networks:
agent_network:
agent_network:
...
...
SLN/%PUBPRJ%-app/%PUBPRJ%-app-%APP_PKGPATH%/src/main/resources/application-%APP_PKGPATH%-prod.yml.ftl
浏览文件 @
37899421
...
@@ -53,6 +53,10 @@ zuul:
...
@@ -53,6 +53,10 @@ zuul:
path: /v7/login
path: /v7/login
serviceId: ibzuaa-api
serviceId: ibzuaa-api
stripPrefix: false
stripPrefix: false
uaa:
path: /uaa/**
serviceId: ibzuaa-api
stripPrefix: false
<#if sys.getCodeName()!='ibzou' && sys.getCodeName()!='ibzrt'>
<#if sys.getCodeName()!='ibzou' && sys.getCodeName()!='ibzrt'>
oucore:
oucore:
path: /ibzorganizations/**
path: /ibzorganizations/**
...
...
SLN/%PUBPRJ%-boot/src/main/resources/application-dev.yml.ftl
浏览文件 @
37899421
...
@@ -69,6 +69,10 @@ zuul:
...
@@ -69,6 +69,10 @@ zuul:
path: /v7/login
path: /v7/login
serviceId: ibzuaa-api
serviceId: ibzuaa-api
stripPrefix: false
stripPrefix: false
uaa:
path: /uaa/**
serviceId: ibzuaa-api
stripPrefix: false
<#if sys.getCodeName()!='ibzou' && sys.getCodeName()!='ibzrt'>
<#if sys.getCodeName()!='ibzou' && sys.getCodeName()!='ibzrt'>
oucore:
oucore:
path: /ibzorganizations/**
path: /ibzorganizations/**
...
...
SLN/%PUBPRJ%-core/pom.xml.ftl
浏览文件 @
37899421
...
@@ -159,7 +159,7 @@ TARGET=PSSYSTEM
...
@@ -159,7 +159,7 @@ TARGET=PSSYSTEM
<verbose>true</verbose>
<verbose>true</verbose>
<logging>debug</logging>
<logging>debug</logging>
<contexts>!test</contexts>
<contexts>!test</contexts>
<diffExcludeObjects>Index:.*,table:ibzfile,ibzuser,ibzdataaudit,
IBZFILE,IBZUSER,IBZDATAAUDIT
</diffExcludeObjects>
<diffExcludeObjects>Index:.*,table:ibzfile,ibzuser,ibzdataaudit,
ibzcfg,IBZFILE,IBZUSER,IBZDATAAUDIT,IBZCFG
</diffExcludeObjects>
</configuration>
</configuration>
<phase>process-resources</phase>
<phase>process-resources</phase>
<goals>
<goals>
...
...
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/domain/%DE%.java.ftl
浏览文件 @
37899421
...
@@ -94,7 +94,11 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
...
@@ -94,7 +94,11 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
</#
if
>
</#
if
>
<#
comment
>
主键
</#
comment
>
<#
comment
>
主键
</#
comment
>
<#
if
defield
.
isKeyDEField
()==
true
>
<#
if
defield
.
isKeyDEField
()==
true
>
<#
if
defield
.
getDataType
()
==
"ACID"
>
@
TableId
(
value
=
"${columnname}"
,
type
=
IdType
.
AUTO
)
<#
else
>
@
TableId
(
value
=
"${columnname}"
,
type
=
IdType
.
UUID
)
@
TableId
(
value
=
"${columnname}"
,
type
=
IdType
.
UUID
)
</#
if
>
<#
elseif
defield
.
isPhisicalDEField
()==
false
>
<#
elseif
defield
.
isPhisicalDEField
()==
false
>
@
TableField
(
exist
=
false
)
@
TableField
(
exist
=
false
)
<#
elseif
defield
.
getPredefinedType
??
&&
defield
.
getPredefinedType
()??
&&
defield
.
getPredefinedType
()?
lower_case
==
'logicvalid'
>
<#
elseif
defield
.
getPredefinedType
??
&&
defield
.
getPredefinedType
()??
&&
defield
.
getPredefinedType
()?
lower_case
==
'logicvalid'
>
...
@@ -418,7 +422,7 @@ public class ${item.getCodeName()} extends EntityMongo implements Serializable {
...
@@ -418,7 +422,7 @@ public class ${item.getCodeName()} extends EntityMongo implements Serializable {
}
}
<#
comment
>
Api
存储
</#
comment
>
<#
comment
>
Api
存储
</#
comment
>
<#
elseif
de
.
getStorageMode
()==
4
||
de
.
getStorageMode
()==
0
>
<#
elseif
de
.
getStorageMode
()==
4
>
import
${
pub
.
getPKGCodeName
()}.
util
.
domain
.
EntityClient
;
import
${
pub
.
getPKGCodeName
()}.
util
.
domain
.
EntityClient
;
/**
/**
...
@@ -565,6 +569,136 @@ public class ${item.getCodeName()} extends EntityClient implements Serializable
...
@@ -565,6 +569,136 @@ public class ${item.getCodeName()} extends EntityClient implements Serializable
</#
if
>
</#
if
>
}
}
<#
comment
>
无存储
</#
comment
>
<#
elseif
de
.
getStorageMode
()==
0
>
/**
*
[${
item
.
getLogicName
()}]
对象
*/
@
Builder
@
Getter
@
Setter
@
NoArgsConstructor
@
AllArgsConstructor
public
class
${
item
.
getCodeName
()}
extends
EntityBase
implements
Serializable
{
<#
if
de
.
getPSDEFields
()??>
<#
comment
>
输出实体属性
</#
comment
>
<#
list
de
.
getPSDEFields
()
as
defield
>
<#
assign
defDataType
=
(
defield
.
getDataType
())
!"">
<#
if
defDataType
!='ONE2MANYDATA'>
<#
assign
columnname
=
defield
.
getName
()?
lower_case
>
<#
assign
prvateCodeName
=
srfcaseformat
(
defield
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
publicCodeName
=
prvateCodeName
?
cap_first
>
<#
assign
jsonfield
=
defield
.
getCodeName
()?
lower_case
>
<#
if
de
.
getStorageMode
()==
0
><#
assign
jsonfield
=
defield
.
getCodeName
()?
uncap_first
></#
if
>
<#
assign
defieldano
=
""
>
<#
if
prvateCodeName
?
lower_case
!= columnname>
<#
assign
defieldano
=
"name =
\"
"
+
columnname
+
"
\"
"
>
</#
if
>
<#
if
defield
.
getDefaultValue
()??
&&
defield
.
getDefaultValue
()
!=''>
<#
assign
defieldano
=
"defaultValue =
\"
"
+
defield
.
getDefaultValue
()+
"
\"
"
>
</#
if
>
<#
if
defield
.
getDefaultValueType
()??
&&
defield
.
getDefaultValueType
()
!=''>
<#
if
defieldano
??
&&
defieldano
!=''>
<#
assign
defieldano
=
defieldano
+
" , "
>
</#
if
>
<#
assign
defieldano
=
defieldano
+
"defaultValueType = DEFieldDefaultValueType."
+
defield
.
getDefaultValueType
()?
upper_case
>
</#
if
>
<#
if
defield
.
isKeyDEField
()==
true
>
<#
if
defieldano
??
&&
defieldano
!=''>
<#
assign
defieldano
=
defieldano
+
" , "
>
</#
if
>
<#
assign
defieldano
=
defieldano
+
"isKeyField=true"
>
<#
elseif
defield
.
getPredefinedType
()??
&&
defield
.
getPredefinedType
()
!=''>
<#
if
defieldano
??
&&
defieldano
!=''>
<#
assign
defieldano
=
defieldano
+
" , "
>
</#
if
>
<#
assign
defieldano
=
defieldano
+
"preType = DEPredefinedFieldType."
+
defield
.
getPredefinedType
()?
upper_case
>
<#
if
defield
.
getPredefinedType
()?
lower_case
==
'logicvalid'
>
<#
if
de
.
getLogicValidPSDEField
()??
&&
de
.
isLogicValid
()==
true
>
<#
assign
defieldano
=
defieldano
+
", logicval =
\"
"
+((
item
.
getValidLogicValue
())
!'1')+"\" , logicdelval=\""+((item.getInvalidLogicValue())!'0')+"\"">
</#
if
>
</#
if
>
</#
if
>
/**
*
${
defield
.
getLogicName
()}
*/
<#
comment
>
属性默认值
</#
comment
>
<#
if
defieldano
??
&&
defieldano
!='' && defield.isPhisicalDEField()==true>
@
DEField
(${
defieldano
})
</#
if
>
<#
assign
defDataType
=
(
defield
.
getDataType
())
!"">
<#
if
defDataType
==
"DATETIME"
||
(
defDataType
==
'PICKUPDATA'
&&
srfdatatype
(
defield
.
getStdDataType
())==
"DATETIME"
&&
defield
.
getValueFormat
()==
"%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS"
)>
@
JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@
JSONField
(
name
=
"${jsonfield}"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
<#
elseif
defDataType
==
"DATE"
||
(
defDataType
==
'PICKUPDATA'
&&
srfdatatype
(
defield
.
getStdDataType
())==
"DATETIME"
&&
defield
.
getValueFormat
()==
"%1$tY-%1$tm-%1$td"
)>
@
JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@
JSONField
(
name
=
"${jsonfield}"
,
format
=
"yyyy-MM-dd"
)
<#
elseif
defDataType
==
"TIME"
||
(
defDataType
==
'PICKUPDATA'
&&
srfdatatype
(
defield
.
getStdDataType
())==
"DATETIME"
&&
defield
.
getValueFormat
()==
"%1$tH:%1$tM:%1$tS"
)>
@
JsonFormat
(
pattern
=
"HH:mm"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@
JSONField
(
name
=
"${jsonfield}"
,
format
=
"HH:mm"
)
<#
else
>
@
JSONField
(
name
=
"${jsonfield}"
)
</#
if
>
@
JsonProperty
(
"${jsonfield}"
)
private
${
srfjavatype
(
defield
.
getStdDataType
())}
${
prvateCodeName
};
</#
if
>
</#
list
>
<#
comment
>
创建
1
:
N
关系实体
-
输出主实体
</#
comment
>
<#
if
item
.
getMinorPSDERs
??
&&
item
.
getMinorPSDERs
()??>
<#
list
item
.
getMinorPSDERs
()
as
MinorPSDER
>
<#
if
MinorPSDER
??
&&
MinorPSDER
.
getDERType
()==
'DER1N'
>
<#
if
MinorPSDER
.
getMajorPSDataEntity
??
&&
MinorPSDER
.
getMajorPSDataEntity
()??
&&
MinorPSDER
.
getCodeName
??
&&
MinorPSDER
.
getCodeName
()??>
<#
assign
MajorEntity
=
MinorPSDER
.
getMajorPSDataEntity
()>
<#
if
MajorEntity
.
getCodeName
??
&&
MinorPSDER
.
getCodeName
()??
>
/**
*
${
MinorPSDER
.
getLogicName
()}
*/
@
JSONField
(
name
=
"${srfcaseformat(MinorPSDER.getCodeName(),'l_u2lC')?lower_case}"
)
@
JsonProperty
(
"${srfcaseformat(MinorPSDER.getCodeName(),'l_u2lC')?lower_case}"
)
private
${
pub
.
getPKGCodeName
()}.
core
.${
MajorEntity
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
domain
.${
MajorEntity
.
getCodeName
()}
${
srfcaseformat
(
MinorPSDER
.
getCodeName
(),
'l_u2lC'
)};
</#
if
>
</#
if
>
</#
if
>
</#
list
>
</#
if
>
<#
comment
>
输出关系数据(子实体)
</#
comment
>
<#
if
de
.
getMajorPSDERs
()??>
<#
list
de
.
getMajorPSDERs
()
as
der
>
<#
if
der
.
getDERType
()
==
'DER1N'
>
<#
assign
listcode
=(
der
.
getMinorCodeName
()
!der.getMinorPSDataEntity().getCodeName())>
<#
if
listcode
??
&&
listcode
==
''
><#
assign
listcode
=
der
.
getMinorPSDataEntity
().
getCodeName
()></#
if
>
<#
assign
subDTOs
=
srfpluralize
(
listcode
)?
lower_case
>
<#
assign
nested
=
der
.
isNestedRS
()>
<#
if
nested
==
false
&&
der
.
getMinorPSDataEntity
().
getAllPSDEServiceAPIs
()??>
<#
list
der
.
getMinorPSDataEntity
().
getAllPSDEServiceAPIs
()
as
api
>
<#
if
api
.
isNested
()>
<#
assign
nested
=
true
>
</#
if
>
</#
list
>
</#
if
>
<#
if
nested
>
/**
*
${
der
.
getMinorPSDataEntity
().
getLogicName
()}
*/
@
JSONField
(
name
=
"${subDTOs}"
)
@
JsonProperty
(
"${subDTOs}"
)
private
List
<${
pub
.
getPKGCodeName
()}.
core
.${
der
.
getMinorPSDataEntity
().
getPSSystemModule
().
getCodeName
()?
lower_case
}.
domain
.${
der
.
getMinorPSDataEntity
().
getCodeName
()}>
${
srfcaseformat
(
listcode
,
'l_u2lC'
)};
</#
if
>
</#
if
>
</#
list
>
</#
if
>
</#
if
>
}
</#
if
>
</#
if
>
<#
comment
>
获取联合主键:返回值
String
.
format
(
"%s||%s"
,
this
.
getHumanid
(),
this
.
getHumanname
()
</#
comment
>
<#
comment
>
获取联合主键:返回值
String
.
format
(
"%s||%s"
,
this
.
getHumanid
(),
this
.
getHumanname
()
</#
comment
>
...
...
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/filter/%DE%SearchContext.java.ftl
浏览文件 @
37899421
此差异已折叠。
点击以展开。
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/mapping/%DE%InheritMapping.java.ftl
0 → 100644
浏览文件 @
37899421
<#
ibiztemplate
>
TARGET
=
PSDATAENTITY
</#
ibiztemplate
>
<#
comment
>
索引从实体
</#
comment
>
<#
assign
isIndexSubDE
=
false
>
<#
if
de
.
getMinorPSDERs
()??>
<#
comment
>
判断当前实体是否为索引子实体或继承子实体
</#
comment
>
<#
assign
isIndexSubDE
=
false
>
<#
if
de
.
getMinorPSDERs
()??>
<#
list
de
.
getMinorPSDERs
()
as
MinorPSDER
>
<#
if
MinorPSDER
.
getDERType
()??
&&
MinorPSDER
.
getMajorPSDataEntity
()??>
<#
comment
>
继承关系、索引关系
(
包含分组属性
)</#
comment
>
<#
if
MinorPSDER
.
getDERType
()==
"DERINHERIT"
||
(
MinorPSDER
.
getDERType
()==
"DERINDEX"
)
&&
MinorPSDER
.
getMajorPSDataEntity
().
getIndexTypePSDEField
()??>
<#
assign
isIndexSubDE
=
true
>
<#
assign
indexPSDER
=
MinorPSDER
>
<#
break
>
</#
if
>
</#
if
>
</#
list
>
</#
if
>
<#
if
isIndexSubDE
&&
indexPSDER
??>
<#
comment
>
索引主实体
</#
comment
>
<#
assign
majorIndexDE
=
indexPSDER
.
getMajorPSDataEntity
()>
<#
assign
majorIndexDECodeName
=
indexPSDER
.
getMajorPSDataEntity
().
codeName
>
<#
assign
majorIndexDECodeNameCamel
=
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)?
cap_first
>
<#
assign
majorIndexDEKeyFieldCodeName
=
srfcaseformat
(
majorIndexDE
.
getKeyPSDEField
().
codeName
,
'l_u2lC'
)>
<#
assign
majorIndexDEMajorTextFieldCodeName
=
srfcaseformat
(
majorIndexDE
.
getMajorPSDEField
().
codeName
,
'l_u2lC'
)>
<#
assign
MinorIndexDECodeName
=
de
.
codeName
>
<#
assign
MinorIndexDECodeNameCamel
=
srfcaseformat
(
MinorIndexDECodeName
,
'l_u2lC'
)?
cap_first
>
<#
assign
MinorIndexDEKeyFieldCodeName
=
srfcaseformat
(
de
.
getKeyPSDEField
().
codeName
,
'l_u2lC'
)>
<#
assign
MinorIndexDEMajorTextFieldCodeName
=
srfcaseformat
(
de
.
getMajorPSDEField
().
codeName
,
'l_u2lC'
)>
package
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
codeName
?
lower_case
}.
mapping
;
import
org
.
mapstruct
.*;
import
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
domain
.${
de
.
codeName
};
import
${
pub
.
getPKGCodeName
()}.
core
.${
majorIndexDE
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
domain
.${
majorIndexDE
.
codeName
};
import
java
.
util
.
List
;
@
Mapper
(
componentModel
=
"spring"
,
uses
=
{})
public
interface
${
de
.
codeName
}
InheritMapping
{
@
Mappings
({
@
Mapping
(
source
=
"${MinorIndexDEKeyFieldCodeName}"
,
target
=
"${majorIndexDEKeyFieldCodeName}"
),
@
Mapping
(
source
=
"${MinorIndexDEMajorTextFieldCodeName}"
,
target
=
"${majorIndexDEMajorTextFieldCodeName}"
),
@
Mapping
(
target
=
"focusNull"
,
ignore
=
true
),
<#
if
indexPSDER
.
getPSDERIndexDEFieldMaps
??
&&
indexPSDER
.
getPSDERIndexDEFieldMaps
()??>
<#
list
indexPSDER
.
getPSDERIndexDEFieldMaps
()
as
indexFieldmapping
>
<#
comment
>
排除主键及主文本属性
</#
comment
>
<#
if
indexFieldmapping
.
getMajorPSDEField
()??
&&
indexFieldmapping
.
getMinorPSDEField
()??>
<#
assign
majorDEField
=
indexFieldmapping
.
getMajorPSDEField
()>
<#
assign
MinorDEField
=
indexFieldmapping
.
getMinorPSDEField
()>
<#
if
majorDEField
.
isKeyDEField
()==
false
&&
MinorDEField
.
isKeyDEField
()==
false
&&
majorDEField
.
isMajorDEField
()==
false
&&
MinorDEField
.
isMajorDEField
()==
false
>
<#
if
!P.exists(MinorDEField.codeName,majorDEField.codeName)>
@
Mapping
(
source
=
"${srfcaseformat(MinorDEField.codeName,'l_u2lC')}"
,
target
=
"${srfcaseformat(majorDEField.codeName,'l_u2lC')}"
),
</#
if
>
</#
if
>
</#
if
>
</#
list
>
</#
if
>
})
${
majorIndexDECodeName
}
to
${
majorIndexDECodeNameCamel
}(${
MinorIndexDECodeName
}
${
MinorIndexDECodeName
?
lower_case
});
@
Mappings
({
@
Mapping
(
source
=
"${majorIndexDEKeyFieldCodeName}"
,
target
=
"${MinorIndexDEKeyFieldCodeName}"
),
@
Mapping
(
source
=
"${majorIndexDEMajorTextFieldCodeName}"
,
target
=
"${MinorIndexDEMajorTextFieldCodeName}"
),
@
Mapping
(
target
=
"focusNull"
,
ignore
=
true
),
<#
if
indexPSDER
.
getPSDERIndexDEFieldMaps
()??>
<#
list
indexPSDER
.
getPSDERIndexDEFieldMaps
()
as
indexFieldmapping
>
<#
comment
>
排除主键及主文本属性
</#
comment
>
<#
if
indexFieldmapping
.
getMajorPSDEField
()??
&&
indexFieldmapping
.
getMinorPSDEField
()??>
<#
assign
majorDEField
=
indexFieldmapping
.
getMajorPSDEField
()>
<#
assign
MinorDEField
=
indexFieldmapping
.
getMinorPSDEField
()>
<#
if
majorDEField
.
isKeyDEField
()==
false
&&
MinorDEField
.
isKeyDEField
()==
false
&&
majorDEField
.
isMajorDEField
()==
false
&&
MinorDEField
.
isMajorDEField
()==
false
>
<#
if
!P.exists(majorDEField.codeName,MinorDEField.codeName)>
@
Mapping
(
source
=
"${srfcaseformat(majorDEField.codeName,'l_u2lC')}"
,
target
=
"${srfcaseformat(MinorDEField.codeName,'l_u2lC')}"
),
</#
if
>
</#
if
>
</#
if
>
</#
list
>
</#
if
>
})
${
MinorIndexDECodeName
}
to
${
MinorIndexDECodeNameCamel
}(${
majorIndexDECodeName
}
${
majorIndexDECodeName
?
lower_case
});
List
<${
majorIndexDECodeName
}>
to
${
majorIndexDECodeNameCamel
}(
List
<${
MinorIndexDECodeName
}>
${
MinorIndexDECodeName
?
lower_case
});
List
<${
MinorIndexDECodeName
}>
to
${
MinorIndexDECodeNameCamel
}(
List
<${
majorIndexDECodeName
}>
${
majorIndexDECodeName
?
lower_case
});
}
</#
if
>
</#
if
>
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/service/impl/%DE%ServiceImpl.java.ftl
浏览文件 @
37899421
...
@@ -23,6 +23,23 @@ TARGET=PSDATAENTITY
...
@@ -23,6 +23,23 @@ TARGET=PSDATAENTITY
<#
break
>
<#
break
>
</#
list
>
</#
list
>
</#
if
>
</#
if
>
<#
comment
>
判断当前实体是否为索引子实体
</#
comment
>
<#
assign
isIndexSubDE
=
false
>
<#
if
de
.
getMinorPSDERs
()??>
<#
list
de
.
getMinorPSDERs
()
as
MinorPSDER
>
<#
if
MinorPSDER
.
getDERType
()??
&&
MinorPSDER
.
getMajorPSDataEntity
()??>
<#
comment
>
继承关系、索引关系
(
包含分组属性
)</#
comment
>
<#
if
MinorPSDER
.
getDERType
()==
"DERINHERIT"
||
(
MinorPSDER
.
getDERType
()==
"DERINDEX"
)
&&
MinorPSDER
.
getMajorPSDataEntity
().
getIndexTypePSDEField
()??>
<#
assign
isIndexSubDE
=
true
>
<#
assign
indexPSDER
=
MinorPSDER
>
<#
assign
majorIndexDE
=
indexPSDER
.
getMajorPSDataEntity
()>
<#
assign
majorIndexDECodeName
=
indexPSDER
.
getMajorPSDataEntity
().
codeName
>
<#
assign
majorIndexDECodeNameCamel
=
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)?
cap_first
>
<#
break
>
</#
if
>
</#
if
>
</#
list
>
</#
if
>
package
${
pub
.
getPKGCodeName
()}.
core
.${
item
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
service
.
impl
;
package
${
pub
.
getPKGCodeName
()}.
core
.${
item
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
service
.
impl
;
import
java
.
io
.
Serializable
;
import
java
.
io
.
Serializable
;
...
@@ -216,6 +233,10 @@ ${deaction.getRender().code}
...
@@ -216,6 +233,10 @@ ${deaction.getRender().code}
<@
addBoforeLogic
deaction
/>
<@
addBoforeLogic
deaction
/>
if
(
!this.retBool(this.baseMapper.insert(et)))
if
(
!this.retBool(this.baseMapper.insert(et)))
return
false
;
return
false
;
<#
comment
>
同步创建继承主实体数据
</#
comment
>
<#
if
isIndexSubDE
&&
indexPSDER
.
getDERType
()==
"DERINHERIT"
>
createIndexMajorEntityData
(
et
);
</#
if
>
<#
comment
>
1
:
N
关系中,在父实体中创建子实体的
List
集合
</#
comment
>
<#
comment
>
1
:
N
关系中,在父实体中创建子实体的
List
集合
</#
comment
>
<#
if
de
.
getMajorPSDERs
??
&&
de
.
getMajorPSDERs
()??>
<#
if
de
.
getMajorPSDERs
??
&&
de
.
getMajorPSDERs
()??>
<#
list
de
.
getMajorPSDERs
()
as
MajorPSDER
>
<#
list
de
.
getMajorPSDERs
()
as
MajorPSDER
>
...
@@ -242,6 +263,10 @@ ${deaction.getRender().code}
...
@@ -242,6 +263,10 @@ ${deaction.getRender().code}
</#
if
>
</#
if
>
<#
comment
>
成功后
get
填充一次完整信息
</#
comment
>
<#
comment
>
成功后
get
填充一次完整信息
</#
comment
>
CachedBeanCopier
.
copy
(
get
(
et
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()),
et
);
CachedBeanCopier
.
copy
(
get
(
et
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()),
et
);
<#
comment
>
同步创建索引主实体数据
</#
comment
>
<#
if
isIndexSubDE
&&
indexPSDER
.
getDERType
()==
"DERINDEX"
>
createIndexMajorEntityData
(
et
);
</#
if
>
<#
comment
>
附加数据逻辑
-
操作后
</#
comment
>
<#
comment
>
附加数据逻辑
-
操作后
</#
comment
>
<@
addAfterLogic
deaction
/>
<@
addAfterLogic
deaction
/>
return
true
;
return
true
;
...
@@ -272,6 +297,10 @@ ${deaction.getRender().code}
...
@@ -272,6 +297,10 @@ ${deaction.getRender().code}
<#
if
de
.
getKeyPSDEField
()??>
<#
if
de
.
getKeyPSDEField
()??>
if
(
!update(et,(Wrapper) et.getUpdateWrapper(true).eq("${keyfield.name?lower_case}",et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}())))
if
(
!update(et,(Wrapper) et.getUpdateWrapper(true).eq("${keyfield.name?lower_case}",et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}())))
return
false
;
return
false
;
<#
comment
>
同步更新继承主实体数据
</#
comment
>
<#
if
isIndexSubDE
&&
indexPSDER
.
getDERType
()==
"DERINHERIT"
>
${
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)}
Service
.
update
(${
de
.
codeName
?
lower_case
}
InheritMapping
.
to
${
majorIndexDECodeNameCamel
}(
et
));
</#
if
>
<#
comment
>
1
:
N
关系中,在父实体中创建子实体的
List
集合
</#
comment
>
<#
comment
>
1
:
N
关系中,在父实体中创建子实体的
List
集合
</#
comment
>
<#
if
de
.
getMajorPSDERs
??
&&
de
.
getMajorPSDERs
()??>
<#
if
de
.
getMajorPSDERs
??
&&
de
.
getMajorPSDERs
()??>
<#
list
de
.
getMajorPSDERs
()
as
MajorPSDER
>
<#
list
de
.
getMajorPSDERs
()
as
MajorPSDER
>
...
@@ -298,6 +327,10 @@ ${deaction.getRender().code}
...
@@ -298,6 +327,10 @@ ${deaction.getRender().code}
</#
if
>
</#
if
>
<#
comment
>
成功后
get
填充一次完整信息
</#
comment
>
<#
comment
>
成功后
get
填充一次完整信息
</#
comment
>
CachedBeanCopier
.
copy
(
get
(
et
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()),
et
);
CachedBeanCopier
.
copy
(
get
(
et
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()),
et
);
<#
comment
>
同步更新索引主实体数据
</#
comment
>
<#
if
isIndexSubDE
&&
indexPSDER
.
getDERType
()==
"DERINDEX"
>
${
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)}
Service
.
update
(${
de
.
codeName
?
lower_case
}
InheritMapping
.
to
${
majorIndexDECodeNameCamel
}(
et
));
</#
if
>
<#
comment
>
附加数据逻辑
-
操作后
</#
comment
>
<#
comment
>
附加数据逻辑
-
操作后
</#
comment
>
<@
addAfterLogic
deaction
/>
<@
addAfterLogic
deaction
/>
return
true
;
return
true
;
...
@@ -373,6 +406,10 @@ ${deaction.getRender().code}
...
@@ -373,6 +406,10 @@ ${deaction.getRender().code}
</#
list
>
</#
list
>
</#
if
>
</#
if
>
boolean
result
=
removeById
(
key
);
boolean
result
=
removeById
(
key
);
<#
comment
>
同步清除索引主实体数据
</#
comment
>
<#
if
isIndexSubDE
>
${
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)}
Service
.
remove
(
key
);
</#
if
>
<#
comment
>
附加数据逻辑
-
操作后
</#
comment
>
<#
comment
>
附加数据逻辑
-
操作后
</#
comment
>
<@
addAfterLogic
deaction
/>
<@
addAfterLogic
deaction
/>
return
result
;
return
result
;
...
@@ -583,6 +620,29 @@ ${deaction.getRender().code}
...
@@ -583,6 +620,29 @@ ${deaction.getRender().code}
}
}
</#
if
>
</#
if
>
<#
comment
>
同步数据到索引主实体
</#
comment
>
<#
if
isIndexSubDE
&&
indexPSDER
??>
@
Autowired
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
codeName
?
lower_case
}.
mapping
.${
de
.
codeName
}
InheritMapping
${
de
.
codeName
?
lower_case
}
InheritMapping
;
<#
if
!P.exists('DER1N',majorIndexDECodeName)>
@
Autowired
@
Lazy
private
${
pub
.
getPKGCodeName
()}.
core
.${
majorIndexDE
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
service
.
I
${
majorIndexDECodeName
}
Service
${
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)}
Service
;
</#
if
>
/**
*
创建索引主实体数据
*
@
param
et
*/
private
void
createIndexMajorEntityData
(${
de
.
codeName
}
et
){
if
(
ObjectUtils
.
isEmpty
(
et
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()))
et
.
set
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}((${
srfjavatype
(
keyfield
.
stdDataType
)})
et
.
getDefaultKey
(
true
));
${
pub
.
getPKGCodeName
()}.
core
.${
majorIndexDE
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
domain
.${
majorIndexDECodeName
}
${
majorIndexDECodeName
?
lower_case
}
=${
de
.
codeName
?
lower_case
}
InheritMapping
.
to
${
majorIndexDECodeNameCamel
}(
et
);
${
majorIndexDECodeName
?
lower_case
}.
set
(
"${majorIndexDE.getIndexTypePSDEField().codeName?lower_case}"
,
"${indexPSDER.getTypeValue()}"
);
${
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)}
Service
.
create
(${
majorIndexDECodeName
?
lower_case
});
}
</#
if
>
<#
comment
>
输出自定义
sql
查询
</#
comment
>
<#
comment
>
输出自定义
sql
查询
</#
comment
>
@
Override
@
Override
public
List
<
JSONObject
>
select
(
String
sql
,
Map
param
){
public
List
<
JSONObject
>
select
(
String
sql
,
Map
param
){
...
...
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/util/config/MybatisConfiguration.java.ftl
浏览文件 @
37899421
...
@@ -33,6 +33,7 @@ public class MybatisConfiguration {
...
@@ -33,6 +33,7 @@ public class MybatisConfiguration {
Properties
p
=
new
Properties
();
Properties
p
=
new
Properties
();
p
.
setProperty
(
"Oracle"
,
"oracle"
);
p
.
setProperty
(
"Oracle"
,
"oracle"
);
p
.
setProperty
(
"MySQL"
,
"mysql"
);
p
.
setProperty
(
"MySQL"
,
"mysql"
);
p
.
setProperty
(
"PostgreSQL"
,
"postgresql"
);
p
.
setProperty
(
"DM"
,
"oracle"
);//
达梦数据库使用
oracle
模式
p
.
setProperty
(
"DM"
,
"oracle"
);//
达梦数据库使用
oracle
模式
p
.
setProperty
(
"H2"
,
"mysql"
);//
根据当前运行的数据库设置
h2
对应的
databaseid
p
.
setProperty
(
"H2"
,
"mysql"
);//
根据当前运行的数据库设置
h2
对应的
databaseid
databaseIdProvider
.
setProperties
(
p
);
databaseIdProvider
.
setProperties
(
p
);
...
...
SLN/%PUBPRJ%-core/src/main/resources/mapper/%MOD_PKGPATH%/%DE_PKGPATH%/${de.codeName}Mapper.xml.ftl
浏览文件 @
37899421
...
@@ -184,7 +184,6 @@ TARGET=PSDATAENTITY
...
@@ -184,7 +184,6 @@ TARGET=PSDATAENTITY
</#list>
</#list>
</#if>]]>
</#if>]]>
</sql>
</sql>
</#list>
</#list>
</#if>
</#if>
</#list>
</#list>
...
@@ -195,10 +194,15 @@ TARGET=PSDATAENTITY
...
@@ -195,10 +194,15 @@ TARGET=PSDATAENTITY
<#comment>上下文参数转换 原字符串:${srfdatacontext('field','{"defname":"PORGNAME","dename":"IBZORG"}')})</#comment>
<#comment>上下文参数转换 原字符串:${srfdatacontext('field','{"defname":"PORGNAME","dename":"IBZORG"}')})</#comment>
<#comment>第一次替换:#{srf.datacontext.field','{"defname":"PORGNAME","dename":"IBZORG"}')})</#comment>
<#comment>第一次替换:#{srf.datacontext.field','{"defname":"PORGNAME","dename":"IBZORG"}')})</#comment>
<#comment>第二次替换:#{srf.datacontext.field}</#comment>
<#comment>第二次替换:#{srf.datacontext.field}</#comment>
<#comment>第三次替换: #{srf.datacontext.ORGID} --> #{srf.datacontext.orgid} </#comment>
<#function contextParamConvert contextParam>
<#function contextParamConvert contextParam>
<#assign resultParam="">
<#assign resultParam="">
<#assign resultParam=contextParam?replace('$\{srfdatacontext(\'','#\{srf.datacontext.')?replace("','\\{[\\S]*}'\\)}","\\}","r")><#comment>数据上下文</#comment>
<#assign resultParam=contextParam?replace('$\{srfdatacontext(\'','#\{srf.datacontext.')?replace("','\\{[\\S]*}'\\)}","\\}","r")><#comment>数据上下文</#comment>
<#assign resultParam=resultParam?replace('$\{srfsessioncontext(\'','#\{srf.sessioncontext.')?replace("','\\{[\\S]*}'\\)}","\\}","r")><#comment>用户上下文</#comment>
<#assign resultParam=resultParam?replace('$\{srfsessioncontext(\'','#\{srf.sessioncontext.')?replace("','\\{[\\S]*}'\\)}","\\}","r")><#comment>用户上下文</#comment>
<#assign resultParam=resultParam?replace('$\{srfwebcontext(\'','#\{srf.webcontext.')?replace("','\\{[\\S]*}'\\)}","\\}","r")><#comment>网页请求上下文</#comment>
<#assign resultParam=resultParam?replace('$\{srfwebcontext(\'','#\{srf.webcontext.')?replace("','\\{[\\S]*}'\\)}","\\}","r")><#comment>网页请求上下文</#comment>
<#assign params=resultParam?matches('#\\{srf.[\\S]*}')>
<#list params as param>
<#assign resultParam=resultParam?replace(param,param?lower_case)><#comment>将上下文参数转小写</#comment>
</#list>
<#return resultParam>
<#return resultParam>
</#function>
</#function>
SLN/%PUBPRJ%-dependencies/pom.xml.ftl
浏览文件 @
37899421
...
@@ -81,6 +81,17 @@ TARGET=PSSYSTEM
...
@@ -81,6 +81,17 @@ TARGET=PSSYSTEM
<!--xxl-job定时服务 -->
<!--xxl-job定时服务 -->
<xxl-job.version>2.1.0</xxl-job.version>
<xxl-job.version>2.1.0</xxl-job.version>
<#if sys.getAllPSSystemDBConfigs()??>
<#list sys.getAllPSSystemDBConfigs() as dbConfig>
<#if dbConfig.getDBType()=='MYSQL5'>
<#elseif dbConfig.getDBType()=='ORACLE'>
<oracle.version>11.2.0.3</oracle.version>
<#elseif dbConfig.getDBType()=='POSTGRESQL'>
<postgresql.version>42.2.6</postgresql.version>
</#if>
</#list>
</#if>
</properties>
</properties>
<#-- dependencies,just for statement, manage the version of jars -->
<#-- dependencies,just for statement, manage the version of jars -->
...
@@ -314,12 +325,6 @@ TARGET=PSSYSTEM
...
@@ -314,12 +325,6 @@ TARGET=PSSYSTEM
<artifactId>httpclient</artifactId>
<artifactId>httpclient</artifactId>
</dependency>
</dependency>
<!-- MySQL驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 阿里Druid数据源 -->
<!-- 阿里Druid数据源 -->
<dependency>
<dependency>
<groupId>com.alibaba</groupId>
<groupId>com.alibaba</groupId>
...
@@ -332,17 +337,31 @@ TARGET=PSSYSTEM
...
@@ -332,17 +337,31 @@ TARGET=PSSYSTEM
<artifactId>h2</artifactId>
<artifactId>h2</artifactId>
</dependency>
</dependency>
<!-- Error -->
<#if sys.getAllPSSystemDBConfigs()??>
<#--<dependency>-->
<#list sys.getAllPSSystemDBConfigs() as dbConfig>
<#--<groupId>org.zalando</groupId>-->
<#if dbConfig.getDBType()=='MYSQL5'>
<#--<artifactId>problem-spring-web</artifactId>-->
<!-- MySQL驱动包 -->
<#--</dependency>-->
<dependency>
<groupId>mysql</groupId>
<!-- Security -->
<artifactId>mysql-connector-java</artifactId>
<#--<dependency>-->
</dependency>
<#--<groupId>org.springframework.cloud</groupId>-->
<#elseif dbConfig.getDBType()=='ORACLE'>
<#--<artifactId>spring-cloud-starter-security</artifactId>-->
<!-- Oracle驱动包 -->
<#--</dependency>-->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>${r'${oracle.version}'}</version>
</dependency>
<#elseif dbConfig.getDBType()=='POSTGRESQL'>
<!-- PostgreSQL驱动包 -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${r'${postgresql.version}'}</version>
</dependency>
</#if>
</#list>
</#if>
</dependencies>
</dependencies>
...
...
SLN/%PUBPRJ%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/src/main/docker/%PUBPRJ%-provider-%SYSAPI_PKGPATH%.yaml.ftl
浏览文件 @
37899421
...
@@ -97,11 +97,21 @@ services:
...
@@ -97,11 +97,21 @@ services:
deploy:
deploy:
resources:
resources:
limits:
limits:
memory:
1024
M
memory:
4048
M
reservations:
reservations:
memory: 400M
memory: 400M
mode: replicated
mode: replicated
replicas: 1
replicas: 1
volumes:
- "nfs:/app/file"
volumes:
nfs:
driver: local
driver_opts:
type: "nfs"
o: "addr=172.16.240.109,rw"
device: ":/nfs"
networks:
networks:
agent_network:
agent_network:
...
...
SLN/%PUBPRJ%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/src/main/java/%SYS_PKGPATH%/swagger/SwaggerConfiguration.java.ftl
浏览文件 @
37899421
...
@@ -20,6 +20,7 @@ import springfox.documentation.spring.web.plugins.Docket;
...
@@ -20,6 +20,7 @@ import springfox.documentation.spring.web.plugins.Docket;
import
springfox
.
documentation
.
spring
.
web
.
readers
.
operation
.
OperationParameterReader
;
import
springfox
.
documentation
.
spring
.
web
.
readers
.
operation
.
OperationParameterReader
;
import
springfox
.
documentation
.
spring
.
web
.
readers
.
parameter
.
ModelAttributeParameterExpander
;
import
springfox
.
documentation
.
spring
.
web
.
readers
.
parameter
.
ModelAttributeParameterExpander
;
import
springfox
.
documentation
.
swagger2
.
annotations
.
EnableSwagger2
;
import
springfox
.
documentation
.
swagger2
.
annotations
.
EnableSwagger2
;
import
org
.
springframework
.
boot
.
autoconfigure
.
condition
.
ConditionalOnExpression
;
import
java
.
lang
.
reflect
.
Field
;
import
java
.
lang
.
reflect
.
Field
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
ArrayList
;
...
@@ -27,6 +28,7 @@ import java.util.List;
...
@@ -27,6 +28,7 @@ import java.util.List;
@
Configuration
@
Configuration
@
EnableSwagger2
@
EnableSwagger2
@
ConditionalOnExpression
(
"${r'${swagger.enable:false}'}"
)
public
class
SwaggerConfiguration
{
public
class
SwaggerConfiguration
{
@
Bean
@
Bean
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/DEFieldDefaultValueAspect.java.ftl
浏览文件 @
37899421
...
@@ -256,7 +256,7 @@ public class DEFieldDefaultValueAspect
...
@@ -256,7 +256,7 @@ public class DEFieldDefaultValueAspect
et
.
set
(
fieldname
,
curUser
.
getMdeptname
());
et
.
set
(
fieldname
,
curUser
.
getMdeptname
());
break
;
break
;
case
LOGICVALID
:
case
LOGICVALID
:
if
(
!
StringUtils.isEmpty(logicValue)){
if
(
StringUtils
.
isEmpty
(
logicValue
)){
logicValue
=
"1"
;
logicValue
=
"1"
;
}
}
et
.
set
(
fieldname
,
logicValue
);
et
.
set
(
fieldname
,
logicValue
);
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/enums/DEPredefinedFieldType.java.ftl
浏览文件 @
37899421
...
@@ -51,6 +51,10 @@ public enum DEPredefinedFieldType {
...
@@ -51,6 +51,10 @@ public enum DEPredefinedFieldType {
*
逻辑有效
*
逻辑有效
*/
*/
LOGICVALID
,
LOGICVALID
,
/**
*
排序
*/
ORDERVALUE
,
/**
/**
*
不处理
*
不处理
*/
*/
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/QueryBuildContext.java.ftl
浏览文件 @
37899421
...
@@ -8,6 +8,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
...
@@ -8,6 +8,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import
com
.
mongodb
.
QueryBuilder
;
import
com
.
mongodb
.
QueryBuilder
;
import
lombok
.*;
import
lombok
.*;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
java
.
util
.
List
;
import
java
.
util
.
Map
;
import
java
.
util
.
regex
.
Pattern
;
@
Slf4j
@
Slf4j
@
Data
@
Data
...
@@ -17,4 +21,163 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
...
@@ -17,4 +21,163 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
@
JSONField
(
serialize
=
false
)
@
JSONField
(
serialize
=
false
)
private
QueryBuilder
selectCond
=
new
QueryBuilder
();
private
QueryBuilder
selectCond
=
new
QueryBuilder
();
public
QueryBuilder
getSearchCond
(){
return
this
.
selectCond
;
}
/**
*
填充自定义查询条件
*
@
return
*/
public
QueryBuilder
getSelectCond
()
{
if
(
!ObjectUtils.isEmpty(filter)){
QueryBuilder
queryBuilder
=
parseQueryFilter
(
filter
);
if
(
!ObjectUtils.isEmpty(queryBuilder)){
selectCond
.
and
(
queryBuilder
.
get
());
}
}
return
selectCond
;
}
/**
*
解析自定义查询条件
*
@
param
queryFilter
*
@
return
*/
private
QueryBuilder
parseQueryFilter
(
QueryFilter
queryFilter
){
if
(
ObjectUtils
.
isEmpty
(
queryFilter
.
get
$
and
())
&&
ObjectUtils
.
isEmpty
(
queryFilter
.
get
$
or
())
&&
ObjectUtils
.
isEmpty
(
queryFilter
.
any
()))
return
null
;
QueryBuilder
rsBuilder
=
QueryBuilder
.
start
();
QueryBuilder
fieldBuilder
=
parseFieldMap
(
queryFilter
.
any
());
QueryBuilder
orBuilder
=
parseOrQueryFilter
(
queryFilter
.
get
$
or
());
QueryBuilder
andBuilder
=
parseAndQueryFilter
(
queryFilter
.
get
$
and
());
if
(
!ObjectUtils.isEmpty(fieldBuilder)){
rsBuilder
.
and
(
fieldBuilder
.
get
());
}
if
(
!ObjectUtils.isEmpty(orBuilder)){
rsBuilder
.
and
(
orBuilder
.
get
());
}
if
(
!ObjectUtils.isEmpty(andBuilder)){
rsBuilder
.
and
(
andBuilder
.
get
());
}
return
rsBuilder
;
}
/**
*
解析自定义条件
[
or
]
*
@
param
queryFilters
*
@
return
*/
private
QueryBuilder
parseOrQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
QueryBuilder
orBuilder
=
new
QueryBuilder
();
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
){
return
null
;
}
for
(
QueryFilter
queryFilter
:
queryFilters
){
QueryBuilder
queryBuilder
=
parseQueryFilter
(
queryFilter
);
if
(
!ObjectUtils.isEmpty(queryBuilder)){
orBuilder
.
or
(
queryBuilder
.
get
());
}
}
return
orBuilder
;
}
/**
*
解析自定义条件
[
and
]
*
@
param
queryFilters
*
@
return
*/
private
QueryBuilder
parseAndQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
QueryBuilder
orBuilder
=
new
QueryBuilder
();
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
){
return
null
;
}
for
(
QueryFilter
queryFilter
:
queryFilters
){
QueryBuilder
queryBuilder
=
parseQueryFilter
(
queryFilter
);
if
(
!ObjectUtils.isEmpty(queryBuilder)){
orBuilder
.
and
(
queryBuilder
.
get
());
}
}
return
orBuilder
;
}
/**
*
解析自定义条件
[
字段条件
]
*
@
param
fieldMap
*
@
return
*/
private
QueryBuilder
parseFieldMap
(
Map
<
String
,
QueryFilter
.
SegmentCond
>
fieldMap
)
{
if
(
fieldMap
.
size
()==
0
)
return
null
;
QueryBuilder
fieldBuilders
=
QueryBuilder
.
start
();
for
(
Map
.
Entry
<
String
,
QueryFilter
.
SegmentCond
>
entry
:
fieldMap
.
entrySet
()){
getSegmentCondSql
(
entry
.
getKey
(),
entry
.
getValue
(),
fieldBuilders
);
}
return
fieldBuilders
;
}
/**
*
解析自定义条件
[
字段条件
]
*
@
param
fieldName
*
@
param
segmentCond
*
@
param
fieldBuilder
*/
private
void
getSegmentCondSql
(
String
fieldName
,
QueryFilter
.
SegmentCond
segmentCond
,
QueryBuilder
fieldBuilder
)
{
Map
<
String
,
Object
>
segmentCondMap
=
segmentCond
.
any
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
segmentCondMap
.
entrySet
()){
Object
value
=
entry
.
getValue
();
switch
(
entry
.
getKey
()){
case
"$eq"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
is
(
value
).
get
());
break
;
case
"$ne"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
not
().
and
(
fieldName
).
is
(
value
).
get
());
break
;
case
"$gt"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
greaterThan
(
value
).
get
());
break
;
case
"$gte"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
greaterThanEquals
(
value
).
get
());
break
;
case
"$lt"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
lessThan
(
value
).
get
());
break
;
case
"$lte"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
lessThanEquals
(
value
).
get
());
break
;
case
"$null"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
exists
(
null
).
get
());
break
;
case
"$notNull"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
exists
(
true
).
and
(
fieldName
).
notEquals
(
""
).
and
(
fieldName
).
notEquals
(
null
).
get
());
break
;
case
"$in"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
in
(
value
).
get
());
break
;
case
"$notIn"
:
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
not
().
in
(
value
).
get
());
break
;
case
"$like"
:
Pattern
likePattern
=
Pattern
.
compile
(
"^.*"
+
value
+
".*$"
,
Pattern
.
CASE_INSENSITIVE
);
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
regex
(
likePattern
).
get
());
break
;
case
"$startsWith"
:
Pattern
startsWithPattern
=
Pattern
.
compile
(
value
+
".*$"
,
Pattern
.
CASE_INSENSITIVE
);
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
regex
(
startsWithPattern
).
get
());
break
;
case
"$endsWith"
:
Pattern
endsWithPattern
=
Pattern
.
compile
(
"^.*"
+
value
+
"$"
,
Pattern
.
CASE_INSENSITIVE
);
fieldBuilder
.
and
(
QueryBuilder
.
start
().
and
(
fieldName
).
regex
(
endsWithPattern
).
get
());
break
;
case
"$exists"
:
break
;
case
"$notExists"
:
break
;
}
}
}
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/QueryFilter.java.ftl
0 → 100644
浏览文件 @
37899421
<#
ibiztemplate
>
TARGET
=
PSSYSTEM
</#
ibiztemplate
>
package
${
pub
.
getPKGCodeName
()}.
util
.
filter
;
import
com
.
fasterxml
.
jackson
.
annotation
.*;
import
org
.
springframework
.
data
.
annotation
.
Transient
;
import
java
.
util
.*;
@
JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
QueryFilter
{
public
static
QueryFilter
createQuery
()
{
QueryFilter
queryFilter
=
new
QueryFilter
();
return
queryFilter
;
}
public
QueryFilter
eq
(
String
column
,
Object
value
)
{
return
op
(
column
,
SegmentCond
.
eq
(
value
));
}
public
QueryFilter
ne
(
String
column
,
Object
value
)
{
return
op
(
column
,
SegmentCond
.
ne
(
value
));
}
public
QueryFilter
gt
(
String
column
,
Object
value
)
{
return
op
(
column
,
SegmentCond
.
gt
(
value
));
}
public
QueryFilter
ge
(
String
column
,
Object
value
)
{
return
op
(
column
,
SegmentCond
.
ge
(
value
));
}
public
QueryFilter
lt
(
String
column
,
Object
value
)
{
return
op
(
column
,
SegmentCond
.
lt
(
value
));
}
public
QueryFilter
le
(
String
column
,
Object
value
)
{
return
op
(
column
,
SegmentCond
.
le
(
value
));
}
public
QueryFilter
isnull
(
String
column
)
{
return
op
(
column
,
SegmentCond
.
isnull
());
}
public
QueryFilter
isnotnull
(
String
column
)
{
return
op
(
column
,
SegmentCond
.
isnotnull
());
}
public
QueryFilter
in
(
String
column
,
Collection
value
)
{
return
op
(
column
,
SegmentCond
.
in
(
value
));
}
public
QueryFilter
notin
(
String
column
,
Collection
value
)
{
return
op
(
column
,
SegmentCond
.
notin
(
value
));
}
public
QueryFilter
like
(
String
column
,
String
value
)
{
return
op
(
column
,
SegmentCond
.
like
(
value
));
}
public
QueryFilter
startsWith
(
String
column
,
String
value
)
{
return
op
(
column
,
SegmentCond
.
startsWith
(
value
));
}
public
QueryFilter
endsWith
(
String
column
,
String
value
)
{
return
op
(
column
,
SegmentCond
.
endsWith
(
value
));
}
public
QueryFilter
between
(
String
column
,
Object
from
,
Object
to
)
{
return
op
(
column
,
SegmentCond
.
between
(
from
,
to
));
}
@
JsonIgnore
@
Transient
private
Map
<
String
,
SegmentCond
>
map
;
private
Map
<
String
,
SegmentCond
>
getMap
()
{
if
(
map
==
null
)
map
=
new
LinkedHashMap
<>();
return
map
;
}
@
JsonAnyGetter
public
Map
<
String
,
SegmentCond
>
any
()
{
return
getMap
();
}
@
JsonAnySetter
public
void
set
(
String
column
,
SegmentCond
value
)
{
getMap
().
put
(
column
,
value
);
}
@
JsonProperty
(
index
=
999
)
private
List
<
QueryFilter
>
$
or
;
public
List
<
QueryFilter
>
get
$
or
()
{
return
$
or
;
}
public
void
set
$
or
(
List
<
QueryFilter
>
$
or
)
{
this
.$
or
=
$
or
;
}
public
QueryFilter
or
(
QueryFilter
...
ors
)
{
if
($
or
==
null
)
{
$
or
=
new
ArrayList
();
}
Collections
.
addAll
($
or
,
ors
);
return
this
;
}
@
JsonProperty
(
index
=
999
)
private
List
<
QueryFilter
>
$
and
;
public
List
<
QueryFilter
>
get
$
and
()
{
return
$
and
;
}
public
void
set
$
and
(
List
<
QueryFilter
>
$
and
)
{
this
.$
and
=
$
and
;
}
public
QueryFilter
and
(
QueryFilter
...
ands
)
{
if
($
and
==
null
)
{
$
and
=
new
ArrayList
();
}
Collections
.
addAll
($
and
,
ands
);
return
this
;
}
@
Override
public
String
toString
()
{
return
"QueryFilter{"
+
"map="
+
map
+
", $or="
+
$
or
+
'}'
;
}
private
QueryFilter
op
(
String
column
,
SegmentCond
segmentCond
)
{
if
(
this
.
getMap
().
containsKey
(
column
))
((
SegmentCond
)
this
.
getMap
().
get
(
column
)).
getMap
().
putAll
(
segmentCond
.
getMap
());
else
this
.
getMap
().
put
(
column
,
segmentCond
);
return
this
;
}
public
static
class
SegmentCond
{
@
JsonIgnore
@
Transient
private
Map
<
String
,
Object
>
map
;
@
Override
public
String
toString
()
{
return
"SegmentCond{"
+
"map="
+
map
+
'}'
;
}
private
Map
<
String
,
Object
>
getMap
()
{
if
(
map
==
null
)
map
=
new
LinkedHashMap
<>();
return
map
;
}
@
JsonAnyGetter
public
Map
<
String
,
Object
>
any
()
{
return
getMap
();
}
@
JsonAnySetter
public
void
set
(
String
column
,
Object
value
)
{
getMap
().
put
(
column
,
value
);
}
public
static
SegmentCond
eq
(
Object
value
)
{
return
op
(
Segment
.
EQ
,
value
);
}
public
static
SegmentCond
ne
(
Object
value
)
{
return
op
(
Segment
.
NE
,
value
);
}
public
static
SegmentCond
gt
(
Object
value
)
{
return
op
(
Segment
.
GT
,
value
);
}
public
static
SegmentCond
ge
(
Object
value
)
{
return
op
(
Segment
.
GE
,
value
);
}
public
static
SegmentCond
lt
(
Object
value
)
{
return
op
(
Segment
.
LT
,
value
);
}
public
static
SegmentCond
le
(
Object
value
)
{
return
op
(
Segment
.
LE
,
value
);
}
public
static
SegmentCond
isnull
()
{
return
op
(
Segment
.
IS_NULL
,
true
);
}
public
static
SegmentCond
isnotnull
()
{
return
op
(
Segment
.
IS_NOT_NULL
,
true
);
}
public
static
SegmentCond
in
(
Collection
value
)
{
return
op
(
Segment
.
IN
,
value
);
}
public
static
SegmentCond
notin
(
Collection
value
)
{
return
op
(
Segment
.
NOTIN
,
value
);
}
public
static
SegmentCond
like
(
String
value
)
{
return
op
(
Segment
.
LIKE
,
value
);
}
public
static
SegmentCond
startsWith
(
String
value
)
{
return
op
(
Segment
.
LEFTLIKE
,
value
);
}
public
static
SegmentCond
endsWith
(
String
value
)
{
return
op
(
Segment
.
RIGHTLIKE
,
value
);
}
public
static
SegmentCond
between
(
Object
from
,
Object
to
)
{
return
op
(
Segment
.
GE
,
from
).
op
(
Segment
.
LT
,
to
);
}
private
static
SegmentCond
op
(
Segment
segment
,
Object
value
)
{
SegmentCond
segmentCond
=
new
SegmentCond
();
segmentCond
.
getMap
().
put
(
segment
.
keyword
,
value
);
return
segmentCond
;
}
}
public
enum
Segment
{
AND
(
"$and"
),
OR
(
"$or"
),
EQ
(
"$eq"
),
NE
(
"$ne"
),
GT
(
"$gt"
),
GE
(
"$gte"
),
LT
(
"$lt"
),
LE
(
"$lte"
),
IS_NULL
(
"$null"
),
IS_NOT_NULL
(
"$notNull"
),
IN
(
"$in"
),
NOTIN
(
"$notIn"
),
LIKE
(
"$like"
),
LEFTLIKE
(
"$startsWith"
),
RIGHTLIKE
(
"$endsWith"
),
EXISTS
(
"$exists"
),
NOTEXISTS
(
"$notExists"
);
private
final
String
keyword
;
Segment
(
final
String
keyword
)
{
this
.
keyword
=
keyword
;
}
}
/*
SQL
:
(
field1
>
1
and
field2
=
'3'
and
(
field3
like
"a"
or
(
field4
is
not
null
and
field5
in
[
'11'
,
'12'
])
)
JAVA
:
QueryFilter
filter
=
QueryFilter
.
createQuery
()
.
gt
(
"field1"
,
1
)
.
eq
(
"field2"
,
'3'
)
.
or
(
QueryFilter
.
createQuery
().
like
(
"field3"
,
"a"
)
,
QueryFilter
.
createQuery
().
isnotnull
(
"field4"
).
in
(
"field5"
,
Arrays
.
asList
(
"11"
,
"12"
)));
JSON
:
{
"$or"
:[
{
"field3"
:{
"$like"
:
"a"
}
},
{
"field4"
:{
"$notNull"
:
true
},
"field5"
:{
"$in"
:[
"11"
,
"12"
]}
}],
"field1"
:{
"$gt"
:
1
},
"field2"
:{
"$eq"
:
"3"
}
}
*/
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/QueryWrapperContext.java.ftl
浏览文件 @
37899421
...
@@ -13,11 +13,9 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -13,11 +13,9 @@ import lombok.extern.slf4j.Slf4j;
import
org
.
springframework
.
data
.
domain
.
Sort
;
import
org
.
springframework
.
data
.
domain
.
Sort
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
import
java
.
lang
.
reflect
.
ParameterizedType
;
import
java
.
lang
.
reflect
.
ParameterizedType
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.*;
import
java
.
util
.
Iterator
;
import
java
.
util
.
function
.
Consumer
;
import
java
.
util
.
List
;
@
Slf4j
@
Slf4j
@
Data
@
Data
...
@@ -76,4 +74,150 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
...
@@ -76,4 +74,150 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
return
page
;
return
page
;
}
}
public
QueryWrapper
<
T
>
getSearchCond
(){
return
this
.
selectCond
;
}
/**
*
填充自定义查询条件
*
@
return
*/
public
QueryWrapper
<
T
>
getSelectCond
()
{
if
(
!ObjectUtils.isEmpty(filter)){
Consumer
queryWrapper
=
parseQueryFilter
(
filter
);
if
(
!ObjectUtils.isEmpty(queryWrapper)){
selectCond
.
and
(
queryWrapper
);
}
}
return
selectCond
;
}
/**
*
解析自定义查询条件
*
@
param
queryFilter
*
@
return
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseQueryFilter
(
QueryFilter
queryFilter
){
if
(
queryFilter
.
any
().
size
()==
0
&&
queryFilter
.
get
$
or
()==
null
&&
queryFilter
.
get
$
and
()==
null
)
return
null
;
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
Consumer
fieldConsumer
=
parseFieldMap
(
queryFilter
.
any
());
Consumer
orConsumer
=
parseOrQueryFilter
(
queryFilter
.
get
$
or
());
Consumer
andConsumer
=
parseAndQueryFilter
(
queryFilter
.
get
$
and
());
if
(
!ObjectUtils.isEmpty(fieldConsumer)){
queryWrapper
.
and
(
fieldConsumer
);
}
if
(
!ObjectUtils.isEmpty(orConsumer)){
queryWrapper
.
and
(
orConsumer
);
}
if
(
!ObjectUtils.isEmpty(andConsumer)){
queryWrapper
.
and
(
andConsumer
);
}
};
return
consumer
;
}
/**
*
解析自定义条件
[
or
]
*
@
param
queryFilters
*
@
return
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseOrQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
return
null
;
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
for
(
QueryFilter
queryFilter
:
queryFilters
){
Consumer
tempQueryWrapper
=
parseQueryFilter
(
queryFilter
);
queryWrapper
.
or
(
tempQueryWrapper
);
}
};
return
consumer
;
}
/**
*
解析自定义条件
[
and
]
*
@
param
queryFilters
*
@
return
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseAndQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
return
null
;
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
for
(
QueryFilter
queryFilter
:
queryFilters
){
Consumer
tempQueryWrapper
=
parseQueryFilter
(
queryFilter
);
queryWrapper
.
and
(
tempQueryWrapper
);
}
};
return
consumer
;
}
/**
*
解析自定义条件
[
字段条件
]
*
@
param
fieldMap
*
@
return
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseFieldMap
(
Map
<
String
,
QueryFilter
.
SegmentCond
>
fieldMap
)
{
if
(
fieldMap
.
size
()==
0
)
return
null
;
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
for
(
Map
.
Entry
<
String
,
QueryFilter
.
SegmentCond
>
field
:
fieldMap
.
entrySet
()){
String
fieldName
=
field
.
getKey
();
QueryFilter
.
SegmentCond
segmentCond
=
field
.
getValue
();
Map
<
String
,
Object
>
segmentCondMap
=
segmentCond
.
any
();
for
(
Map
.
Entry
<
String
,
Object
>
fieldCond
:
segmentCondMap
.
entrySet
()){
Object
value
=
fieldCond
.
getValue
();
switch
(
fieldCond
.
getKey
()){
case
"$eq"
:
queryWrapper
.
eq
(
fieldName
,
value
);
break
;
case
"$ne"
:
queryWrapper
.
ne
(
fieldName
,
value
);
break
;
case
"$gt"
:
queryWrapper
.
gt
(
fieldName
,
value
);
break
;
case
"$gte"
:
queryWrapper
.
ge
(
fieldName
,
value
);
break
;
case
"$lt"
:
queryWrapper
.
lt
(
fieldName
,
value
);
break
;
case
"$lte"
:
queryWrapper
.
le
(
fieldName
,
value
);
break
;
case
"$null"
:
queryWrapper
.
isNull
(
fieldName
);
break
;
case
"$notNull"
:
queryWrapper
.
isNotNull
(
fieldName
);
break
;
case
"$in"
:
queryWrapper
.
in
(
fieldName
,(
Collection
)
value
);
break
;
case
"$notIn"
:
queryWrapper
.
notIn
(
fieldName
,(
Collection
)
value
);
break
;
case
"$like"
:
queryWrapper
.
like
(
fieldName
,
value
);
break
;
case
"$startsWith"
:
queryWrapper
.
likeRight
(
fieldName
,
value
);
break
;
case
"$endsWith"
:
queryWrapper
.
likeLeft
(
fieldName
,
value
);
break
;
case
"$exists"
:
break
;
case
"$notExists"
:
break
;
}
}
}
};
return
consumer
;
}
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/SearchContextBase.java.ftl
浏览文件 @
37899421
...
@@ -15,9 +15,7 @@ import org.springframework.data.domain.Pageable;
...
@@ -15,9 +15,7 @@ import org.springframework.data.domain.Pageable;
import
org
.
springframework
.
data
.
domain
.
Sort
;
import
org
.
springframework
.
data
.
domain
.
Sort
;
import
org
.
springframework
.
util
.
StringUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
java
.
util
.
HashMap
;
import
java
.
util
.*;
import
java
.
util
.
List
;
import
java
.
util
.
Map
;
@
Slf4j
@
Slf4j
@
Data
@
Data
...
@@ -38,7 +36,11 @@ public class SearchContextBase implements ISearchContext{
...
@@ -38,7 +36,11 @@ public class SearchContextBase implements ISearchContext{
*/
*/
@
JsonProperty
(
"query"
)
@
JsonProperty
(
"query"
)
public
String
query
;
public
String
query
;
/**
*
条件表达式
*/
@
JsonProperty
(
"filter"
)
public
QueryFilter
filter
;
/**
/**
*
数据查询
*
数据查询
*/
*/
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/rest/AppController.java.ftl
浏览文件 @
37899421
...
@@ -15,10 +15,7 @@ import org.springframework.http.ResponseEntity;
...
@@ -15,10 +15,7 @@ import org.springframework.http.ResponseEntity;
import
org
.
springframework
.
security
.
core
.
GrantedAuthority
;
import
org
.
springframework
.
security
.
core
.
GrantedAuthority
;
import
org
.
springframework
.
util
.
StringUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
import
org
.
springframework
.
web
.
bind
.
annotation
.*;
import
org
.
springframework
.
web
.
bind
.
annotation
.*;
import
java
.
util
.
Collection
;
import
java
.
util
.*;
import
java
.
util
.
HashSet
;
import
java
.
util
.
Iterator
;
import
java
.
util
.
Set
;
@
RestController
@
RestController
@
RequestMapping
(
value
=
""
)
@
RequestMapping
(
value
=
""
)
...
@@ -41,8 +38,9 @@ public class AppController {
...
@@ -41,8 +38,9 @@ public class AppController {
Set
<
String
>
appMenu
=
new
HashSet
();
Set
<
String
>
appMenu
=
new
HashSet
();
Set
<
String
>
uniRes
=
new
HashSet
();
Set
<
String
>
uniRes
=
new
HashSet
();
AuthenticationUser
curUser
=
AuthenticationUser
.
getAuthenticationUser
();
if
(
enablePermissionValid
){
if
(
enablePermissionValid
){
Collection
<
GrantedAuthority
>
authorities
=
AuthenticationUser
.
getAuthenticationUser
()
.
getAuthorities
();
Collection
<
GrantedAuthority
>
authorities
=
curUser
.
getAuthorities
();
Iterator
it
=
authorities
.
iterator
();
Iterator
it
=
authorities
.
iterator
();
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
GrantedAuthority
authority
=
(
GrantedAuthority
)
it
.
next
();
GrantedAuthority
authority
=
(
GrantedAuthority
)
it
.
next
();
...
@@ -53,6 +51,10 @@ public class AppController {
...
@@ -53,6 +51,10 @@ public class AppController {
appMenu
.
add
(
strAuthority
.
substring
(
systemId
.
length
()+
9
));
appMenu
.
add
(
strAuthority
.
substring
(
systemId
.
length
()+
9
));
}
}
}
}
Map
<
String
,
Object
>
context
=
new
HashMap
<>();
context
.
putAll
(
curUser
.
getSessionParams
());
context
.
put
(
"srfusername"
,
curUser
.
getPersonname
());
appData
.
put
(
"context"
,
context
);
appData
.
put
(
"unires"
,
uniRes
);
appData
.
put
(
"unires"
,
uniRes
);
appData
.
put
(
"appmenu"
,
appMenu
);
appData
.
put
(
"appmenu"
,
appMenu
);
appData
.
put
(
"enablepermissionvalid"
,
enablePermissionValid
);
appData
.
put
(
"enablepermissionvalid"
,
enablePermissionValid
);
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/IBZConfigService.java.ftl
浏览文件 @
37899421
...
@@ -22,24 +22,34 @@ import org.springframework.util.StringUtils;
...
@@ -22,24 +22,34 @@ import org.springframework.util.StringUtils;
@
Slf4j
@
Slf4j
@
Service
@
Service
public
class
IBZConfigService
extends
ServiceImpl
<
IBZConfigMapper
,
IBZConfig
>
implements
IService
<
IBZConfig
>
{
public
class
IBZConfigService
extends
ServiceImpl
<
IBZConfigMapper
,
IBZConfig
>
implements
IService
<
IBZConfig
>
{
<#
if
sys
.
getPSSystemSetting
()??
&&
sys
.
getPSSystemSetting
().
getDataAccCtrlArch
()??
&&
sys
.
getPSSystemSetting
().
getDataAccCtrlArch
()==
1
>
<#
assign
cachename
=
"ibzrt_configs"
>
<#
else
>
<#
assign
cachename
=
pub
.
getCodeName
()?
lower_case
+
"_configs"
>
</#
if
>
@
Value
(
"${r'${'}ibiz.systemid:${sys.getName()}}"
)
@
Value
(
"${r'${'}ibiz.systemid:${sys.getName()}}"
)
private
String
systemId
;
private
String
systemId
;
@
Cacheable
(
value
=
"ibzou_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
@
Value
(
"${r'${'}ibiz.admin.userid:0100}"
)
private
String
adminuserid
;
@
Cacheable
(
value
=
"${cachename}"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
JSONObject
getConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
public
JSONObject
getConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
{
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
IBZConfig
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()),
false
);
IBZConfig
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()),
false
);
if
(
config
==
null
)
if
(
config
==
null
)
{
return
new
JSONObject
();
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
adminuserid
).
build
()),
false
);
else
if
(
config
==
null
)
{
return
JSON
.
parseObject
(
config
.
getCfg
());
return
new
JSONObject
();
}
}
return
JSON
.
parseObject
(
config
.
getCfg
());
}
}
@
CacheEvict
(
value
=
"
ibzou_configs
"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
@
CacheEvict
(
value
=
"
${cachename}
"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
boolean
saveConfig
(
String
cfgType
,
String
targetType
,
String
userId
,
JSONObject
config
)
public
boolean
saveConfig
(
String
cfgType
,
String
targetType
,
String
userId
,
JSONObject
config
)
{
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
...
@@ -50,7 +60,7 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
...
@@ -50,7 +60,7 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
return
this
.
saveOrUpdate
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
cfg
(
cfg
).
updateDate
(
DataObject
.
getNow
()).
build
());
return
this
.
saveOrUpdate
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
cfg
(
cfg
).
updateDate
(
DataObject
.
getNow
()).
build
());
}
}
@
CacheEvict
(
value
=
"
ibzou_configs
"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
@
CacheEvict
(
value
=
"
${cachename}
"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
void
resetConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
public
void
resetConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
{
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录