<select id="selHisSettlement" resultType="org.his.beans.HisSettlement">
select * from HisSettlement
<where>
<if test="StartDate!=null and StartDate!=''">
AND POSJYSJ >= #{StartDate}
</if>
<if test="EndDate!=null and EndDate!=''">
AND POSJYSJ <= #{EndDate}
</if>
</where>
</select>
public String selHis(@Param("StartDate")String StartDate,@Param("EndDate")String EndDate) {
try {
List<HisSettlement> settlement = service.selHisSettlement(StartDate, EndDate);
@Param注解应该写在 selHisSettlement 这个方法的参数上。而不是外面的那个方法。
试一下去掉非空的if判断
public List<HisSettlement> selHisSettlement(@Param("StartDate")String StartDate,@Param("EndDate")String EndDate)
是这样写的吗?改好之后记得重启服务器,是在不行使用{0},{1}代替它们试下呢?