6***@qq.com
6***@qq.com
  • 发布:2025-02-26 01:25
  • 更新:2025-02-26 01:25
  • 阅读:14

dbSearchFields uniCloud 模糊搜索字段

分类:uniCloud
const dbSearchFields = ['param'] // 模糊搜索字段,支持模糊搜索的字段列表。联表查询格式: 主表字段名.副表字段名,例如用户表关联角色表 role.role_name  

        getWhere() {  
            let that = this;  
            return dbSearchFields.map(name => new RegExp(that.query[name], 'i') + '.test(' + name + ')').join(' || ')  
        },  

            let newWheres =this.getWhere();    
            newWheres = '('+newWheres+') &&' + query;
0 关注 分享

要回复文章请先登录注册