• ibatis中的resultClass,parameterClass,resultMap,resultType的使用与区别


    parameterClass 是参数类。指定了参数的完整类名(包括包路径)。可通过别名避免每次重复书写冗长的类名。

    resultClass 是结果类,

    二、resultClass取值

    1.resultClass="Integer"//基本类型,或者是java.lang.Integer

    2.resultClass="com.sfbest.product.bean.ProductPicture"//Model对象

    3.resultClass="string"//基本类型,java.lang.String

    4.resultClass="long"//基本类型,java.lang.long

    5.resultClass="java.util.HashMap"//map集合

    //resultClass的用法如下:

    <select id="getCount" parameterClass="OrderManualItem" resultClass="java.lang.Integer">
    select count(*) from order_manual_item omi
    where omi.is_delete='N'
    </select>

    resultMap 是结果映射,需结合resultMap节点对映射关系加以定义。

    resultType   返回值类型,不需要映射直接使用

    <!-- 处方药催单SQL LYD -->
    <select id="selectUnTcPaidMobilesNew" parameterType="map" resultType="java.util.HashMap">
    select m.mobile as mobile,o.order_id as orderid
    from order_info o,member m
    where o.member_id=m.member_id and m.mobile is not null and o.payment_mode = 'KDFH'
    and o.is_paid != 'Y'
    and o.is_tc = 'Y'
    and o.order_state != (select code_id from sys_code
    where code_type_no = 'order_state'
    and code_no = 'cancel')
    and o.is_delete = 'N'
    and round(to_number(sysdate -to_date(o.commit_time, 'YYYY-MM-DD hh24:mi:ss')) * 24) &gt;= 12
    and round(to_number(sysdate -to_date(o.commit_time, 'YYYY-MM-DD hh24:mi:ss')) * 24) &lt;36
    </select>

    //注意:

    mybatis中,patamaterType 省略不写的时候,mybatis可以自动识别,

    patamaterType="int",

    patamaterType="String",//或者是patamaterType="string",

  • 相关阅读:
    数据库高并发
    Syslog+Fluentd+InfluxDB日志收集系统搭建
    EFK Stack容器部署
    Logstash过滤插件
    Collectd+InfluxDB+Grafana监控系统搭建
    Collectd基本使用
    Haproxy配置详解
    Kafka基本使用
    HDU-2087 剪花布条 字符串问题 KMP算法 查匹配子串
    POJ-2752 Seek the Name, Seek the Fame 字符串问题 KMP算法 求前后缀串相同数木
  • 原文地址:https://www.cnblogs.com/wangchuanfu/p/5877243.html
Copyright © 2020-2023  润新知