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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
3 deletions
+49
-3
DaoUtils.java
src/main/java/com/baosight/hggp/core/dao/DaoUtils.java
+35
-2
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;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -57,7 +59,38 @@ public class DaoUtils {
}
DaoBase
.
getInstance
().
insert
(
sql
,
obj
);
}
/**
* 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.
*
...
...
@@ -106,7 +139,7 @@ public class DaoUtils {
});
return
DaoBase
.
getInstance
().
insertBatch
(
sql
,
parameters
);
}
/**
* 创建人工号 创建人姓名 创建人岗号 创建时刻
*
...
...
src/main/java/com/baosight/xservices/xs/service/ServiceXS3201B.java
View file @
0de5a647
...
...
@@ -124,11 +124,12 @@ public class ServiceXS3201B extends ServiceEPBase {
dbMainAuth
.
put
(
"subjectId"
,
groupId
);
dbMainAuth
.
put
(
"recCreator"
,
UserSessionUtils
.
getLoginName
());
dbMainAuth
.
put
(
"recCreateTime"
,
DateUtils
.
shortDateTime
());
dbMainAuth
.
put
(
"archiveFlag"
,
0
);
dbMainAuth
.
put
(
"sortIndex"
,
0
);
return
dbMainAuth
;
}).
collect
(
Collectors
.
toList
());
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 @@
)
</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 * FROM ${platSchema}.XS_AUTHORIZATION
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