-
Notifications
You must be signed in to change notification settings - Fork 56
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
FETCHER.allFields select到DTO对象时,不包括重命名的行 #277
Comments
@swiftlei |
@swiftlei 如果需要这种模式我加一个注解dto上如果有这个注解就以property作为匹配自动映射 |
@swiftlei 其实这个写法只需要select(vo.class)和你现在是一样的不需要Select.of()这个主要是为手动别名或者多表下使用的 entityQuery.queryable(Table1Entity.class).where(...).select(Table1Entity.class, t -> Select.of(t.FETCHER.allFields())).toSQL()
//上下一致的
entityQuery.queryable(Table1Entity.class).where(...).select(Table1Entity.class).toSQL() |
好的,谢谢! |
你说的确实是非常有道理的,设计之初只考虑到了用户映射不一致属性时的问题并没有考虑到手动指定column这种模式算是一种忽略,后续我会认真考虑您提供的这种思路 |
假设table1的表结构为:
id,
name,
field1
Entity对象为
public class Table1Entity {
private Long id;
private String name;
@column(value = "field1")
private String field2;
}
DTO对象结构完全相同:
public class Table1Dto {
private Long id;
private String name;
private String field2;
}
则当查询 entityQuery.queryable(Table1Entity.class).where(...).select(Table1Entity.class, t -> Select.of(t.FETCHER.allFields())).toSQL()
输出的SQL的 select 中会包含 select id, name, field1 as field2 ...
但将 select 部分换成.select(Table1Dto.class, t -> Select.of(t.FETCHER.allFields())) 时,输出的 SQL 中的 select 部分只包含了id 和 name,不包含 field1 as field2 字段
The text was updated successfully, but these errors were encountered: