You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
750 B
32 lines
750 B
'use strict'
|
|
|
|
async function findDetailBySNCard(ctx, next) {
|
|
try {
|
|
const { card } = ctx.params
|
|
const models = ctx.fs.dc.models
|
|
let option = {
|
|
attributes: ['id', 'name', 'equipment_no'],
|
|
where: { equipmentNo: {$like: `%${card}%`} },
|
|
include: [
|
|
{
|
|
required: true, //inner join
|
|
model: models.Project,
|
|
attributes: ['id', 'name'],
|
|
},
|
|
],
|
|
}
|
|
const rlst = await models.Point.findAll(option)
|
|
ctx.body = rlst
|
|
ctx.status = 200
|
|
} catch (error) {
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`)
|
|
ctx.status = 400
|
|
ctx.body = {
|
|
message: '根据设备sn号查询相关信息失败',
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
findDetailBySNCard,
|
|
}
|
|
|