项目场景:
使用mybatis-plus 的@Select进行查询和过滤
问题描述
过滤的时候一直出现
There is no getter for property named ‘ew’ in ‘class com.baomidou.mybatisplus.core.conditions.query.QueryWrapper’
@Select("SELECT br.* " +
"FROM bookingrecord br " +
" LEFT JOIN message_record ON id = booking_record_id " +
" LEFT JOIN booking_data bd ON booking_id = id " +
" ${ew.customSqlSegment} AND ( booking_record_id IS NULL " +
" OR status = 'Failed') AND booking_id IS NULL;")
List<BookingRecord> getNewBookingRecord(@Param(Constants.WRAPPER) QueryWrapper<BookingRecord> ew );
原因分析:
1.可能没有使用@param(Constants.WAPPER)
2.在拼接的sql中没有使用
e
w
.
c
u
s
t
o
m
S
q
l
s
e
g
m
e
n
t
有
w
h
e
r
e
也没有使用
{ew.customSqlsegment}有where 也没有使用
ew.customSqlsegment有where也没有使用{ew.sqlsegment} 没有where
3.注意@param的包是mybatis下面的不是springboot下面的
解决方案:
导包导错了,将@param使用ibatis包下的既可(改了一天一直是找不到ew-.-)