IBATIS中关于iterate和‘$’与‘#’的应用

一个包含List元素的HashMap参数赋给sqlMap
public int getCountById(String id, String title, List ids) throws Exception {  
        Map paramMap=new HashMap();  
        paramMap.put("id", id);  
        paramMap.put("title", title);  
        paramMap.put("ids",ids);  
        return (int) this.sqlMapClient.queryForObject("getCountById", paramMap);  
    }
上面的ids元素是一个List,里面包含了一个id列表。id和title都是String。

<select
           2.使用‘$’将参数名包起来。例如:name like ‘%#name#%’。我们的解决方法有2。(a)把name like ‘%#name#%’的
#换成$,即:name like ‘%$name$%’。(b)用||连接字符串的方式,写成,name like ‘%’|| #name#‘%’。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
  • 2021-09-23
  • 2021-09-17
  • 2021-11-25
  • 2022-12-23
猜你喜欢
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
相关资源
相似解决方案