Mybatis的resultMap

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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值