yxhxj2006

          常用鏈接

          統(tǒng)計(jì)

          最新評(píng)論

          ibatis 開(kāi)發(fā)指南 3

          ibatis的調(diào)試相對(duì)困難,出錯(cuò)的時(shí)候主要依據(jù)是log4生成的log文件和.net的出錯(cuò)提示,這方面要能比較熟練的看懂. 
          下面這個(gè)配置基本上包含了最復(fù)雜的功能:分頁(yè)\搜索\排序\緩存\傳值Hash表\返回hash表\動(dòng)態(tài)sql 
          如果對(duì)下面這段配置能信手粘來(lái)的話,那開(kāi)發(fā)速度將會(huì)大大的提升. 
          <statement id="XinxiTable_SelectAll" listClass="ArrayList" >
          resultMap="SimpleXinxi" parameterClass="Hashtable" cacheModel="xinxi-cache" > 
          SELECT 
          <dynamic prepend="top"> 
          <isNotEqual prepend="top" property="TopNum" compareValue = "0"> 
          $TopNum$ 
          </isNotEqual> 
          </dynamic> 

          FROM 
          (select a.[iXinxiID],a.[sXinxiTitle],a.[iXinxiClassId],b.[sClassName], 
          a.[dXinxiDate],a.[dXinxiYxq],a.[iXinxiHits],a.[sXinxiUser],a.[sRedirectUrl], 
          ROW_NUMBER() OVER( 
          <dynamic prepend="order by"> 
          <isEqual prepend="order by" property="Sort" compareValue = "0"> 
          a.iXinxiID desc 
          </isEqual> 
          <isEqual prepend="order by" property="Sort" compareValue = "1"> 
          a.iXinxiID asc 
          </isEqual> 
          <isEqual prepend="order by" property="Sort" compareValue = "2"> 
          a.iXinxiHits desc 
          </isEqual> 
          <isEqual prepend="order by" property="Sort" compareValue = "3"> 
          a.iXinxiHits asc 
          </isEqual> 
          </dynamic> 
          ) as row 
          FROM 
          [dbo].[XinxiTable] as a,[dbo].[XinxiClass] as b 
          <dynamic prepend="where"> 
          <isParameterPresent> 
          <isNotEmpty prepend="and" property="XinxiType" > 
          a.[iXinxiState]= $XinxiType$ 
          </isNotEmpty> 
          <isNotEqual prepend="and" property="XinxiClass" compareValue = "0"> 
          a.[iXinxiClassID]= $XinxiClass$ 
          </isNotEqual> 
          <isEqual prepend="and" property="SearchType" compareValue = "1"> 
          a.[sXinxiTitle] LIKE '%$Keyword$%' 
          </isEqual> 
          <isEqual prepend="and" property="SearchType" compareValue = "2"> 
          (a.[sXinxiTitle] LIKE '%$Keyword$%' or a.[sXinxiContent] LIKE '%$Keyword$%') 
          </isEqual> 
          </isParameterPresent> 
          </dynamic> 
          and a.iXinxiClassId=b.iClassId 
          )a 
          <dynamic prepend="where"> 
          <isParameterPresent> 
          <isEqual prepend="and" property="IsPage" compareValue = "1"> 
          row between $PageLower$ and $PageUpper$ 
          </isEqual> 
          </isParameterPresent> 
          </dynamic> 
          </statement> 

          posted on 2012-09-20 00:55 奮斗成就男人 閱讀(406) 評(píng)論(0)  編輯  收藏 所屬分類: J2EE

          主站蜘蛛池模板: 湄潭县| 淮南市| 福泉市| 盐山县| 新绛县| 鲜城| 米脂县| 山东省| 慈溪市| 通城县| 吴堡县| 永宁县| 开鲁县| 七台河市| 白朗县| 榆林市| 岳普湖县| 鄂托克前旗| 钦州市| 阳东县| 驻马店市| 大足县| 大埔县| 开原市| 交口县| 凤城市| 巴里| 中西区| 林芝县| 永丰县| 玛纳斯县| 泰顺县| 北票市| 大埔县| 江山市| 隆昌县| 冀州市| 兴山县| 榆林市| 青冈县| 望江县|