<?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.mall.order.mapper.OrderOperateHistoryMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.order.domain.entity.OrderOperateHistory">
        <id column="id" property="id"/>
        <id column="order_id" property="orderId"/>
        <id column="operate_man" property="operateMan"/>
        <id column="create_time" property="createTime"/>
        <id column="order_status" property="orderStatus"/>
        <id column="note" property="note"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,order_id,operate_man,create_time,order_status,note
    </sql>

    <!-- 分页查询订单操作历史记录内容 -->
    <select id="selectListByPage" resultType="com.mall.order.domain.vo.OrderOperateHistoryVo">
        select
        <include refid="Base_Column_List"/>
        from oms_order_operate_history
        <where>
            <if test="dto.id != null and dto.id != ''">
                and id like CONCAT('%',#{dto.id},'%')
            </if>
            <if test="dto.orderId != null and dto.orderId != ''">
                and order_id like CONCAT('%',#{dto.orderId},'%')
            </if>
            <if test="dto.operateMan != null and dto.operateMan != ''">
                and operate_man like CONCAT('%',#{dto.operateMan},'%')
            </if>
            <if test="dto.createTime != null and dto.createTime != ''">
                and create_time like CONCAT('%',#{dto.createTime},'%')
            </if>
            <if test="dto.orderStatus != null and dto.orderStatus != ''">
                and order_status like CONCAT('%',#{dto.orderStatus},'%')
            </if>
            <if test="dto.note != null and dto.note != ''">
                and note like CONCAT('%',#{dto.note},'%')
            </if>
        </where>
    </select>

</mapper>
