Mapper <if>사용 경험


<if test="classPoint != null and classPoint != ''">

WHERE class.kids_class_cd = #{classPoint}

</if>

<if test="teacherPoint != null and teacherPoint != ''">

WHERE report.registrant = #{teacherPoint}

</if>

<if test="reportPoint != null and reportPoint != ''">

WHERE division.report_cd = #{reportPoint};

</if>

null을 넘겨주는것도 같은데 알고보니 and classPoint != '' 추가로 공백까지 잡아주니까 더 확실하게 처리가 됌