对象如下:
public class DateRange {
private Integer startDate;
private Integer endDate;
}
DAO 如下:
@Select("SELECT MIN(date) AS startDate, MAX(date) AS endDate FROM atable WHERE aid = #{aid}")
DateRange getDateRangeById(@Param("aid") int aid);
Client 结果如下:
*************************** 1. row ***************************
startDate: NULL
endDate: NULL
1 row in set (0.00 sec)
当没有 aid 对应的记录时,我期望 DateRange 是存在的, startDate 、 endDate 为 null ,但是实际情况是 DateRange 为 null ,这令我很困惑,求助各位 V 友出现这种结果的原因。