Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hg-smart
Commits
0de5a647
Commit
0de5a647
authored
Sep 13, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.工具类增加,批量新增
parent
99e0b22f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletions
+47
-1
DaoUtils.java
src/main/java/com/baosight/hggp/core/dao/DaoUtils.java
+33
-0
ServiceXS3201B.java
...ava/com/baosight/xservices/xs/service/ServiceXS3201B.java
+2
-1
XS07.xml
src/main/java/com/baosight/xservices/xs/sql/XS07.xml
+12
-0
No files found.
src/main/java/com/baosight/hggp/core/dao/DaoUtils.java
View file @
0de5a647
...
@@ -12,7 +12,9 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -12,7 +12,9 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -59,6 +61,37 @@ public class DaoUtils {
...
@@ -59,6 +61,37 @@ public class DaoUtils {
}
}
/**
/**
* insertBatch method.
*
* @param sql
* @param rows
*/
public
static
void
batchInsert
(
String
sql
,
List
rows
)
{
// 创建人部门
List
<
String
>
orgIds
=
UserSessionUtils
.
getOrgId
();
AssertUtils
.
isEmpty
(
orgIds
,
"当前用户未绑定部门,无法操作数据,请联系管理员!"
);
String
depCode
=
orgIds
.
get
(
0
);
for
(
Object
row
:
rows
)
{
if
(
row
instanceof
DaoEPBase
)
{
DaoEPBase
daoEPBase
=
(
DaoEPBase
)
row
;
try
{
BeanUtils
.
setProperty
(
daoEPBase
,
"depCode"
,
depCode
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"写入创建人部门编码失败"
,
e
);
}
setCreator
(
daoEPBase
);
}
else
if
(
row
instanceof
Map
)
{
Map
map
=
(
Map
)
row
;
map
.
put
(
"depCode"
,
depCode
);
setCreator
(
map
);
}
}
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"rows"
,
rows
);
DaoBase
.
getInstance
().
insert
(
sql
,
paramMap
);
}
/**
* update method.
* update method.
*
*
* @param sql
* @param sql
...
...
src/main/java/com/baosight/xservices/xs/service/ServiceXS3201B.java
View file @
0de5a647
...
@@ -124,11 +124,12 @@ public class ServiceXS3201B extends ServiceEPBase {
...
@@ -124,11 +124,12 @@ public class ServiceXS3201B extends ServiceEPBase {
dbMainAuth
.
put
(
"subjectId"
,
groupId
);
dbMainAuth
.
put
(
"subjectId"
,
groupId
);
dbMainAuth
.
put
(
"recCreator"
,
UserSessionUtils
.
getLoginName
());
dbMainAuth
.
put
(
"recCreator"
,
UserSessionUtils
.
getLoginName
());
dbMainAuth
.
put
(
"recCreateTime"
,
DateUtils
.
shortDateTime
());
dbMainAuth
.
put
(
"recCreateTime"
,
DateUtils
.
shortDateTime
());
dbMainAuth
.
put
(
"archiveFlag"
,
0
);
dbMainAuth
.
put
(
"sortIndex"
,
0
);
dbMainAuth
.
put
(
"sortIndex"
,
0
);
return
dbMainAuth
;
return
dbMainAuth
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
filterAuths
))
{
if
(
CollectionUtils
.
isNotEmpty
(
filterAuths
))
{
DaoUtils
.
insertBatch
(
"XS07.i
nsert"
,
filterAuths
);
DaoUtils
.
batchInsert
(
"XS07.batchI
nsert"
,
filterAuths
);
}
}
}
}
}
}
...
...
src/main/java/com/baosight/xservices/xs/sql/XS07.xml
View file @
0de5a647
...
@@ -30,6 +30,18 @@
...
@@ -30,6 +30,18 @@
)
)
</insert>
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO ${platSchema}.XS_AUTHORIZATION (
SUBJECT_ID, SUBJECT_TYPE, OBJECT_ID, OBJECT_TYPE, OPERATION_TYPE, REC_CREATOR,
REC_CREATE_TIME, ARCHIVE_FLAG, SORT_INDEX
) VALUES
<iterate
open=
"("
conjunction=
"), ("
close=
")"
property=
"rows"
>
#rows[].subjectId#, #rows[].subjectType#, #rows[].objectId#, #rows[].objectType#,
#rows[].operationType#, #rows[].recCreator#, #rows[].recCreateTime#,
#rows[].archiveFlag#, #rows[].sortIndex#
</iterate>
</insert>
<select
id=
"authorizationExists"
resultClass=
"java.util.HashMap"
>
<select
id=
"authorizationExists"
resultClass=
"java.util.HashMap"
>
SELECT * FROM ${platSchema}.XS_AUTHORIZATION
SELECT * FROM ${platSchema}.XS_AUTHORIZATION
WHERE 1=1
WHERE 1=1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment