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
89e1bfdf
Commit
89e1bfdf
authored
Sep 10, 2020
by
兰国旗
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gsb-marketplat-mag' of gitlab.gongsibao.com:jiangyong/zhichan into gsb-marketplat-mag
parents
836e5946
993dd16a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
25 deletions
+39
-25
gsb-marketplat-mag/app/base/db/impl/aggregation/producttypeDao.js
+22
-22
gsb-marketplat-mag/app/base/db/models/aggregation/bottommenuconfig.js
+4
-1
gsb-marketplat-mag/app/base/db/models/aggregation/secondlevelneedconfig.js
+3
-0
gsb-marketplat-mag/app/base/service/impl/aggregation/productSve.js
+2
-2
gsb-marketplat-mag/app/base/service/impl/aggregation/producttypeSve.js
+8
-0
No files found.
gsb-marketplat-mag/app/base/db/impl/aggregation/producttypeDao.js
View file @
89e1bfdf
...
...
@@ -4,30 +4,30 @@ class ProducttypeDao extends Dao {
constructor
()
{
super
(
Dao
.
getModelName
(
ProducttypeDao
));
}
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"
;
//
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 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 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
;
}
//
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
;
gsb-marketplat-mag/app/base/db/models/aggregation/bottommenuconfig.js
View file @
89e1bfdf
...
...
@@ -21,7 +21,10 @@ module.exports = (db, DataTypes) => {
strategy_date
:
{
type
:
DataTypes
.
INTEGER
},
strategy_time
:
{
strategy_time_start
:
{
type
:
DataTypes
.
STRING
},
strategy_time_end
:
{
type
:
DataTypes
.
STRING
},
button_type
:
{
...
...
gsb-marketplat-mag/app/base/db/models/aggregation/secondlevelneedconfig.js
View file @
89e1bfdf
...
...
@@ -24,6 +24,9 @@ module.exports = (db, DataTypes) => {
recommend_product
:
{
type
:
DataTypes
.
JSON
},
link_url
:
{
type
:
DataTypes
.
STRING
},
},
{
paranoid
:
true
,
//假的删除
...
...
gsb-marketplat-mag/app/base/service/impl/aggregation/productSve.js
View file @
89e1bfdf
...
...
@@ -57,12 +57,12 @@ class ProductService extends ServiceBase {
* @returns {Promise<void>}
*/
async
getProductsByType
(
pobj
){
const
type
=
await
this
.
producttypeDao
.
findOne
({
nam
e
:
pobj
.
typeName
},[]);
const
type
=
await
this
.
producttypeDao
.
findOne
({
cod
e
:
pobj
.
typeName
},[]);
if
(
!
type
){
return
system
.
getResultFail
(
-
1
,
'获取产品类型数据失败'
);
}
let
products
=
await
this
.
dao
.
model
.
findAll
({
attributes
:[
"name"
],
attributes
:[
"
code"
,
"
name"
],
where
:{
product_type_id
:
type
.
id
},
raw
:
true
});
return
system
.
getResult
(
products
)
...
...
gsb-marketplat-mag/app/base/service/impl/aggregation/producttypeSve.js
View file @
89e1bfdf
...
...
@@ -7,6 +7,14 @@ class ProducttypeService extends ServiceBase {
}
async
findAndCountAll
(
obj
)
{
let
res
=
await
this
.
dao
.
findAndCountAll
(
obj
);
if
(
obj
&&
obj
.
search
&&
obj
.
search
.
p_id
===
0
&&
res
&&
res
.
results
&&
res
.
results
.
rows
&&
res
.
results
.
rows
.
length
>
0
){
for
(
var
i
=
0
;
i
<
res
.
results
.
rows
.
length
;
i
++
){
if
(
res
.
results
.
rows
[
i
].
id
){
var
count
=
await
this
.
dao
.
findCount
({
where
:
{
p_id
:
res
.
results
.
rows
[
i
].
id
}
});
res
.
results
.
rows
[
i
].
dataValues
.
childCount
=
count
;
}
}
}
return
system
.
getResultSuccess
(
res
);
}
async
create
(
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