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
faa7f91b
Commit
faa7f91b
authored
Sep 09, 2020
by
兰国旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
laolan
parent
c9a8a2e4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
24 deletions
+47
-24
gsb-marketplat-mag/app/base/controller/impl/aggregation/producttypeCtl.js
+4
-0
gsb-marketplat-mag/app/base/db/impl/aggregation/producttypeDao.js
+28
-23
gsb-marketplat-mag/app/base/db/models/aggregation/rotationchart.js
+6
-1
gsb-marketplat-mag/app/base/service/impl/aggregation/producttypeSve.js
+4
-0
gsb-marketplat-mag/app/base/service/impl/aggregation/rotationchartSve.js
+5
-0
No files found.
gsb-marketplat-mag/app/base/controller/impl/aggregation/producttypeCtl.js
View file @
faa7f91b
...
...
@@ -6,6 +6,10 @@ class ProductTypeCtl extends CtlBase {
constructor
()
{
super
(
"aggregation"
,
CtlBase
.
getServiceName
(
ProductTypeCtl
));
}
async
findAndCountAll
(
obj
){
var
res
=
await
this
.
service
.
findAndCountAll
(
obj
);
return
res
;
}
async
create
(
pobj
,
qobj
,
req
)
{
pobj
.
company_id
=
req
&&
req
.
xctx
&&
req
.
xctx
.
companyid
?
req
.
xctx
.
companyid
:
""
;
const
up
=
await
this
.
service
.
create
(
pobj
);
...
...
gsb-marketplat-mag/app/base/db/impl/aggregation/producttypeDao.js
View file @
faa7f91b
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
ProducttypeDao
extends
Dao
{
constructor
(){
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
ProducttypeDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
ProducttypeDao
));
}
async
refQuery
(
qobj
)
{
var
w
=
qobj
.
refwhere
?
qobj
.
refwhere
:
{};
w
[
"p_id"
]
=
0
;
if
(
qobj
.
levelinfo
)
{
w
[
qobj
.
levelinfo
.
levelfield
]
=
qobj
.
levelinfo
.
level
;
}
if
(
qobj
.
parentinfo
)
{
w
[
qobj
.
parentinfo
.
parentfield
]
=
qobj
.
parentinfo
.
parentcode
;
}
//如果需要控制数据权限
if
(
qobj
.
datapriv
)
{
w
[
"id"
]
=
{
[
this
.
db
.
Op
.
in
]:
qobj
.
datapriv
};
}
if
(
qobj
.
likestr
)
{
w
[
qobj
.
fields
[
0
]]
=
{
[
this
.
db
.
Op
.
like
]:
"%"
+
qobj
.
likestr
+
"%"
};
return
this
.
model
.
findAll
({
where
:
w
,
attributes
:
qobj
.
fields
});
}
else
{
return
this
.
model
.
findAll
({
where
:
w
,
attributes
:
qobj
.
fields
});
async
findAndCountAll
(
req
)
{
var
params
=
{
// company_id: req.actionBody.company_id
company_id
:
10
};
var
returnRes
=
{
results
:
{
rows
:[],
count
:[]}
};
var
dataCount
=
"select count(1) as dataCount from mc_product_type where deleted_at is null and p_id = 0 and company_id = :company_id "
;
var
sql
=
"select * from mc_product_type where deleted_at is null and p_id = 0 and company_id = :company_id "
;
var
childData
=
"select *,count(1) as childCount from mc_product_type where p_id !=0 and company_id = :company_id group by p_id"
;
var
list
=
await
this
.
customQuery
(
sql
,
params
);
returnRes
.
results
.
rows
=
list
;
var
tmpResultCount
=
await
this
.
customQuery
(
dataCount
,
params
);
returnRes
.
results
.
count
=
tmpResultCount
&&
tmpResultCount
.
length
>
0
?
tmpResultCount
[
0
].
dataCount
:
0
;
var
childrenData
=
await
this
.
customQuery
(
childData
,
params
);
for
(
var
i
=
0
;
i
<
childrenData
.
length
;
i
++
){
returnRes
.
results
.
rows
[
i
].
childCount
=
childrenData
&&
childrenData
[
i
].
childCount
>
0
?
childrenData
[
i
].
childCount
:
0
;
}
console
.
log
(
returnRes
)
return
returnRes
;
}
}
module
.
exports
=
ProducttypeDao
;
module
.
exports
=
ProducttypeDao
;
gsb-marketplat-mag/app/base/db/models/aggregation/rotationchart.js
View file @
faa7f91b
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
const
pic_type
=
{
"1"
:
"列表头图"
,
"2"
:
"首页轮播图"
};
/**
* 轮播图表
*/
...
...
@@ -25,7 +26,11 @@ module.exports = (db, DataTypes) => {
type
:
DataTypes
.
STRING
},
pic_type
:
{
type
:
DataTypes
.
STRING
type
:
DataTypes
.
STRING
,
set
:
function
(
val
)
{
this
.
setDataValue
(
"pic_type"
,
val
);
this
.
setDataValue
(
"pic_type_name"
,
pic_type
[
val
]);
}
},
sequence
:
{
type
:
DataTypes
.
INTEGER
...
...
gsb-marketplat-mag/app/base/service/impl/aggregation/producttypeSve.js
View file @
faa7f91b
...
...
@@ -5,6 +5,10 @@ class ProducttypeService extends ServiceBase {
constructor
()
{
super
(
"aggregation"
,
ServiceBase
.
getDaoName
(
ProducttypeService
));
}
async
findAndCountAll
(
obj
)
{
let
res
=
await
this
.
dao
.
findAndCountAll
(
obj
);
return
system
.
getResultSuccess
(
res
);
}
async
create
(
pobj
)
{
let
code
=
await
this
.
getBusUid
(
"mmc"
);
pobj
.
code
=
code
;
...
...
gsb-marketplat-mag/app/base/service/impl/aggregation/rotationchartSve.js
View file @
faa7f91b
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
{
json
}
=
require
(
"sequelize"
);
class
RotationchartService
extends
ServiceBase
{
constructor
()
{
super
(
"aggregation"
,
ServiceBase
.
getDaoName
(
RotationchartService
));
...
...
@@ -39,6 +40,10 @@ class RotationchartService extends ServiceBase {
if
(
!
pobj
.
name
)
{
pobj
.
name
=
res
.
name
;
}
if
(
!
pobj
.
pic_type
&&
!
pobj
.
pic_type_name
)
{
pobj
.
pic_type
=
2
;
pobj
.
pic_type_name
=
"首页轮播图"
;
}
return
system
.
getResultSuccess
(
this
.
dao
.
update
(
pobj
));
}
}
...
...
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