| | |
| | | List<Rental_Apply__Share> rasList = new List<Rental_Apply__Share>(); |
| | | List<Id> deleteOfficeAssistantShare_nObjId_List = new List<Id>(); // 共享删除用 |
| | | List<Id> deleteApplyUserShare_nObjId_List = new List<Id>();// 20210727 ljh SFDC-C54C33 共享删除用 |
| | | Set<Id> shareSet = new Set<Id>(); // 20230301 ljh DB202302444522 add |
| | | for (Rental_Apply__c nObj : newList) { |
| | | Rental_Apply__c oObj = (null == this.oldMap) ? null : this.oldMap.get(nObj.Id); |
| | | // 服务部审批人 |
| | |
| | | ) { |
| | | deleteApplyUserShare_nObjId_List.add(nObj.Id); |
| | | if(nObj.SalesManager__c != null){ |
| | | shareSet.add(nObj.SalesManager__c);// 20230301 ljh DB202302444522 add |
| | | Rental_Apply__Share rasSalesManager = new Rental_Apply__Share( |
| | | RowCause = 'ApplyUserShare__c', |
| | | ParentId = nObj.Id, |
| | |
| | | rasList.add(rasSalesManager); |
| | | } |
| | | if(nObj.BuchangApprovalManagerSales__c != null){ |
| | | shareSet.add(nObj.BuchangApprovalManagerSales__c);// 20230301 ljh DB202302444522 add |
| | | Rental_Apply__Share rasBz = new Rental_Apply__Share( |
| | | RowCause = 'ApplyUserShare__c', |
| | | ParentId = nObj.Id, |
| | |
| | | rasList.add(rasBz); |
| | | } |
| | | if(nObj.ZongjianApprovalManager__c != null){ |
| | | shareSet.add(nObj.ZongjianApprovalManager__c);// 20230301 ljh DB202302444522 add |
| | | Rental_Apply__Share rasZj = new Rental_Apply__Share( |
| | | RowCause = 'ApplyUserShare__c', |
| | | ParentId = nObj.Id, |
| | |
| | | if(deleteOfficeAssistantShare_nObjId_List.size() > 0){ |
| | | soql += ' AND (RowCause = \'Office_Assistant__c\' AND ParentId =: deleteOfficeAssistantShare_nObjId_List) '; |
| | | if(deleteApplyUserShare_nObjId_List.size() > 0){ |
| | | soql += ' OR (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List)'; |
| | | // 20230301 ljh DB202302444522 update start |
| | | // soql += ' OR (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List)'; |
| | | soql += ' OR (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List'; |
| | | soql += ' and UserOrGroupId IN :shareSet)'; |
| | | // 20230301 ljh DB202302444522 update end |
| | | } |
| | | }else if(deleteApplyUserShare_nObjId_List.size() > 0){ |
| | | soql += ' AND (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List)'; |
| | | // 20230301 ljh DB202302444522 update start |
| | | // soql += ' AND (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List)'; |
| | | soql += ' AND (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List'; |
| | | soql += ' and UserOrGroupId IN :shareSet)'; |
| | | // 20230301 ljh DB202302444522 update end |
| | | } |
| | | List<Rental_Apply__Share> deleteShareList = new List<Rental_Apply__Share>(); |
| | | if(deleteOfficeAssistantShare_nObjId_List.size() > 0 || deleteApplyUserShare_nObjId_List.size() > 0){ |