|
@ -3,7 +3,7 @@ |
|
|
async function getCameraProject (ctx, next) { |
|
|
async function getCameraProject (ctx, next) { |
|
|
try { |
|
|
try { |
|
|
const models = ctx.fs.dc.models; |
|
|
const models = ctx.fs.dc.models; |
|
|
const { limit, page, orderBy, orderDirection } = ctx.query |
|
|
const { limit, page, orderBy, orderDirection, keyword, abilityId, type, venderId } = ctx.query |
|
|
const { userId, token } = ctx.fs.api |
|
|
const { userId, token } = ctx.fs.api |
|
|
|
|
|
|
|
|
let findOption = { |
|
|
let findOption = { |
|
@ -28,6 +28,22 @@ async function getCameraProject (ctx, next) { |
|
|
if (page && limit) { |
|
|
if (page && limit) { |
|
|
findOption.offset = page * limit |
|
|
findOption.offset = page * limit |
|
|
} |
|
|
} |
|
|
|
|
|
if (keyword) { |
|
|
|
|
|
findOption.where.$or = [{ |
|
|
|
|
|
name: { $like: `%${keyword}%` } |
|
|
|
|
|
}, { |
|
|
|
|
|
serialNo: { $like: `%${keyword}%` } |
|
|
|
|
|
}] |
|
|
|
|
|
} |
|
|
|
|
|
if (type) { |
|
|
|
|
|
findOption.where.type = type |
|
|
|
|
|
} |
|
|
|
|
|
if (abilityId) { |
|
|
|
|
|
findOption.where.abilityId = abilityId |
|
|
|
|
|
} |
|
|
|
|
|
if (venderId) { |
|
|
|
|
|
findOption.where.venderId = venderId |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const cameraRes = await models.Camera.findAll(findOption) |
|
|
const cameraRes = await models.Camera.findAll(findOption) |
|
|
const total = await models.Camera.count({ |
|
|
const total = await models.Camera.count({ |
|
|