Ibatis中的isNotNull、isEqual、isEmpty的区别

isNull判断property字段是否是null
isEmpty判断property字段 是否是null 和 空字符串
isEqual相当于equals,数字用得多些,一般都是判断状态值


转载自:http://jun1986.iteye.com/blog/1402191

例子1:(isEqual)

<isEqual property="state" compareValue="0">< /isEqual><isEqual property="state" compareProperty="nextState">isEqual>

例子2:
传入的map或者类的属性name等于”1”吗,是就附加and和vvvv

<isEqual property="name" compareValue="1" prepend="and">
    vvvv = '哈哈'
< /isEqual>

传入的map或者类的属性name是null吗,是就附加and和vvvv = null

< isNull property="name" prepend="and">
    vvvv = null
< /isNull>

sqlmap

<select id="querySingleModelByOut"  parameterClass="com.hanpeng.base.phone.model.TBussinessNotice"   
    resultClass="com.hanpeng.base.phone.model.TBussinessNotice">  
    select * from (select row_.*, rownum rownum_ from (  
        SELECT  
            i.NOTICE_NUM  as noticeNum ,              
            i.BUSSINESS_ID  as bussinessId ,              
            i.STATE  as state ,           
            i.READ_DATE  as readDate ,  
            n.NOTICE_TITLE as noticeTitle ,           
            n.NOTICE_INFO as noticeInfo ,             
            n.CREATE_DATE as createDate ,             
            n.EMPLOYEE_ID as employeeId ,             
            n.NOTICE_TYPE as noticeType ,             
            n.NOTICE_SHOW_TYPE as noticeShowType ,            
            n.FINISH_DATE as finishDate ,             
            n.PUBLISH_DATE as publishDate   
        FROM  T_BUSSINESS_NOTICE i left join T_NOTICE n on n.NOTICE_NUM = i.NOTICE_NUM   
        WHERE  
        n.PUBLISH_DATE <= sysdate AND n.FINISH_DATE >= sysdate  
        " AND " property="bussinessId">   
            i.BUSSINESS_ID = #bussinessId#   
        " AND " property="state">   
            i.STATE = #state#   
        " AND " property="noticeShowType">   
            n.NOTICE_SHOW_TYPE = #noticeShowType#   
        property="saleBack" compareValue="10" prepend=" AND ">  
            n.NOTICE_TYPE!='25'  
        property="remittanceBank" compareValue="10" prepend=" AND ">  
            n.NOTICE_TYPE!='63'  
        property="remittanceOnline" compareValue="10" prepend=" AND ">  
            n.NOTICE_TYPE!='64'  
    )row_ where rownum <=1 ) where rownum_>=0  
select>  

你可能感兴趣的:(spring)