Browse Source

根据id查询巡检模板

master
liujiangyong 2 years ago
parent
commit
0893266ac5
  1. 5
      api/app/lib/controllers/patrolManage/patrolTemplate.js

5
api/app/lib/controllers/patrolManage/patrolTemplate.js

@ -4,7 +4,7 @@ async function getPatrolTemplate (ctx, next) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { userId } = ctx.fs.api const { userId } = ctx.fs.api
const { limit, page } = ctx.query; const { limit, page, id } = ctx.query;
let options = { let options = {
order: [['id', 'desc']], order: [['id', 'desc']],
include: [{ include: [{
@ -18,6 +18,9 @@ async function getPatrolTemplate (ctx, next) {
attributes: ['name'], attributes: ['name'],
}] }]
}; };
if (id) {
options.where.id = id;
}
if (limit) { if (limit) {
options.limit = Number(limit); options.limit = Number(limit);
} }

Loading…
Cancel
Save