<?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.fzm.mall.server.admin.order.mapper.DeliveryLogMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.fzm.mall.server.admin.order.model.DeliveryLog">
        <id column="id" property="id" />
        <result column="order_delivery_id" property="orderDeliveryId" />
        <result column="delivery_state" property="deliveryState" />
        <result column="operation" property="operation" />
        <result column="uid" property="uid" />
        <result column="remark" property="remark" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <select id="listAll" resultMap="BaseResultMap">
        select l.*, m.enterprise_name as uName
        from (select * from order_delivery_log where order_delivery_id = #{orderDeliveryId} order by create_time desc) l
        left join `admin` a on a.admin_id = l.uid
        left join merchant m on m.merchant_id = a.merchant_id
    </select>
</mapper>
