美文网首页我爱编程
MyBatis多个参数查询

MyBatis多个参数查询

作者: Goson_Zhong | 来源:发表于2018-04-15 13:07 被阅读0次

    一:单个参数

    DAO层:public List searchXXX(int id); 

    Bean.xml:<select   id="searchXXX"  parameterType="java.lang.Integer" resultType="Bean">

        select t.* from  tbalename  t  where  t.id=#{id}

    </select>

    二:多参数

    public List getXCarEventList(String carID, String eventCode);  

    <select  id="getList"  resultType="Bean">//多参数不用parameterType

     select t.* from car_event where id = #{0} and name = #{1}  //改用#{index},是第几个就用第几个的索引

    </select>

    三、Map封装多参数

    相关文章

      网友评论

        本文标题:MyBatis多个参数查询

        本文链接:https://www.haomeiwen.com/subject/ahydkftx.html