'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, }