resultMap

返回Map类型

属性
可以是固有属性、也可以定义扩展属性

关联
可以是其他表的字段,也可以关联其他select查询语句

<resultMap id="BaseResultMap" type="cn.com.hwasunsoft.lims.biz.model.extra.AssayOrderExt"><id column="ID" jdbcType="VARCHAR" property="id"/><result column="REG_NO" jdbcType="VARCHAR" property="regNo"/><result column="REG_WAY" jdbcType="VARCHAR" property="regWay"/><result column="REG_PEOPLE" jdbcType="VARCHAR" property="regPeople"/><result column="REG_TIME" jdbcType="TIMESTAMP" property="regTime"/><result column="REG_TEL" jdbcType="VARCHAR" property="regTel"/><result column="CUSTOMER_ID" jdbcType="VARCHAR" property="customerId"/><result column="SAMP_BIZ_MODE_ID" jdbcType="VARCHAR" property="sampBizModeId"/><result column="TEST_OBJECT_MODEL_ID" jdbcType="VARCHAR" property="testObjectModelId"/><result column="TEST_OBJECT_ID" jdbcType="VARCHAR" property="testObjectId"/><result column="LAB_ID" jdbcType="VARCHAR" property="labId"/><result column="ASSAY_TIME_LIMIT" jdbcType="NUMERIC" property="assayTimeLimit"/><result column="SAMPLE_SUBMIT_WAY" jdbcType="NUMERIC" property="sampleSubmitWay"/><result column="CONFIRMATION_STATUS" jdbcType="NUMERIC" property="confirmationStatus"/><result column="SAMPLING_WAY" jdbcType="NUMERIC" property="samplingWay"/><result column="NEED_SAMPLE_PREPARATION" jdbcType="NUMERIC" property="needSamplePreparation"/><result column="SAMP_REG_AMOUNT" jdbcType="NUMERIC" property="sampRegAmount"/><result column="TESTED_UNIT_ID" jdbcType="VARCHAR" property="testedUnitId"/><result column="SAMP_STAT" jdbcType="VARCHAR" property="sampStat"/><result column="ORDER_NAME" jdbcType="VARCHAR" property="orderName"/><result column="ORDER_REMARK" jdbcType="VARCHAR" property="orderRemark"/><result column="ORDER_NO" jdbcType="VARCHAR" property="orderNo"/><result column="DAILY_PLAN_NO" jdbcType="VARCHAR" property="dailyPlanNo"/><result column="CONTRACT_INFO_ID" jdbcType="VARCHAR" property="contractInfoId"/><result column="CONTRACT_CODE" jdbcType="VARCHAR" property="contractCode"/><result column="ORDER_DATE" jdbcType="TIMESTAMP" property="orderDate"/><result column="CUST_PHONE" jdbcType="VARCHAR" property="custPhone"/><result column="SAMPLE_DELIVERER_NAME" jdbcType="VARCHAR" property="sampleDelivererName"/><result column="SAMPLE_DELIVERER_PHONE" jdbcType="VARCHAR" property="sampleDelivererPhone"/><result column="ORDER_TYPE" jdbcType="NUMERIC" property="orderType"/><result column="SETTLEMENT_WAY" jdbcType="NUMERIC" property="settlementWay"/><result column="ASSAY_BIZ_CODE" jdbcType="VARCHAR" property="assayBizCode"/><result column="AUDIT_STATUS" jdbcType="NUMERIC" property="auditStatus"/><result column="SETTLE_STATUS" jdbcType="NUMERIC" property="settleStatus"/><result column="ASSAY_COST_COUNT" jdbcType="NUMERIC" property="assayCostCount"/><result column="ATTACHMENT" jdbcType="VARCHAR" property="attachment"/><result column="RECORD_STATUS" jdbcType="NUMERIC" property="recordStatus"/><result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/><result column="MODIFY_TIME" jdbcType="TIMESTAMP" property="modifyTime"/><result column="CONSOLIDATED_REPORT" jdbcType="NUMERIC" property="consolidatedReport"/><!-- ######################################### 扩展属性 ###################################################--><!--采样方式--><result column="SAMPLE_SUBMIT_WAY" jdbcType="NUMERIC" property="sampleSubmitWayEnum"typeHandler="cn.com.hwasunsoft.lims.core.enums.handler.CommonEnumHandler"/><!--记录状态--><result column="RECORD_STATUS" jdbcType="NUMERIC" property="recordStatusEnum"typeHandler="cn.com.hwasunsoft.lims.core.enums.handler.CommonEnumHandler"/><!--确认状态--><result column="CONFIRMATION_STATUS" jdbcType="NUMERIC" property="confirmationStatusEnum"typeHandler="cn.com.hwasunsoft.lims.core.enums.handler.CommonEnumHandler"/><!--结算方式--><result column="SETTLEMENT_WAY" jdbcType="NUMERIC" property="settlementWayEnum"javaType="cn.com.hwasunsoft.lims.biz.enums.AccountingWayEnum"typeHandler="cn.com.hwasunsoft.lims.core.enums.handler.CommonEnumHandler"/><!--审核状态--><result column="AUDIT_STATUS" jdbcType="NUMERIC" property="auditStatusEnum"typeHandler="cn.com.hwasunsoft.lims.core.enums.handler.CommonEnumHandler"/><!--结算状态--><result column="SETTLE_STATUS" jdbcType="NUMERIC" property="settleStatusEnum"typeHandler="cn.com.hwasunsoft.lims.core.enums.handler.CommonEnumHandler"/><!--综合报告显示(1是,0否)--><result column="CONSOLIDATED_REPORT" jdbcType="NUMERIC" property="consolidatedReportEnum"typeHandler="cn.com.hwasunsoft.lims.core.enums.handler.CommonEnumHandler"/><association column="CUSTOMER_ID" jdbcType="VARCHAR" property="customer" select="getCustomer"/><association column="TEST_OBJECT_ID" jdbcType="VARCHAR" property="testObject" select="getTestObject"/><association column="CONTRACT_INFO_ID" jdbcType="VARCHAR" property="contractInfo" select="getContractInfo"/><association column="LAB_ID" jdbcType="VARCHAR" property="lab" select="getLab"/><association column="ASSAY_TASK_INFO_ID" jdbcType="VARCHAR" property="assayTaskInfo"javaType="cn.com.hwasunsoft.lims.biz.model.AssayTaskInfo"><result column="ASSAY_TASK_INFO_ID" jdbcType="VARCHAR" property="id"/><result column="sample_No" jdbcType="VARCHAR" property="sampleNo"/><result column="ASSAY_RESULT_AUDITOR" jdbcType="VARCHAR" property="assayResultAuditor"/></association><association column="sample_id" jdbcType="VARCHAR" property="assayOrderSample"javaType="cn.com.hwasunsoft.lims.biz.model.AssayOrderSample"><result column="sample_id" jdbcType="VARCHAR" property="id"/><result column="sample_No" jdbcType="VARCHAR" property="sampleNo"/><result column="LAB_ID" jdbcType="VARCHAR" property="labId"/><result column="SAMP_BIZ_MODE_ID" jdbcType="VARCHAR" property="sampBizModeId"/><result column="TEST_OBJECT_ID" jdbcType="VARCHAR" property="testObjectId"/></association><association column="SAMP_BIZ_MODE_ID" jdbcType="VARCHAR" property="sampleBusinessModel"javaType="cn.com.hwasunsoft.lims.biz.model.SampleBusinessModel"><result column="SAMP_BIZ_MODE_ID" jdbcType="VARCHAR" property="id"/><result column="SAMP_BIZ_MODE_NAME" jdbcType="VARCHAR" property="sampBizModeName"/></association>
</resultMap><select id="getCustomer" parameterType="java.lang.String"resultType="cn.com.hwasunsoft.lims.biz.model.Customer">select * from INS_CUSTOMER where ID=#{id}
</select>
<select id="getTestObject" parameterType="java.lang.String"resultType="cn.com.hwasunsoft.lims.biz.model.TestObject">select * from DIC_TEST_OBJECT where ID=#{id}
</select>

Mybatis的resultMap相关推荐

  1. Mybatis的ResultMap的使用

    本篇文章通过一个实际工作中遇到的例子开始吧: 工程使用Spring+Mybatis+Mysql开发.具体的业务逻辑很重,对象之间一层一层的嵌套.和数据库表对应的是大量的model类,而和前端交互的是V ...

  2. 使用mybatis的resultMap进行复杂查询

    记录下mybatis的集合查询中碰到的问题 https://jaychang.iteye.com/blog/2357143 MyBatis ofType和javaType区别 https://blog ...

  3. mybatis的resultMap配置详解

    1.mybatis的实体类继承 参考资料: 1.mybatis中实体类,po类继承另一个po类的情况 2.mybatis中resultMap配置细则 实体类的继承的作用是:可以通过继承减少代码在实体类 ...

  4. MyBatis中resultMap详解

    MyBatis 中 resultMap 详解 resultMap 是 Mybatis 最强大的元素之一,它可以将查询到的复杂数据(比如查询到几个表中数据)映射到一个结果集当中.如在实际应用中,有一个表 ...

  5. 【MyBatis】resultMap和resultType的区别

    mybatis中resultMap和resultType的区别 mybatis中在查询进行select映射的时候,返回类型可以用resultType,也可以用resultMap.resultType是 ...

  6. mybatis 使用resultMap实现数据库的操作

    resultType:直接表示返回类型 resultMap:对外部resultMap的引用 二者不能同时使用 创建一个实体类Role和User public class Role {private I ...

  7. Mybatis:resultMap的万字使用总结

    结果映射(resultMap) resultMap 元素是 MyBatis 中最重要最强大的元素.它可以让你从 90% 的 JDBC ResultSets 数据提取代码中解放出来,并在一些情形下允许你 ...

  8. 04. Mybatis的resultMap基本应用

    resultMap 元素是 MyBatis 中最重要最强大的元素.它就是让你远离 90%的需要从结果集中取出数据的 JDBC 代码的那个东西,而且在一些情形下允许你做一些 JDBC 不支持的事情.事实 ...

  9. mybatis 使用in 查询时报错_使用mybatis的resultMap进行复杂查询 057

    拿到表的第一时间要学会分析陌生表的数据模型: 1.学习单表记录了什么东西(去学习理解需求) 2.学习单表重要字段的意义(优先学习不能为空的字段) 3.学习表与表之间的关系(一对一.一对多.多对多)通过 ...

  10. MyBatis使用resultMap自定义映射规则与关联映射

    一.写在前面 在MyBatis 的全局配置文件中我们可以通过在settings标签中设置 <setting name="mapUnderscoreToCamelCase" v ...

最新文章

  1. 小牛生产小牛的问题解决集粹
  2. 怎么成为优秀的软件模型设计者?
  3. Unet实现图像分割(二)
  4. phpcms ——模板标签详细使用说明
  5. iOS8 Size Classes的理解与使用
  6. 【任务脚本】0528京东618叠蛋糕任务脚本全自动脚本,京东任务全自动程序稳定运行,向大神致敬...
  7. 手机中的AR是怎么实现的
  8. tomcat中配置jndi数据源以便spring获取
  9. 物联网对石油燃气行业的作用
  10. PE安装win10系统
  11. Chapter 4 夫琅禾费衍射-Matlab仿真
  12. 如何将手机里的PDF文件转换成Word文档
  13. 「网络安全」将会是下一个风口?这个“下饭神剧”值得一看!
  14. python正态分布拟合_用python拟合正态分布(已开源)
  15. 【转】如何连接两台电脑同时上网
  16. 我的朋友老曹,居然用数据工具搞了这么多事
  17. Web——软件开发实践
  18. 女神节,用python给她画朵玫瑰 !
  19. 【cf】Codeforces 题解等汇总
  20. a后缀名是什么格式文件,怎么打开.a文件

热门文章

  1. phpcms黄页,不能选择行业。解决办法
  2. 【2017-07-03】JS连续删除table中的选中的多行数据
  3. 【HDU 5184】 Brackets (卡特兰数)
  4. vim常用命令总结 (转)
  5. iOS UITableView
  6. 【转】centos安装vim7.4
  7. Heartbeat,来点真的
  8. 如何通过Keil将程序正确的下载进flash中
  9. 区块链BaaS云服务(35)亦笔科技ODRChain使用场景
  10. 趣链 BitXHub跨链平台 (10)跨链自治