自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

iBATIS動態(tài)查詢的實現(xiàn)淺析

開發(fā) 后端
iBATIS動態(tài)查詢是如何實現(xiàn)的呢?我們將會在本篇文章內向你介紹iBATIS動態(tài)查詢的情況。

iBATIS動態(tài)查詢的實現(xiàn)主要是在iBATIS中使用安全的拼接語句,動態(tài)查詢

iBATIS比JDBC的優(yōu)勢之一,安全高效

iBATIS動態(tài)查詢實例:(說明文字在注釋中)

  1. ﹤ select  id ="selectAllProducts"  parameterClass ="Product"  resultMap ="ProductResult" ﹥   
  2.  select id,note from Product  
  3.      ﹤ dynamic  prepend ="WHERE" ﹥   
  4.      ﹤!--  isNotNull判斷參數(shù)是否存在,Integer類型  --﹥   
  5.           ﹤ isNotNull  property ="id" ﹥   
  6.               ﹤!--  isGreaterThan判斷參數(shù)是否大于compareValue,isGreaterEquals是大于等于  --﹥   
  7.               ﹤ isGreaterThan  prepend =" and "  property ="id"  compareValue ="0" ﹥   
  8.              id = #id#  
  9.               ﹤/ isGreaterThan ﹥   
  10.           ﹤/ isNotNull ﹥   
  11.           ﹤!--  isNotEmpty判斷字串不為空,isEmpty可以判斷字串為空  --﹥   
  12.           ﹤ isNotEmpty  prepend =" and "  property ="note" ﹥   
  13.           ﹤!--  模糊查詢不能用#,#在是用prepareStatement的?插入?yún)?shù),$是文本替換  --﹥   
  14.          note like '%$note$%' 
  15.           ﹤/ isNotEmpty ﹥   
  16.       ﹤/ dynamic ﹥   
  17. ﹤/ select ﹥ 

iBATIS動態(tài)查詢解釋:

用Map傳參數(shù)

  1. ﹤ select  id ="selectAllProducts"  parameterClass ="java.util.HashMap"  resultMap ="ProductResult" ﹥   
  2.   select id,note from Product  
  3.       ﹤ dynamic  prepend ="WHERE" ﹥   
  4.       ﹤!--  isPropertyAvailable判斷屬性是否有效  --﹥   
  5.          ﹤ isPropertyAvailable  property ="id" ﹥   
  6.            ﹤ isNotNull  property ="id" ﹥   
  7.                ﹤!--  isLessThan判斷參數(shù)是否小于compareValue,isLessEquals是小于等于  --﹥   
  8.                ﹤ isLessThan  prepend =" and "  property ="id"  compareValue ="10" ﹥   
  9.               id = #id#  
  10.                ﹤/ isLessThan ﹥   
  11.            ﹤/ isNotNull ﹥   
  12.          ﹤/ isPropertyAvailable ﹥   
  13.        ﹤/ dynamic ﹥   
  14.  ﹤/ select ﹥ 

iBATIS動態(tài)查詢幾個常用屬性

 ﹤ isPropertyAvailable ﹥  屬性是存在

 ﹤ isNotPropertyAvailable ﹥  屬性不存在

 ﹤ isNull ﹥  屬性值是null

 ﹤ isEmpty ﹥  判斷Collection.size ﹤ 1 或String.length()﹤1

 ﹤isEqual ﹥  等于

 ﹤ isNotEqual ﹥  不等于

 ﹤ isGreaterThan ﹥  大于

 ﹤ isGreaterEqual ﹥  大于等于

 ﹤ isLessThan ﹥  小于

 ﹤ isLessEqual ﹥  小于等于

iBATIS動態(tài)查詢的相關信息就向你介紹到這里,希望對你了解iBATIS動態(tài)查詢有所幫助。

【編輯推薦】

  1. iBATIS ParameterMap配置實例淺析
  2. iBATIS ResultMap基礎淺析
  3. iBATIS CacheModel使用淺析
  4. iBATIS分頁實例中ObjectDataSource的應用淺析
  5. iBATIS模糊查詢的實現(xiàn)實例淺析
責任編輯:仲衡 來源: cnblogs
相關推薦

2009-07-15 17:58:07

iBATIS 動態(tài)映射

2009-07-22 11:27:36

iBATIS模糊查詢

2009-09-14 19:14:51

LINQ動態(tài)查詢

2009-07-20 10:06:07

iBATIS.net查詢方式

2009-07-15 13:11:25

ibatis動態(tài)查詢

2009-07-20 14:56:18

iBATIS.NET動態(tài)選擇DAO

2009-07-21 11:12:00

iBATIS配置

2009-07-17 10:59:59

iBATIS接口

2009-07-16 10:23:30

iBATIS工作原理

2009-07-22 10:42:59

iBATIS Cach

2009-09-15 09:19:22

linq動態(tài)條件

2009-07-17 10:32:45

iBATIS MapB

2009-07-22 10:03:11

iBATIS Resu

2009-07-16 09:14:26

iBATIS DAO

2009-07-20 18:00:16

iBATIS DAO事

2009-07-15 17:19:31

iBATIS Ecli

2009-07-22 16:02:14

iBATIS參數(shù)

2009-07-17 09:44:40

iBATIS教程

2009-07-22 15:01:01

iBATIS SQLM

2009-07-16 13:08:09

iBATIS快速創(chuàng)建應
點贊
收藏

51CTO技術棧公眾號