Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否新加一种生成方式?obj.setField(this.field) #13

Open
Lizecongs opened this issue Jun 26, 2022 · 0 comments
Open

能否新加一种生成方式?obj.setField(this.field) #13

Lizecongs opened this issue Jun 26, 2022 · 0 comments

Comments

@Lizecongs
Copy link

目前我们的实体转换都是在实体对象本身去做的 如下:

public class TeacherDto implements ObjectConvert {

private String id;

private String createBy;

private LocalDateTime createTime;

private String updateBy;

private LocalDateTime updateTime;

private String sysOrgCode;

private String name;

private String introduce;

private String bgImage;

private String headImage;

private Integer enable;

private Integer fakeAttentionNum;

private Integer pageNum;

private Integer pageSize;

@Override
public Teacher objectConvert() {
    Teacher eo = new Teacher();
    eo.setId(this.id);
    eo.setCreateBy(this.createBy);
    eo.setCreateTime(this.createTime);
    eo.setUpdateBy(this.updateBy);
    eo.setUpdateTime(this.updateTime);
    eo.setSysOrgCode(this.sysOrgCode);
    eo.setName(this.name);
    eo.setIntroduce(this.introduce);
    eo.setBgImage(this.bgImage);
    eo.setHeadImage(this.headImage);
    eo.setEnable(this.enable);
    eo.setFakeAttentionNum(this.fakeAttentionNum);
    return eo;
}

}

vo dto的实体对象都继承了 ObjectConvert接口 我只需要在objectConvert()方法中定义他们的转换关系即可

x.set(y.get) 的方式对我来说并不适用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant