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.WsShjava.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>新聞熱點
疑難解答