package com.qianwen.smartman.modules.notify.convert;
|
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
import com.qianwen.smartman.modules.notify.dto.NotifyConfigDTO;
|
import com.qianwen.smartman.modules.notify.entity.NotifyConfigEntity;
|
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/convert/NotifyConfigConvertImpl.class */
|
public class NotifyConfigConvertImpl implements NotifyConfigConvert {
|
@Override // org.springblade.modules.notify.convert.NotifyConfigConvert
|
public NotifyConfigEntity convertToEntity(NotifyConfigDTO sources) {
|
if (sources == null) {
|
return null;
|
}
|
NotifyConfigEntity notifyConfigEntity = new NotifyConfigEntity();
|
if (sources.getId() != null) {
|
notifyConfigEntity.setId(Long.valueOf(Long.parseLong(sources.getId())));
|
}
|
notifyConfigEntity.setTenantId(sources.getTenantId());
|
notifyConfigEntity.setName(sources.getName());
|
notifyConfigEntity.setType(sources.getType());
|
notifyConfigEntity.setProvider(sources.getProvider());
|
notifyConfigEntity.setDescription(sources.getDescription());
|
Map<String, Object> map = sources.getConfiguration();
|
if (map != null) {
|
notifyConfigEntity.setConfiguration(new HashMap(map));
|
}
|
return notifyConfigEntity;
|
}
|
|
@Override // org.springblade.modules.notify.convert.NotifyConfigConvert
|
public NotifyConfigDTO convertToDto(NotifyConfigEntity sources) {
|
if (sources == null) {
|
return null;
|
}
|
NotifyConfigDTO notifyConfigDTO = new NotifyConfigDTO();
|
if (sources.getId() != null) {
|
notifyConfigDTO.setId(String.valueOf(sources.getId()));
|
}
|
notifyConfigDTO.setName(sources.getName());
|
notifyConfigDTO.setType(sources.getType());
|
notifyConfigDTO.setProvider(sources.getProvider());
|
notifyConfigDTO.setDescription(sources.getDescription());
|
Map<String, Object> map = sources.getConfiguration();
|
if (map != null) {
|
notifyConfigDTO.setConfiguration(new HashMap(map));
|
}
|
notifyConfigDTO.setTenantId(sources.getTenantId());
|
return notifyConfigDTO;
|
}
|
|
@Override // org.springblade.modules.notify.convert.NotifyConfigConvert
|
public List<NotifyConfigDTO> convertToDTOList(List<NotifyConfigEntity> sources) {
|
if (sources == null) {
|
return null;
|
}
|
List<NotifyConfigDTO> list = new ArrayList<>(sources.size());
|
for (NotifyConfigEntity notifyConfigEntity : sources) {
|
list.add(convertToDto(notifyConfigEntity));
|
}
|
return list;
|
}
|
}
|