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

fix searchClass

parent e5268415
Pipeline #24846 passed with stage
in 1 minute 47 seconds
...@@ -396,8 +396,7 @@ class InstitutionSubService extends Service { ...@@ -396,8 +396,7 @@ class InstitutionSubService extends Service {
// 先查询机构名称的 // 先查询机构名称的
const institutionList = await ctx.classModel.V5.CourseV5Institution.findAll({ where: { name: { $like: `%${word}%` }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'name' ], raw: true }); const institutionList = await ctx.classModel.V5.CourseV5Institution.findAll({ where: { name: { $like: `%${word}%` }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'name' ], raw: true });
const institutionIds = R.pluck('id', institutionList); const institutionIds = R.pluck('id', institutionList);
let classList = await ctx.classModel.V5.CourseV5Class.findAll({ where: { $or: [{ name: { $like: `%${word}%` } }, { institution_id: { $in: institutionIds } }], status: 1, is_deleted: 0 }, attributes: [ 'id', 'name', 'logo', 'price_type', 'mode', 'price', 'age', 'institution_id' ], raw: true });
let classList = await ctx.classModel.V5.CourseV5Class.findAll({ where: { $or: [{ name: { $like: `%${word}%` } }, { institution_id: { $in: institutionIds } }], status: 1, is_deleted: 0 }, attributes: [ 'id', 'name' ], raw: true });
classList = await this.formatClassList(classList); classList = await this.formatClassList(classList);
const ret = { const ret = {
......
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