const res = await this.db.collection('inventory,uni-id-users,returner').where(`state==${state}`).field(`name,id,weight,from,cpeople.nickname,cpoeple._id,outpeople.nickname,outpeople._id,created_at,_id.weight,_id.inventory_id`).get() // 直接关联order和book之后再过滤
// const inventory = this.db.collection('inventory').where('state==2').get()
// const res = await this.db.collection(inventory, 'uni-id-users').field('nickname').get() // 将获取的order表的临时表和book表进行联表查询
return {code:200,data:res.data}
},```
returner表
```{
"bsonType": "object",
"required": ["inventory_id"],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true,
"count": true
},
"properties": {
"_id": {
"description": "ID,系统自动生成",
"order": 0
},
"inventory_id": {
"bsonType": "string",
"label": "库存id",
"order": 1,
"trim": "both",
"permission": {
"read": true
}
},
"info": {
"bsonType": "object",
"label": "信息",
"errorMessage": {
"format": "{label}格式无效"
},
"order": 2
},
"weight": {
"bsonType": "double",
"label": "退货重量",
"errorMessage": {
"format": "{label}格式无效"
},
"permission": {
"read": true
},
"order": 3
},
"state": {
"bsonType": "int",
"label": "状态",
"errorMessage": {
"format": "{label}格式无效"
},
"order": 4,
"description": "1申请中2申请成功",
"exclusiveMinimum": true,
"exclusiveMaximum": true
}
}
}```
inventory表
```{
"bsonType": "object",
"required": ["name", "id", "cweight", "from", "cpeople", "created_at"],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true,
"count": true
},
"properties": {
"_id": {
"description": "ID,系统自动生成",
"order": 0,
"foreignKey": "returner.inventory_id"
},
"name": {
"bsonType": "object",
"label": "规格名称",
"order": 1
},
"id": {
"bsonType": "string",
"label": "批号",
"order": 2,
"trim": "both"
},
"weight": {
"bsonType": "double",
"label": "材料重量",
"order": 3,
"exclusiveMinimum": true,
"exclusiveMaximum": true
},
"from": {
"bsonType": "object",
"label": "来源单位",
"order": 4
},
"cpeople": {
"bsonType": "string",
"label": "入库人",
"forceDefaultValue": {
"$env": "uid"
},
"foreignKey": "uni-id-users._id",
"order": 5,
"trim": "both"
},
"outpeople": {
"bsonType": "string",
"label": "出库人",
"order": 8,
"foreignKey": "uni-id-users._id",
"trim": "both"
},
"state": {
"bsonType": "int",
"label": "状态",
"order": 9,
"description": "1入库2出库审核3出库4退货审核5退货",
"exclusiveMinimum": true,
"exclusiveMaximum": true,
"defaultValue": 1
},
"created_at": {
"bsonType": "timestamp",
"label": "创建日期",
"forceDefaultValue": {
"$env": "now"
},
"order": 10
},
"jian": {
"bsonType": "int",
"label": "副单位卷",
"order": 12,
"exclusiveMinimum": true,
"exclusiveMaximum": true
}
}
}···
- 发布:2023-11-30 21:13
- 更新:2023-11-30 21:13
- 阅读:211
产品分类: uniCloud/App
示例代码:
操作步骤:
运行代码
运行代码
预期结果:
返回[
{
"_id": [
],
"cpeople": [
{
"nickname": "asd1"
}
],
"created_at": 1701249953256,
"from": {
"_id": "65655eb9862066d0706e6781",
"bfullname": "张三供应商",
"btypeid": "0000100001",
"id": "0000100001",
"name": "张三供应商"
},
"id": "1701249953200",
"name": {
"_id": "651be05c55b3379a66938ef4",
"id": "000010000100001",
"name": "8.60.1",
"pfullname": "8.60.1",
"price": 2,
"ptypeid": "000010000100001"
},
"outpeople": [
{
"_id": "64f1e75ae0ec19bea11ec476",
"nickname": "asd1"
}
],
"weight": 2
}
]
返回[
{
"_id": [
],
"cpeople": [
{
"nickname": "asd1"
}
],
"created_at": 1701249953256,
"from": {
"_id": "65655eb9862066d0706e6781",
"bfullname": "张三供应商",
"btypeid": "0000100001",
"id": "0000100001",
"name": "张三供应商"
},
"id": "1701249953200",
"name": {
"_id": "651be05c55b3379a66938ef4",
"id": "000010000100001",
"name": "8.60.1",
"pfullname": "8.60.1",
"price": 2,
"ptypeid": "000010000100001"
},
"outpeople": [
{
"_id": "64f1e75ae0ec19bea11ec476",
"nickname": "asd1"
}
],
"weight": 2
}
]
实际结果:
返回报错objectName: "model", methodName: "getReturnReceivelist", params: Array(1), error: Error: 权限校验未通过,请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
返回报错objectName: "model", methodName: "getReturnReceivelist", params: Array(1), error: Error: 权限校验未通过,请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
bug描述:
三个链表查询报错权限错误,删掉returner表就可以了,returner表中是的权限是true,不明白什么权限问题
0 个回复