yxhxj2006

          常用鏈接

          統計

          最新評論

          ibatis 開發指南 3

          ibatis的調試相對困難,出錯的時候主要依據是log4生成的log文件和.net的出錯提示,這方面要能比較熟練的看懂. 
          下面這個配置基本上包含了最復雜的功能:分頁\搜索\排序\緩存\傳值Hash表\返回hash表\動態sql 
          如果對下面這段配置能信手粘來的話,那開發速度將會大大的提升. 
          <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 奮斗成就男人 閱讀(407) 評論(0)  編輯  收藏 所屬分類: J2EE

          主站蜘蛛池模板: 台中市| 韩城市| 洮南市| 玉林市| 阳谷县| 安新县| 南川市| 灵丘县| 陆川县| 布尔津县| 吴川市| 延长县| 玉田县| 绍兴市| 通城县| 米林县| 昭苏县| 宁强县| 宁陕县| 贡嘎县| 屏东县| 沐川县| 井研县| 大邑县| 来安县| 南和县| 仁怀市| 新安县| 卢龙县| 通江县| 衡山县| 平泉县| 攀枝花市| 嫩江县| 萨嘎县| 芷江| 含山县| 公安县| 尖扎县| 嵊泗县| 政和县|