UserEventConverters.java
1.36 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
package com.diligrp.assistant.logging.util;
import com.diligrp.assistant.logging.domain.UserEventDTO;
import com.diligrp.assistant.logging.model.UserEventDo;
import org.springframework.core.convert.converter.Converter;
public final class UserEventConverters {
public static final Converter<UserEventDTO, UserEventDo> DTO2DO = new DTO2DO();
public static final Converter<UserEventDo, UserEventDTO> DO2DTO = new DO2DTO();
private static class DTO2DO implements Converter<UserEventDTO, UserEventDo> {
@Override
public UserEventDo convert(UserEventDTO source) {
return (UserEventDo) source;
}
}
private static class DO2DTO implements Converter<UserEventDo, UserEventDTO> {
@Override
public UserEventDTO convert(UserEventDo source) {
UserEventDTO dto = new UserEventDTO();
dto.setGroupId(source.getGroupId());
dto.setModuleId(source.getModuleId());
dto.setAction(source.getAction());
dto.setObjectId(source.getObjectId());
dto.setObjectName(source.getObjectName());
dto.setEvent(source.getEvent());
dto.setWhen(source.getWhen());
dto.setUserId(source.getUserId());
dto.setUserName(source.getUserName());
dto.setCreatedTime(source.getCreatedTime());
return dto;
}
}
}