IBatis返回map类型数据
2015-02-04 17:54
169 查看
有时侯不想创建javabean,或者污染现有的javaBean对象,就需要返回Map类型的数据对象;
1)最简单的方法就是将查询到的字段,使用""进行引起来,这样就可以返回map类型了;
2)或者写成ResultMap,来进行字段的映射也是可以的;
例子如下:
1)最简单的方法就是将查询到的字段,使用""进行引起来,这样就可以返回map类型了;
2)或者写成ResultMap,来进行字段的映射也是可以的;
例子如下:
<select id="queryProductInfo" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> select a.marketproduct_code "productCode", a.marketproduct_name "productName", a.product_class "productClass", (select t.value_chinese_name from product_base_data t where t.collection_code = 'CPDL' and t.value_code = a.product_class) "productClassName", a.is_combined "isCombined", a.combind_relation "packageType", a.IS_SELF_CARD "isSelfCard", (select decode(count(1), 0, '0', '1') from package_info t1 where t1.id_marketproduct_info = a.id_marketproduct_info) "hasPackage", a.is_self_card "productKind", a.marketproduct_type "productType", b.least_copy_num "leastInusureAmout", b.top_copy_num "topInsureAmout", b.insure_period_lmt_of_mon "periodSetMonth", b.insure_period_lmt_of_day "periodSetDay", b.least_accept_insure_age "leastAcceptInusrAge", b.top_accept_insure_age "topAcceptInsurAge", a.target_type "targetType", b.PROFESSION_TYPE "professionType", b.SPECIAL_PROMISE "specialPromise", a.version "version" from marketproduct_info a,marketproduct_rule_param b, technic_product_info c where a.marketproduct_code = #marketproductCode# and a.version = #version# and a.id_marketproduct_info = b.id_marketproduct_info(+) and a.id_technic_product_info = c.id_technic_product_info </select>
<resultMap id="getItemsResult" class="java.util.HashMap"> <result property="itemName" column="item_name" /> <result property="itemValue" column="item_value" /> </resultMap> <select id="getItems" resultMap="getItemsResult"> select item_name, item_value from item_table </select>
相关文章推荐
- ibatis返回map类型数据
- mybatis查询如何返回List<Map>类型数据
- ibatis中返回Map类型
- mybatis返回map类型数据空值字段不显示(三种解决方法)
- ibatis.net查询float类型返回实体类或者ResultMap时无效的问题
- iBATIS SQL Maps之支持ParameterMap和ResultMap的数据类型的对照表。
- Java技术-将java中Map类型数据转化为json数据并以Ajax形式返回
- mybatis返回map类型数据空值字段不显示(三种解决方法)
- mybatis返回map类型数据空值字段不显示(三种解决方法)
- mybatis返回map类型数据空值字段不显示(三种解决方法)
- mybatis返回map类型数据空值字段不显示(三种解决方法)
- MyBatis查询返回Map类型数据
- mybatis返回map类型数据空值字段不显示(三种解决方法)
- mybatis返回map类型数据空值字段不显示
- Ibatis 返回datatable数据类型案例
- mybatis返回map类型数据空值字段不显示
- ibatis中直执行sql,返回存储Map的List类型
- Mybatis_ 返回List<Map<K,V>> 结构类型数据
- Hibernate使用原生sql返回Map类型结果集的方法
- request('id')语句,返回的是什么类型的数据