Commit 3e9eb59de394e2010376671ff65bde27f7b680b0

Authored by YunaiV
1 parent 899e40de

crm:code review 数据权限的实现

sql/mysql/crm_menu.sql
1 --- ----------------------------  
2 --- 客户公海配置  
3 --- ----------------------------  
4 --- 菜单 SQL  
5 -INSERT INTO system_menu(  
6 - name, permission, type, sort, parent_id,  
7 - path, icon, component, status, component_name  
8 -)  
9 -VALUES (  
10 - '客户公海配置', '', 2, 0, 2397,  
11 - 'customer-pool-config', 'ep:data-analysis', 'crm/customerPoolConf/index', 0, 'CustomerPoolConf'  
12 -);  
13 -  
14 --- 按钮父菜单ID  
15 --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码  
16 -SELECT @parentId := LAST_INSERT_ID();  
17 -  
18 --- 按钮 SQL  
19 -INSERT INTO system_menu(  
20 - name, permission, type, sort, parent_id,  
21 - path, icon, component, status  
22 -)  
23 -VALUES (  
24 - '客户公海配置保存', 'crm:customer-pool-config:update', 3, 1, @parentId,  
25 - '', '', '', 0  
26 -);  
27 -  
28 -  
29 -  
30 -  
31 --- ----------------------------  
32 --- 客户限制配置管理  
33 --- ----------------------------  
34 --- 菜单 SQL  
35 -INSERT INTO system_menu(  
36 - name, permission, type, sort, parent_id,  
37 - path, icon, component, status, component_name  
38 -)  
39 -VALUES (  
40 - '客户限制配置管理', '', 2, 0, 2397,  
41 - 'customer-limit-config', '', 'crm/customerLimitConfig/index', 0, 'CrmCustomerLimitConfig'  
42 -);  
43 -  
44 --- 按钮父菜单ID  
45 --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码  
46 -SELECT @parentId := LAST_INSERT_ID();  
47 -  
48 --- 按钮 SQL  
49 -INSERT INTO system_menu(  
50 - name, permission, type, sort, parent_id,  
51 - path, icon, component, status  
52 -)  
53 -VALUES (  
54 - '客户限制配置查询', 'crm:customer-limit-config:query', 3, 1, @parentId,  
55 - '', '', '', 0  
56 -);  
57 -INSERT INTO system_menu(  
58 - name, permission, type, sort, parent_id,  
59 - path, icon, component, status  
60 -)  
61 -VALUES (  
62 - '客户限制配置创建', 'crm:customer-limit-config:create', 3, 2, @parentId,  
63 - '', '', '', 0  
64 -);  
65 -INSERT INTO system_menu(  
66 - name, permission, type, sort, parent_id,  
67 - path, icon, component, status  
68 -)  
69 -VALUES (  
70 - '客户限制配置更新', 'crm:customer-limit-config:update', 3, 3, @parentId,  
71 - '', '', '', 0  
72 -);  
73 -INSERT INTO system_menu(  
74 - name, permission, type, sort, parent_id,  
75 - path, icon, component, status  
76 -)  
77 -VALUES (  
78 - '客户限制配置删除', 'crm:customer-limit-config:delete', 3, 4, @parentId,  
79 - '', '', '', 0  
80 -);  
81 -INSERT INTO system_menu(  
82 - name, permission, type, sort, parent_id,  
83 - path, icon, component, status  
84 -)  
85 -VALUES (  
86 - '客户限制配置导出', 'crm:customer-limit-config:export', 3, 5, @parentId,  
87 - '', '', '', 0  
88 -);  
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
@@ -92,7 +92,7 @@ public class CrmCustomerController { @@ -92,7 +92,7 @@ public class CrmCustomerController {
92 } 92 }
93 93
94 // TODO @puhui999:合并到 receiveCustomer 94 // TODO @puhui999:合并到 receiveCustomer
95 - @PutMapping("/receive") 95 + @PutMapping("/receive-")
96 @Operation(summary = "领取客户公海数据") 96 @Operation(summary = "领取客户公海数据")
97 @Parameter(name = "id", description = "客户编号", required = true, example = "1024") 97 @Parameter(name = "id", description = "客户编号", required = true, example = "1024")
98 @PreAuthorize("@ss.hasPermission('crm:customer:update')") 98 @PreAuthorize("@ss.hasPermission('crm:customer:update')")
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/permission/CrmPermissionDO.java
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName; @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
9 import lombok.*; 9 import lombok.*;
10 10
11 /** 11 /**
12 - * Crm 数据权限 DO 12 + * CRM 数据权限 DO
13 * 13 *
14 * @author HUIHUI 14 * @author HUIHUI
15 */ 15 */
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
@@ -61,7 +61,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { @@ -61,7 +61,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
61 //CrmPermissionUtils.builderRightJoinQuery(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_CUSTOMER.getType(), userId); 61 //CrmPermissionUtils.builderRightJoinQuery(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_CUSTOMER.getType(), userId);
62 mpjLambdaWrapperX 62 mpjLambdaWrapperX
63 //.rightJoin("(SELECT t1.biz_id FROM crm_permission t1 WHERE (t1.biz_type = 1 AND t1.user_id = 1)) t2 on t.id = t2.biz_id"); 63 //.rightJoin("(SELECT t1.biz_id FROM crm_permission t1 WHERE (t1.biz_type = 1 AND t1.user_id = 1)) t2 on t.id = t2.biz_id");
64 - .rightJoin(CrmPermissionDO.class, CrmPermissionDO::getBizId, CrmCustomerDO::getId) 64 + .rightJoin(CrmPermissionDO.class, CrmPermissionDO::getBizId, CrmCustomerDO::getId) // TODO @puhui999:应该是 inner join?
65 .eq(CrmPermissionDO::getBizType, CrmBizTypeEnum.CRM_CUSTOMER.getType()) 65 .eq(CrmPermissionDO::getBizType, CrmBizTypeEnum.CRM_CUSTOMER.getType())
66 .eq(CrmPermissionDO::getUserId, userId); 66 .eq(CrmPermissionDO::getUserId, userId);
67 /** TODO @芋艿: 67 /** TODO @芋艿: