乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      ibatis in語句參數(shù)傳入方法

       liang1234_ 2020-02-28
       第一種:傳入?yún)?shù)僅有數(shù)組
             <select id='GetEmailList_Test'  resultClass='EmailInfo_'>
                  select *
                  from MailInfo with (nolock)
                  where ID in
                      <iterate open='(' close=')' conjunction=',' >
                          #[]#
                      </iterate>
              </select>
      調用
                  string[] strValue = new string[] { '1', '2', '3' };
                  Reader.QueryForList<EmailInfoModel>('WebApp_Ibatisnet.dao.GetEmailList_Test', strValue );

             第二種:傳入?yún)?shù)有數(shù)組,且有其他數(shù)據(jù)
              <select id='GetEmailList_Test3' parameterClass='TestIn' resultClass='EmailInfo_'>
                  select  top(#Count#)*
                  from MailInfo with (nolock)
                  where ID in
                  <iterate open='(' close=')' conjunction=',' property='ArrValue' >
                      #ArrValue[]#
                  </iterate>
              </select>
      調用
                  TestIn ti = new TestIn();
                  ti.Count = 1;
                  ti.ArrValue = strValue;
                  return Reader.QueryForList<EmailInfoModel>('WebApp_Ibatisnet.dao.GetEmailList_Test3', ti);
      實體類:
         public class TestIn
          {
              private int count;
              public int Count
              {
                  get { return count; }
                  set { count = value; }
              }
              private string[] arrValue;
              public string[] ArrValue
              {
                  get { return arrValue; }
                  set { arrValue = value; }
              }
          }

             第三種:in后面的數(shù)據(jù)確定,使用string傳入
              <select id='GetEmailList_Test2' parameterClass='TestIn' resultClass='EmailInfo_'>
                  select *
                  from MailInfo with (nolock)
                  where ID in
                  ($StrValue$)
              </select>
      調用
                      Reader.QueryForList<EmailInfoModel>('WebApp_Ibatisnet.dao.GetEmailList_Test2', '1,2,3');


      其他信息:
      Iterate的屬性:
      prepend -可被覆蓋的SQL語句組成部分,添加在語句的前面(可選)
      property -類型為java.util.List的用于遍歷的元素(必選)
      open -整個遍歷內容體開始的字符串,用于定義括號(可選)
      close -整個遍歷內容體結束的字符串,用于定義括號(可選)
      conjunction -每次遍歷內容之間的字符串,用于定義AND或OR(可選)
      <iterate>遍歷類型為java.util.List的元素。

        本站是提供個人知識管理的網絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報。
        轉藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多