日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
iBATIS模糊查詢的實(shí)現(xiàn)實(shí)例淺析

iBATIS模糊查詢的實(shí)現(xiàn)是如何的呢?讓我們先看看例子,仿照J(rèn)ava的Spring+Ibatis+Struct用Castle+IBatisNet+Asp.net的開發(fā)框架的DAO的基類:BaseSqlMapDao內(nèi)定義了一個內(nèi)部類來輔助模糊查詢。內(nèi)部類代碼如下:

創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站設(shè)計制作、成都網(wǎng)站制作、杜爾伯特網(wǎng)絡(luò)推廣、重慶小程序開發(fā)、杜爾伯特網(wǎng)絡(luò)營銷、杜爾伯特企業(yè)策劃、杜爾伯特品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供杜爾伯特建站搭建服務(wù),24小時服務(wù)熱線:028-86922220,官方網(wǎng)址:www.cdcxhl.com

 
 
 
  1. protected internal  class KeyWordSearch   
  2.   {  
  3.    private IList keywordList = new ArrayList();  
  4.  
  5.    public KeyWordSearch(String keywords)   
  6.    {  
  7.     StringTokenizer splitter = new StringTokenizer(keywords, " ", false);  
  8.     string token = null;  
  9.  
  10.     IEnumerator enumerator = splitter.GetEnumerator();  
  11.  
  12.     while (enumerator.MoveNext())   
  13.     {  
  14.      token = (string)enumerator.Current;  
  15.      keywordList.Add("%" + token + "%");  
  16.     }  
  17.    }  
  18.  
  19.    public IList KeywordList   
  20.    {  
  21.     get  
  22.     {  
  23.      return keywordList;  
  24.     }  
  25.    }  
  26.   } 

在需要使用iBATIS模糊查詢的數(shù)據(jù)訪問類的方法中使用方法如下:

例如數(shù)據(jù)訪問類PersonInfoDao繼承自BaseSqlMapDao,方法

 
 
 
  1. ///   
  2.   /// 檢索求職者信息,根據(jù)關(guān)鍵字檢索  
  3.   ///   
  4.   public IList SearchPersonInfoList(string keywords)  
  5.   {  
  6.    object parameterObject = new KeyWordSearch(keywords);  
  7.    return this.ExecuteQueryForList("SearchPersonList", parameterObject);  
  8.   }  
  9.  
  10.  
  11.    select UserId,UserName,Sex,Birthday,Mobile,HomeTel,EMail,LivingArea,  
  12.             RegisteredLocus,GraduateSchool,MajorSpecialty,JobExperience,MonthlyPay,  
  13.             Special,Resume,city.code,city.name,person.NationId,Nation.NationName,  
  14.             person.JobId,job.jobName,person.degreeId,degree.DegreeName  
  15.             from Career_PersonInfo person ,Career_Nation nation,Career_Job job,Career_City city,Career_Degree degree  
  16.             where person.CityCode = city.code and person.NationId = nation.NationId and person.jobid = job.jobId  
  17.             and person.degreeId = degree.degreeId  
  18.                
  19.       
  20.      lower(job.jobName) like #KeywordList[]#   
  21.       
  22.      
  23.    

iBATIS模糊查詢的情況就向你介紹到這里,希望通過例子能夠使你對iBATIS模糊查詢的是實(shí)現(xiàn)有所幫助。

【編輯推薦】

  1. iBATIS映射文件基礎(chǔ)淺談
  2. iBATIS ParameterMap配置實(shí)例淺析
  3. iBATIS ResultMap基礎(chǔ)淺析
  4. iBATIS CacheModel使用淺析
  5. iBATIS分頁實(shí)例中ObjectDataSource的應(yīng)用淺析

網(wǎng)頁名稱:iBATIS模糊查詢的實(shí)現(xiàn)實(shí)例淺析
文章源于:http://www.dlmjj.cn/article/djegspo.html