Browse Source

(fixed)7516 无附件的内容不应该同步到资料库

master
周沫沫历险记 2 years ago
parent
commit
69e7a4641f
  1. 41
      api/app/lib/controllers/resourceRepository/index.js

41
api/app/lib/controllers/resourceRepository/index.js

@ -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);
}

Loading…
Cancel
Save