bak20240513
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
select distinct role_name from platform_merchant_role
select * from platform_merchant_role where role_name like '服务商老板%'
员工表 platform_staff
角色员工关联表
platform_role_staff
里面有两个表id的关联关系
select * from platform_merchant_role
select * from platform_merchant_role_staff_relation
select * from platform_merchant_staff
select
role_code,role_name,merchantNo,staff_uuid,staff_name,staff_phone
from (
SELECT
pm.merchantNo,pm.id,
pm.merchant_name,
pm.merchant_abbreviation,
pm.province_code,pm.province_name,
pm.city_code,pm.city_name,
pm.district_code,pm.district_name,
pms.staff_uuid,pms.staff_name,pms.staff_phone,
pms.visible_inferior_mer 可见下级商户id,pms.visible_merchant_no 园区店可见下级4s店商户,
pmr.role_name,pmr.role_code
FROM
(
SELECT * FROM platform_merchant_role WHERE role_name = '服务商老板' AND del_flag = 0
) pmr
INNER JOIN platform_merchant_role_staff_relation pmrsr ON pmr.id = pmrsr.role_id
AND pmrsr.del_flag = 0
INNER JOIN platform_merchant_staff pms ON pmrsr.staff_id = pms.id
AND pms.del_flag = 0
left join platform_merchant pm
on pmr.merchant_id=pm.id and pm.del_flag = 0
)t
group by role_code,role_name,merchantNo,staff_uuid,staff_name
select * from platform_merchant pm where del_flag = 0
and province_code is null
select * from platform_merchant
select distinct merchant_id from platform_merchant_role
select * from platform_merchant
select distinct merchant_id from platform_merchant_staff
select distinct merchant_id from platform_merchant_role where del_flag = 0
and merchant_id in (
select id from platform_merchant
)
select distinct merchant_id from platform_merchant_staff where del_flag = 0
and merchant_id in (
select id from platform_merchant
)
select pm.merchant_name,pm.merchant_abbreviation,pm.merchant_address,pm.merchant_legal_person,pms.* from (
select * from platform_merchant_staff where del_flag = 0
)pms inner join platform_merchant pm
on pms.merchant_id=pm.id
where pms.staff_name like '%公司%'
order by pms.merchant_id