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

[Gradle]使用mapstruct时导致编译错误 #281

Open
Gn3po4g opened this issue Nov 13, 2024 · 6 comments
Open

[Gradle]使用mapstruct时导致编译错误 #281

Gn3po4g opened this issue Nov 13, 2024 · 6 comments

Comments

@Gn3po4g
Copy link

Gn3po4g commented Nov 13, 2024

如果使用mapstruct时添加了返回类型为T的方法,那么与T类型有关的 queryable, leftjoin 等全部会报错。
比如

@Mapper(componentModel = "spring")
public interface RequestMapper {
    @BeanMapping(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    EviStation convert(Object request);
}

会导致

错误: 对于queryable(Class<EviStation>), 找不到合适的方法
        easyEntityQuery.queryable(EviStation.class);
                       ^
    方法 EasyEntityQuery.<TProxy#1,T#1>queryable(Class<T#1>)不适用
      (无法推断类型变量 TProxy#1,T#1
        (参数不匹配; Class<EviStation>无法转换为Class<T#2>))
    方法 EasyEntityQuery.<TProxy#3,T#3>queryable(String,Class<T#3>)不适用
      (无法推断类型变量 TProxy#3,T#3
        (实际参数列表和形式参数列表长度不同))
    方法 EasyEntityQuery.<TProxy#4,T#4>queryable(String,Class<T#4>,Collection<Object>)不适用
      (无法推断类型变量 TProxy#4,T#4
        (实际参数列表和形式参数列表长度不同))
  其中, TProxy#1,T#1,T#2,TProxy#2,TProxy#3,T#3,TProxy#4,T#4是类型变量:
    TProxy#1扩展已在方法 <TProxy#1,T#1>queryable(Class<T#1>)中声明的ProxyEntity<TProxy#1,T#1>
    T#1扩展已在方法 <TProxy#1,T#1>queryable(Class<T#1>)中声明的ProxyEntityAvailable<T#1,TProxy#1>
    T#2扩展ProxyEntityAvailable<T#2,TProxy#2>
    TProxy#2扩展ProxyEntity<TProxy#2,T#2>
    TProxy#3扩展已在方法 <TProxy#3,T#3>queryable(String,Class<T#3>)中声明的ProxyEntity<TProxy#3,T#3>
    T#3扩展已在方法 <TProxy#3,T#3>queryable(String,Class<T#3>)中声明的ProxyEntityAvailable<T#3,TProxy#3>
    TProxy#4扩展已在方法 <TProxy#4,T#4>queryable(String,Class<T#4>,Collection<Object>)中声明的ProxyEntity<TProxy#4,T#4>
    T#4扩展已在方法 <TProxy#4,T#4>queryable(String,Class<T#4>,Collection<Object>)中声明的ProxyEntityAvailable<T#4,TProxy#4>
@Gn3po4g
Copy link
Author

Gn3po4g commented Nov 13, 2024

T作为参数时也会导致同样的问题

@xuejmnet
Copy link
Collaborator

@Gn3po4g map struct和eq可以共存的编译的时候改一下配置一下文档有说明
http://www.easy-query.com/easy-query-doc/question.html#%E5%88%A0%E9%99%A4%E9%94%99%E8%AF%AF

image

@Gn3po4g
Copy link
Author

Gn3po4g commented Nov 13, 2024

gradle中顺序好像不会影响

@xuejmnet
Copy link
Collaborator

gradle中顺序好像不会影响

👌

@Gn3po4g
Copy link
Author

Gn3po4g commented Nov 13, 2024

改用lombok插件'io.freefair.lombok'导入lombok可以解决
神奇

@Gn3po4g Gn3po4g changed the title 使用mapstruct时导致编译错误 [Gradle]使用mapstruct时导致编译错误 Nov 13, 2024
@xuejmnet
Copy link
Collaborator

改用lombok插件'io.freefair.lombok'导入lombok可以解决 神奇

这样吗应该是编译插件互相影响导致的,群里有小伙伴是gradle也有maven用的话map-struct有用的原则上是没啥关系的具体的话没有案例所以也不太清楚可以加群到时候互相学习一下

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

2 participants