吉安感知网项目-后端
xiebin
2026-01-12 2cd4bf987f9e98023bb9e44d3bd94d889e000b66
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
package org.sxkj.common.model;
 
import org.springblade.core.tool.utils.BeanUtil;
 
import java.io.Serializable;
 
/**
 * @Description 通用转换工具类
 * @Author AIX
 * @Date 2026/1/12 10:22
 * @Version 1.0
 */
public class GenericConverter implements Serializable {
 
    private static final long serialVersionUID = 1L;
 
    public static <S, T> T convert(S source, Class<T> targetType) {
        T target = BeanUtil.newInstance(targetType);
        BeanUtil.copy(source, target);
        return target;
    }
 
    public static <S, T> T copy(S source, T target) {
        BeanUtil.copy(source, target);
        return target;
    }
 
}