MyBatits之基本查询

来源:互联网 发布:我家我设计软件 编辑:程序博客网 时间:2024/05/20 04:09

     在映射文件上学SQL语句(id写dao文件对应方法)

     在Dao文件上根据执行那个方法从而对应那个sql语句(那个SQL语句)

     在到执行类里执行Dao文件的方法

      

    in查询

     

<select id="inselect"  resultTYpe="Emp">    select  * from emp where empno in  <foreach collection="empnos" item="empno"open="(" separaor=","close=")">
    #{empno}
</foreach></select>

    本来是这样sql语句

      select * from emp where empno   in(?,?,?)

     collection指Dao层的那个参数

     foreach指对collection指Dao层的那个参数循环

      item指取出来的值

     意思是填充把每个问好(?,?,?)


原创粉丝点击