Mybatis標簽bind用法
阿新 • • 發佈:2018-11-20
標簽 resultmap ram result and 數據庫 使用 dst code
Mybatis使用bind元素進行模糊查詢,不用在乎數據庫是mysql還是oracle從而提高可移植性
使用bind元素傳遞多個參數
public List<Student> findStudents(@Param("studentName")String studentName,@Param("note")String note) <select id="getStudent" resultMap="studentMap" > <bind name="pattern_studentName" value="‘%‘ + studentName + ‘%‘" /> <bind name="pattern_note" value="‘%‘ + note + ‘%‘" /> select id, cnname, sex, selfcard_no, note from t_student where student_name like #{pattern_studentName} and note like #{note} </select>
Mybatis標簽bind用法