• ibatis 传入xml Hashtable的应用以及动态字段出错的解决方法


    
    
    Hashtable Param = new Hashtable(); 
    List<string> List = new List<string>(); 
    List.Add("f2fa15cf-0cad-44e0-85f1-6c62de72dbcb");
    List.Add("b1138425-79db-4b74-b28d-53b07e607ae9");
    Param.Add("list", List);
    Param.Add("column", "id");
        <select id="GetList" resultMap=""  parameterClass="Hashtable"  >
          select
          id,Name
          from SYS_TALBE
         
          where $column$ in
          <iterate property="list"  conjunction="," open="(" close=")">
            #list[]#
          </iterate>    
        </select>    

    注:list类型 必须在循环的属性加   property="list"  也就是list的名字,不然循环遍历会索引溢出!(1个的时候会溢出,2个的时候正常,3个的时候就只会遍历2次)

    注:字段名动态,必须用 美元符号,值用井号,不然拼接起来就是  where 'id'='11111' 这个语句在sql是不允许的

  • 相关阅读:
    Minimum Path Sum
    Unique Paths II
    Unique Paths
    Rotate List
    Permutation Sequence
    Merge Intervals
    Jump Game
    Group Anagrams
    Combination Sum II
    评分
  • 原文地址:https://www.cnblogs.com/wdw31210/p/2834593.html
Copyright © 2020-2023  润新知