mybatis根据Map来查询数据

DAO层:

List findByMap(@Param("map") Map map);
Test:

@Test
    public void testMap() {
	    Map map = new HashMap();
	    map.put("id", 3);
	    map.put("username", "李四");
        List list = dao.findByMap(map);
        print(list);
    }

SQL日志:

Preparing: select * from t_user t where id = ? AND username = ? 
Parameters: 3(Integer), 李四(String)





你可能感兴趣的:(javaWeb,mybatis,mybatis传map参数)