| | |
| | | } |
| | | |
| | | public void getAccessory(){ |
| | | String soql = 'SELECT Name,id,parentId,ContentType from Attachment where parentId = :parentId order by createddate desc'; |
| | | List<Attachment> acc = Database.query(soql); |
| | | Map<String,String> identifierMap = new Map<String,String>(); |
| | | // parentId = 'a2K0l000000wyICEAY'; |
| | | |
| | | //lwc改造 |
| | | List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId |
| | | FROM ContentDocumentLink |
| | | WHERE LinkedEntityId = :parentId]; |
| | | List<ID> fileIDs = new List<ID>(); |
| | | for (ContentDocumentLink docLink : cdlList) { |
| | | fileIDs.add(docLink.ContentDocumentId); |
| | | } |
| | | List<ContentVersion> acc = [SELECT Id,Title,VersionData, ContentDocumentId,FileType |
| | | FROM ContentVersion WHERE ContentDocumentId IN : fileIDs]; |
| | | Map<ID, String> identifierMap = new Map<ID, String>(); |
| | | // for (ContentVersion docLink : acc) { |
| | | // identifierMap.put(docLink.ContentDocumentId, docLink.Title+docLink.FileType); |
| | | // } |
| | | |
| | | // String soql = 'SELECT Name,id,parentId,ContentType from Attachment where parentId = :parentId order by createddate desc'; |
| | | // List<Attachment> acc = Database.query(soql); |
| | | //Map<String,String> identifierMap = new Map<String,String>(); |
| | | if(acc != null && acc.size() > 0){ |
| | | for(Integer i = 0;i<acc.size();i++){ |
| | | if(acc[i].Name.substring(0,1)=='A'){ |
| | | acc[i].ContentType = '经销商'; |
| | | identifierMap.put(acc[i].ContentType,acc[i].ContentType); |
| | | }else if(acc[i].Name.substring(0,1)=='H'){ |
| | | acc[i].ContentType = '医院'; |
| | | identifierMap.put(acc[i].ContentType,acc[i].ContentType); |
| | | if(acc[i].Title.substring(0,1)=='A'){ |
| | | acc[i].Description = '经销商'; |
| | | identifierMap.put(acc[i].Description,acc[i].Description); |
| | | }else if(acc[i].Title.substring(0,1)=='H'){ |
| | | acc[i].Description = '医院'; |
| | | identifierMap.put(acc[i].Description,acc[i].Description); |
| | | }else{ |
| | | acc[i].ContentType = ''; |
| | | acc[i].Description = ''; |
| | | } |
| | | acccData.add(new AccessoryData(acc[i])); |
| | | } |
| | |
| | | * 为了方便前端table获取值 |
| | | */ |
| | | class AccessoryData { |
| | | public Attachment accessory { get; set; } |
| | | public ContentVersion accessory { get; set; } |
| | | public Boolean canEdit { get; private set; } |
| | | public Boolean hasError { get; private set; } |
| | | public Boolean hasFieldError { get; private set; } |
| | |
| | | //复选框id值 |
| | | public String chk { get;set; } |
| | | |
| | | public AccessoryData(Attachment record) { |
| | | public AccessoryData(ContentVersion record) { |
| | | accessory = record; |
| | | canEdit = true; |
| | | hasError = false; |