Commit dac926c3 authored by 任国军's avatar 任国军

fix category

parent 0323988c
Pipeline #27799 passed with stage
in 4 seconds
......@@ -415,7 +415,10 @@ class InstitutionSubService extends Service {
}
// 科目类型
if (!ctx.isEmpty(input.category)) {
const filterByCategory = await ctx.classModel.V5.CourseV5ClassToCat.findAll({ where: { cat_id: input.category, status: 1, is_deleted: 0 }, attributes: [ 'class_id' ] });
let categoryList = await ctx.classModel.V5.CourseV5Category.findAll({ where: { parent_id: input.category, type: 1, status: 1, is_deleted: 0 }, attributes: [ 'id' ] });
categoryList = R.pluck('id', categoryList);
categoryList.push(input.category);
const filterByCategory = await ctx.classModel.V5.CourseV5ClassToCat.findAll({ where: { cat_id: { $in: categoryList }, status: 1, is_deleted: 0 }, attributes: [ 'class_id' ] });
filterIds = flag ? _.intersection(filterIds, R.pluck('class_id', filterByCategory)) : R.pluck('class_id', filterByCategory);
flag = true;
}
......
......@@ -129,7 +129,7 @@ class OptionService extends Service {
const type = Number(input.type) || 1;
const filter = { where: { type, is_deleted: 0, status: 1 }, order: [[ 'sort', 'asc' ], [ 'id', 'asc' ]] };
if (type === 2) {
if (type === 2 || type === 1) {
filter.where.parent_id = parentId;
}
......
......@@ -377,7 +377,10 @@ class ReportService extends Service {
// 分类筛选
let category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: catId } });
category = ctx.isEmpty(category) ? 0 : category.bind;
tmpClassList = await ctx.classModel.V5.CourseV5ClassToCat.findAll({ where: { cat_id: category, status: 1, is_deleted: 0 }, attributes: [ 'class_id' ] });
let categoryList = await ctx.classModel.V5.CourseV5Category.findAll({ where: { parent_id: category, type: 1, status: 1, is_deleted: 0 }, attributes: [ 'id' ] });
categoryList = R.pluck('id', categoryList);
categoryList.push(category);
tmpClassList = await ctx.classModel.V5.CourseV5ClassToCat.findAll({ where: { cat_id: { $in: categoryList }, status: 1, is_deleted: 0 }, attributes: [ 'class_id' ] });
classIds = classFlag ? _.intersection(classIds, R.pluck('class_id', tmpClassList)) : R.pluck('class_id', tmpClassList);
// 年级筛选
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment