Browse Source

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

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

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

@ -136,29 +136,9 @@ async function getResourceFileList(ctx, next) {
findObj.limit = Number(limit); findObj.limit = Number(limit);
findObj.offset = Number(page) * Number(limit); findObj.offset = Number(page) * Number(limit);
} }
const where = { fileName: { $not: null } };
if ("公司培训资料" == type) {
findObj.where = { fileName: { $not: null } };
if (departmentName) { if (departmentName) {
findObj.where.departmentName = departmentName; 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}%` };
}
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) { if (startTime && endTime) {
where.updateDate = { $between: [startTime, endTime] }; where.updateDate = { $between: [startTime, endTime] };
@ -167,6 +147,13 @@ async function getResourceFileList(ctx, next) {
where.fileName = { $like: `%${keyword}%` }; where.fileName = { $like: `%${keyword}%` };
} }
findObj.where = where; findObj.where = where;
if ("公司培训资料" == type) {
if (trainDate) { findObj.where.trainDate = trainDate; }
rlst = await models.TrainingInformation.findAndCountAll(findObj);
} else {
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); rlst = await models.DeptTraining.findAndCountAll(findObj);
} }

Loading…
Cancel
Save