巴林闲侠
3 years ago
12 changed files with 209 additions and 6 deletions
@ -0,0 +1,42 @@ |
|||
'use strict'; |
|||
|
|||
async function statistic (ctx) { |
|||
try { |
|||
const models = ctx.fs.dc.models; |
|||
const { userId } = ctx.fs.api; |
|||
const { projectType } = ctx.query; |
|||
|
|||
let findOption = { |
|||
where: { |
|||
reportType: 'conserve', |
|||
}, |
|||
attributes: ['id', 'road', 'time', 'projectType', 'projectType'], |
|||
include: [{ |
|||
model: models.User, |
|||
attributes: ['name'] |
|||
}], |
|||
} |
|||
|
|||
if (projectType) { |
|||
findOption.where.projectType = projectType; |
|||
} |
|||
|
|||
const reportRes = await await models.Report.findAll(findOption) |
|||
|
|||
ctx.status = 200 |
|||
ctx.body = { |
|||
processed: reportRes.length, |
|||
reportList: reportRes, |
|||
} |
|||
} catch (error) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = { |
|||
message: typeof error == 'string' ? error : undefined |
|||
} |
|||
} |
|||
} |
|||
|
|||
module.exports = { |
|||
statistic, |
|||
}; |
@ -0,0 +1,9 @@ |
|||
INSERT INTO statistic (name, count, type) values ('客运车', 0, 'vehicle'); |
|||
INSERT INTO statistic (name, count, type) values ('标线', 0, 'road_manage'); |
|||
INSERT INTO statistic (name, count, type) values ('人行道', 0, 'road_manage'); |
|||
INSERT INTO statistic (name, count, type) values ('标志牌', 0, 'road_manage'); |
|||
INSERT INTO statistic (name, count, type) values ('防护栏', 0, 'road_manage'); |
|||
INSERT INTO statistic (name, count, type) values ('检查井', 0, 'road_manage'); |
|||
INSERT INTO statistic (name, count, type) values ('雨水口', 0, 'road_manage'); |
|||
INSERT INTO statistic (name, count, type) values ('路排名', 0, 'road_manage'); |
|||
INSERT INTO statistic (name, count, type) values ('养护责任牌', 0, 'road_manage'); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue