如果条件都是一个entity的属性,那么parameterType = 实体类名字即可。resultMap无所谓,想要什么类型就什么类型,网上有很多demo,一看就会。如果条件不是一个entity中的属性,可以parameterType = map类型。

解决方案 »

  1.   

    用map使用参数传进去,使用动态sql,如下,在每个字段后面描述jdbcType(对应数据库的字段类型)
    <select id="selectOne" resultMap="resultjcm" parameterType="map">
      select * from table_name 
        where
         ID=#{ID,jdbcType=CHAR},
         NAME=#{NAME,jdbcType=VARCHAR}
     </select>
      

  2.   

    public  List<HashMap>  getOne(int a, String b);<select id="getOne" resultMap="hashmap" >
      select * from table_name 
        where ID=#{a}
            and NAME=#{b}
     </select>