mybatis select标签中resultMap和resultType作用区别

resultMap是取上面的resultMap封装好的数据表字段,resultType能直接写在domain和dto写的自己构造的Bean,
resultMap里写的应该是上面resultMap里的id值,resultType里写的是自己构造Bean的路径位置。下面是代码:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.edi.mapper.WsShipmentMapper">
    <resultMap id="BaseResultMap" type="com.edi.domain.WsShipment">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="shipment_id" jdbcType="BIGINT" property="shipmentId" />
        <result column="created_user" jdbcType="VARCHAR" property="createdUser" />
        <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
        <result column="last_updated_time" jdbcType="TIMESTAMP" property="lastUpdatedTime" />
        <result column="last_updated_user" jdbcType="VARCHAR" property="lastUpdatedUser" />
        <result column="status" jdbcType="VARCHAR" property="status" />
        <result column="shop_id" jdbcType="INTEGER" property="shopId" />
        <result column="platform_id" jdbcType="INTEGER" property="platformId" />
        <result column="merchant_id" jdbcType="INTEGER" property="merchantId" />
        <result column="shipping_id" jdbcType="TINYINT" property="shippingId" />
        <result column="tracking_number" jdbcType="VARCHAR" property="trackingNumber" />
        <result column="print_count" jdbcType="TINYINT" property="printCount" />
        <result column="facility_id" jdbcType="TINYINT" property="facilityId" />
        <result column="shipping_self_weight" jdbcType="DECIMAL" property="shippingSelfWeight" />
        <result column="shipping_out_weight" jdbcType="DECIMAL" property="shippingOutWeight" />
        <result column="shipping_service_fee" jdbcType="DECIMAL" property="shippingServiceFee" />
        <result column="shipping_insured_cost" jdbcType="DECIMAL" property="shippingInsuredCost" />
        <result column="estimated_shipping_fee" jdbcType="DECIMAL" property="estimatedShippingFee" />
        <result column="confirm_time" jdbcType="TIMESTAMP" property="confirmTime" />
        <result column="schedule_time" jdbcType="TIMESTAMP" property="scheduleTime" />
        <result column="bind_time" jdbcType="TIMESTAMP" property="bindTime" />
        <result column="create_batchpick_time" jdbcType="TIMESTAMP" property="createBatchpickTime" />
        <result column="print_time" jdbcType="TIMESTAMP" property="printTime" />
        <result column="shipping_time" jdbcType="TIMESTAMP" property="shippingTime" />
        <result column="print_user_id" jdbcType="INTEGER" property="printUserId" />
        <result column="ship_user_id" jdbcType="INTEGER" property="shipUserId" />
        <result column="waybill_user_id" jdbcType="INTEGER" property="waybillUserId" />
        <result column="waybill_time" jdbcType="TIMESTAMP" property="waybillTime" />
        <result column="goods_id" jdbcType="INTEGER" property="goodsId" />
        <result column="product_id" jdbcType="INTEGER" property="productId" />
        <result column="product_name" jdbcType="VARCHAR" property="productName" />
        <result column="goods_number" jdbcType="INTEGER" property="goodsNumber" />
        <result column="order_type" jdbcType="SMALLINT" property="orderType" />
        <result column="order_status" jdbcType="TINYINT" property="orderStatus" />
        <result column="receive_name" jdbcType="VARCHAR" property="receiveName" />
        <result column="mobile" jdbcType="VARCHAR" property="mobile" />
        <result column="province_id" jdbcType="SMALLINT" property="provinceId" />
        <result column="province_name" jdbcType="VARCHAR" property="provinceName" />
        <result column="city_id" jdbcType="SMALLINT" property="cityId" />
        <result column="city_name" jdbcType="VARCHAR" property="cityName" />
        <result column="district_id" jdbcType="SMALLINT" property="districtId" />
        <result column="district_name" jdbcType="VARCHAR" property="districtName" />
        <result column="shipping_address" jdbcType="VARCHAR" property="shippingAddress" />
        <result column="out_order_sn" jdbcType="VARCHAR" property="outOrderSn" />
        <result column="secrect_code" jdbcType="VARCHAR" property="secrectCode" />
        <result column="order_sn_pad" jdbcType="BIGINT" property="orderSnPad" />
        <result column="goods_name" jdbcType="VARCHAR" property="goodsName" />
        <result column="address_name" jdbcType="VARCHAR" property="addressName" />
        <result column="send_oms_time" jdbcType="TIMESTAMP" property="sendOmsTime" />
        <result column="weight_user_id" jdbcType="INTEGER" property="weightUserId" />
        <result column="weight_time" jdbcType="TIMESTAMP" property="weightTime" />
        <result column="handle_time" jdbcType="TIMESTAMP" property="handleTime" />
        <result column="shipping_due_time" jdbcType="TIMESTAMP" property="shippingDueTime" />
    </resultMap>
    <resultMap id="ShipmentExt" type="com.edi.dto.WsShipmentExt" extends="BaseResultMap">
        <result column="express_code" jdbcType="VARCHAR" property="expressCode" />
    </resultMap>
    <select id="getDeliverysState" parameterType="java.lang.Integer" resultType="com.edi.dto.DeliverysState">
        select s.status area_id,s.last_updated_user operator,s.last_updated_time operator_date
        from ws_shipment s where s.merchant_id = ${merchant_id}
    </select>
    <select id="getGyTradeDeliverys" parameterType="java.lang.Integer" resultType="com.edi.dto.GyTradeDeliverys">
        select s.out_order_sn code,sc.shipping_code express_code,s.tracking_number mail_no
        from ws_shipment s inner join ws_shipping_code sc on sc.merchant_id = s.merchant_id and 
        s.shipping_id = sc.shipping_id where s.merchant_id = ${merchant_id} 
    </select>
</mapper>
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值