ibatis多条件查询

来源:互联网 发布:shipping test软件 编辑:程序博客网 时间:2024/05/18 00:20

方式一:

xml文件写法

<!-- user.xml --><select id="selectUsersByCondition" parameterClass="java.util.HashMap" resultMap="UserResult"><![CDATA[select  ID as id, NAME as name, AGE as agefrom t_user where id < #id# and age < #age#]]></select>

java代码写法

HashMap<String, Object> map = new HashMap<String, Object>();map.put("id", 5);map.put("age", 24);List list = sqlMapper.queryForList("selectUsersByCondition", map);

原创粉丝点击