|
|
@ -136,37 +136,24 @@ async function getResourceFileList(ctx, next) { |
|
|
|
findObj.limit = Number(limit); |
|
|
|
findObj.offset = Number(page) * Number(limit); |
|
|
|
} |
|
|
|
const where = { fileName: { $not: null } }; |
|
|
|
if (departmentName) { |
|
|
|
where.departmentName = departmentName; |
|
|
|
} |
|
|
|
if (startTime && endTime) { |
|
|
|
where.updateDate = { $between: [startTime, endTime] }; |
|
|
|
} |
|
|
|
if (keyword) { |
|
|
|
where.fileName = { $like: `%${keyword}%` }; |
|
|
|
} |
|
|
|
findObj.where = where; |
|
|
|
|
|
|
|
if ("公司培训资料" == type) { |
|
|
|
findObj.where = { fileName: { $not: null } }; |
|
|
|
if (departmentName) { |
|
|
|
findObj.where.departmentName = departmentName; |
|
|
|
} |
|
|
|
if (trainDate) { |
|
|
|
findObj.where.trainDate = trainDate; |
|
|
|
} |
|
|
|
if (startTime && endTime) { |
|
|
|
findObj.where.updateDate = { $between: [startTime, endTime] }; |
|
|
|
} |
|
|
|
if (keyword) { |
|
|
|
findObj.where.fileName = { $like: `%${keyword}%` }; |
|
|
|
} |
|
|
|
if (trainDate) { findObj.where.trainDate = trainDate; } |
|
|
|
rlst = await models.TrainingInformation.findAndCountAll(findObj); |
|
|
|
} else { |
|
|
|
if (departmentName) { |
|
|
|
const where = { |
|
|
|
departmentName: departmentName |
|
|
|
} |
|
|
|
if (trainDate) { |
|
|
|
where.trainDate = { $between: [moment(trainDate).startOf('month').format('YYYY-MM-DD HH:mm:ss'), moment(trainDate).endOf('month').format('YYYY-MM-DD HH:mm:ss')] }; |
|
|
|
} |
|
|
|
if (startTime && endTime) { |
|
|
|
where.updateDate = { $between: [startTime, endTime] }; |
|
|
|
} |
|
|
|
if (keyword) { |
|
|
|
where.fileName = { $like: `%${keyword}%` }; |
|
|
|
} |
|
|
|
findObj.where = where; |
|
|
|
if (trainDate) { |
|
|
|
findObj.where.trainDate = { $between: [moment(trainDate).startOf('month').format('YYYY-MM-DD HH:mm:ss'), moment(trainDate).endOf('month').format('YYYY-MM-DD HH:mm:ss')] }; |
|
|
|
} |
|
|
|
rlst = await models.DeptTraining.findAndCountAll(findObj); |
|
|
|
} |
|
|
|