feat: product_org_auth model; product_list queries authorized products via product_org_auth
This commit is contained in:
parent
4f5a81e646
commit
5f277949ae
76
models/product_org_auth.json
Normal file
76
models/product_org_auth.json
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"summary": [
|
||||||
|
{
|
||||||
|
"name": "product_org_auth",
|
||||||
|
"title": "产品授权机构表",
|
||||||
|
"primary": ["id"],
|
||||||
|
"catelog": "relation"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"title": "主键ID",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32,
|
||||||
|
"nullable": "no"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "product_id",
|
||||||
|
"title": "产品ID",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32,
|
||||||
|
"nullable": "no"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "org_id",
|
||||||
|
"title": "被授权机构ID",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32,
|
||||||
|
"nullable": "no"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "auth_source",
|
||||||
|
"title": "授权来源",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "auth_source_id",
|
||||||
|
"title": "来源记录ID",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "created_at",
|
||||||
|
"title": "创建时间",
|
||||||
|
"type": "datetime",
|
||||||
|
"nullable": "no"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
{
|
||||||
|
"name": "idx_poa_product",
|
||||||
|
"idxtype": "index",
|
||||||
|
"idxfields": ["product_id"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "idx_poa_org",
|
||||||
|
"idxtype": "index",
|
||||||
|
"idxfields": ["org_id"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "idx_poa_unique",
|
||||||
|
"idxtype": "unique",
|
||||||
|
"idxfields": ["product_id", "org_id", "auth_source"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"field": "product_id",
|
||||||
|
"table": "product",
|
||||||
|
"valuefield": "id",
|
||||||
|
"textfield": "product_name"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -28,7 +28,7 @@ if not ns.get('sort'):
|
|||||||
|
|
||||||
|
|
||||||
sql = '''select a.*, b.category_id_text, c.status_text, d.price_type_text, e.product_type_text
|
sql = '''select a.*, b.category_id_text, c.status_text, d.price_type_text, e.product_type_text
|
||||||
from (select * from product where 1=1 [[filterstr]]) a left join (select id as category_id,
|
from (select * from product where (org_id = ${userorgid}$ OR id IN (SELECT product_id FROM product_org_auth WHERE org_id = ${userorgid}$)) [[filterstr]]) a left join (select id as category_id,
|
||||||
name as category_id_text from product_category where has_product='1' AND status='1') b on a.category_id = b.category_id left join (select k as status,
|
name as category_id_text from product_category where has_product='1' AND status='1') b on a.category_id = b.category_id left join (select k as status,
|
||||||
v as status_text from appcodes_kv where id='product_status') c on a.status = c.status left join (select k as price_type,
|
v as status_text from appcodes_kv where id='product_status') c on a.status = c.status left join (select k as price_type,
|
||||||
v as price_type_text from appcodes_kv where id='product_price_type') d on a.price_type = d.price_type left join (select k as product_type,
|
v as price_type_text from appcodes_kv where id='product_price_type') d on a.price_type = d.price_type left join (select k as product_type,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user