Mybatis使用bind元素进行模糊查询,不用在乎数据库是mysql还是oracle从而提高可移植性

使用bind元素传递多个参数

public List<Student> findStudents(@Param("studentName")String studentName,@Param("note")String note)

<select  >
    <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>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-09-19
  • 2022-01-23
猜你喜欢
  • 2022-02-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2022-03-05
  • 2021-12-05
相关资源
相似解决方案