Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
f8dadcdf
Commit
f8dadcdf
authored
May 20, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
ea6ef694
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
xggsve-common/app/base/api/impl/op/action.js
+3
-0
xggsve-common/app/base/db/dao.base.js
+17
-0
xggsve-common/app/base/service/impl/common/businessscopeSve.js
+14
-0
No files found.
xggsve-common/app/base/api/impl/op/action.js
View file @
f8dadcdf
...
...
@@ -77,6 +77,9 @@ class ActionAPI extends APIBase {
case
"businessscopeSave"
:
opResult
=
await
this
.
businessscopeSve
.
apiSave
(
action_body
);
break
;
case
"businessscopeBulkSave"
:
opResult
=
await
this
.
businessscopeSve
.
businessscopeBulkSave
(
action_body
);
break
;
case
"businessscopeInfo"
:
opResult
=
await
this
.
businessscopeSve
.
apiInfo
(
action_body
);
break
;
...
...
xggsve-common/app/base/db/dao.base.js
View file @
f8dadcdf
...
...
@@ -31,6 +31,23 @@ class Dao {
});
}
}
async
bulkCreate
(
objs
,
t
)
{
if
(
!
objs
||
objs
.
length
==
0
)
{
return
;
}
for
(
var
obj
of
objs
)
{
if
(
!
obj
.
id
&&
!
obj
.
autoIncrement
)
{
obj
.
id
=
await
this
.
redisClient
.
genrateId
(
this
.
modelName
);
}
}
if
(
t
)
{
return
await
this
.
model
.
bulkCreate
(
objs
,
{
transaction
:
t
});
}
else
{
return
await
this
.
model
.
bulkCreate
(
objs
);
}
}
static
getModelName
(
ClassObj
)
{
return
ClassObj
[
"name"
].
substring
(
0
,
ClassObj
[
"name"
].
lastIndexOf
(
"Dao"
)).
toLowerCase
()
}
...
...
xggsve-common/app/base/service/impl/common/businessscopeSve.js
View file @
f8dadcdf
...
...
@@ -124,6 +124,20 @@ class BusinessscopeService extends ServiceBase {
return
system
.
getResultSuccess
(
bsc
);
}
async
businessscopeBulkSave
(
params
)
{
try
{
let
list
=
params
.
list
;
if
(
!
list
||
list
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"缺少经营范围数据"
);
}
let
rs
=
await
this
.
dao
.
bulkCreate
(
list
);
return
system
.
getResultSuccess
(
rs
);
}
catch
(
e
)
{
console
.
log
(
e
.
stack
);
return
system
.
getResult
(
null
,
e
.
stack
);
}
}
async
page
(
params
)
{
var
currentPage
=
Number
(
params
.
currentPage
||
1
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
...
...
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