Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 键入带有顺序和位置的查找选项_Node.js_Sorting_Entity_Relationship_Typeorm - Fatal编程技术网

Node.js 键入带有顺序和位置的查找选项

Node.js 键入带有顺序和位置的查找选项,node.js,sorting,entity,relationship,typeorm,Node.js,Sorting,Entity,Relationship,Typeorm,我想通过表关系订购这个find函数 const [people, total] = await typePersonServiceInstance.find( { take, skip, where: (qb: any) => { qb.where('person.type IN (:...type)', { type }); qb.andWhere('person.status IN (:...status)', { status })

我想通过表关系订购这个find函数

const [people, total] = await typePersonServiceInstance.find(
  {
    take,
    skip,
    where: (qb: any) => {
      qb.where('person.type IN (:...type)', { type });
      qb.andWhere('person.status IN (:...status)', { status });
      if (query.search) {
        qb.andWhere(new Brackets((subQb) => {
          subQb.where('name like :name', { name: `%${query.search}%` });
          subQb.orWhere('fantasyName like :fantasyName', { fantasyName: `%${query.search}%` });
          subQb.orWhere('person.city like :city', { city: `%${query.search}%` });
          subQb.orWhere('person.state like :state', { state: `%${query.search}%` });
          subQb.orWhere('person.id = :id', { id: query.search });
        }));
      }
    },
    order: {
      person: {
        status: 'ASC'
      }
    }
  },
);
我面临的问题是,如果我尝试按
person
表中的某个属性排序,那么

order: {
  anyColumnFromTypePersonHere: 'ASC' | 'DESC'
}
它工作得很好,但如果我想按状态排序(这是person的一个属性),它将不起作用