举例:标签:类字段,VoipConfigureEntity,private,entity,Integer,BeanUtils,VoipParameter,转换 From: https://www.cnblogs.com/immersed-in-the-deep-sea/p/18070629
VoipConfigureEntity voipConfigureEntity = xxx;
VoipParameter result = new VoipParameter();
BeanUtils.copyProperties(voipConfigureEntity, result);
因为BeanUtils不容易定位问题,所以要改出来
第一步,删去BeanUtils然后写成这样
VoipParameter result = new VoipParameter(voipConfigureEntity);
然后在VoipParameter里面写构造方法
第二步
将这么一部分给AI补充完成,它会自动帮你补完,补充完整后修改即可
public class VoipConfigureEntity {
@TableId(type = IdType.ASSIGN_UUID)
private String taskId;
private Integer dscp;
private String targetAgentId;
private Integer targetAgentPort;
private Integer recordType;
private Integer voipCodec;
private Integer duration;
private Integer deJitterBufferSize;
}
上面是我的Java类,帮我按照以下格式补充完这个构造方法
public VoipParameter(VoipConfigureEntity entity){
this.taskId=entity.getTaskId();
this.dscp=entity.getDscp();
}