1.配置文件中的寫法
<if test="startTime !=null and startTime !='' "> <![CDATA[ and createTime >= #{startTime} ]]> </if> <if test="endTime !=null and endTime!='' " > <![CDATA[ and createTime <= #{endTime} ]]> </if>
2.Java代碼中參數的傳遞
》實體類中的成員變量
private Date startTime;
private Date endTime;
entity.setStartTime(startTime);
entity.setEndTime(endTime);
》使用map集合封裝參數
Map<String, Object> map = new HashMap<String, Object>();
map.put("startTime", startTime);
map.put("endTime", endTime);
IT技術和行業交流群 417691667