zoukankan      html  css  js  c++  java
  • ibatis常用的集中判断语句

    <isPropertyAvailable> 属性是存在
    <isNotPropertyAvailable> 属性不存在
    <isNull> 属性值是null
    <isEmpty> 判断Collection.size<1或String.length()<1
    <isEqual
    > 等于
    <isNotEqual> 不等于
    <isGreaterThan> 大于
    <isGreaterEqual> 大于等于
    <isLessThan> 小于
    <isLessEqual> 小于等于、

     <select id="selectAllProducts" parameterClass="Product" resultMap="ProductResult">
         select id,note from Product
           
    <dynamic prepend="WHERE">
           
    <!-- isNotNull判断参数是否存在,Integer类型 -->
                
    <isNotNull property="id">
                    
    <!-- isGreaterThan判断参数是否大于compareValue,isGreaterEquals是大于等于 -->
                    
    <isGreaterThan prepend=" and " property="id" compareValue="0">
                     id = #id#
                    
    </isGreaterThan>
                
    </isNotNull>
                
    <!-- isNotEmpty判断字串不为空,isEmpty可以判断字串为空 -->
                
    <isNotEmpty prepend=" and " property="note">
                
    <!-- 模糊查询不能用#,#在是用prepareStatement的?插入参数,$是文本替换 -->
                 note like '%$note$%'
                
    </isNotEmpty>
            
    </dynamic>
      
    </select>
      
    用Map传参数
      
      
    <select id="selectAllProducts" parameterClass="java.util.HashMap" resultMap="ProductResult">
         select id,note from Product
           
    <dynamic prepend="WHERE">
           
    <!-- isPropertyAvailable判断属性是否有效 -->
              
    <isPropertyAvailable property="id">
                
    <isNotNull property="id">
                    
    <!-- isLessThan判断参数是否小于compareValue,isLessEquals是小于等于 -->
                    
    <isLessThan prepend=" and " property="id" compareValue="10">
                     id = #id#
                    
    </isLessThan>
                
    </isNotNull>
              
    </isPropertyAvailable>
            
    </dynamic>
      
    </select>

  • 相关阅读:
    分析模式的位置
    SAP .Net Connector for C#
    NETBPM开源工作流讲座
    BW处理链的时间为什么会每天推迟2秒钟?
    如何在SubScreen中取得上一screen中的值
    flash弹出窗口被ie屏蔽的解决方法
    用Eclipse 开发Flex (配置安装Flex插件)
    rtmp和http方式在播放flv方面的各自优势和劣势
    FMS4 P2P直播解决方案
    [AS3]URLLoader+URLRequest+JPGEncoder实现BitmapData图片数据保存
  • 原文地址:https://www.cnblogs.com/liaomin416100569/p/9331950.html
Copyright © 2011-2022 走看看