<?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.OrderReturnApplyMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.order.domain.entity.OrderReturnApply">
        <id column="id" property="id"/>
        <id column="order_id" property="orderId"/>
        <id column="sku_id" property="skuId"/>
        <id column="order_sn" property="orderSn"/>
        <id column="create_time" property="createTime"/>
        <id column="member_username" property="memberUsername"/>
        <id column="return_amount" property="returnAmount"/>
        <id column="return_name" property="returnName"/>
        <id column="return_phone" property="returnPhone"/>
        <id column="status" property="status"/>
        <id column="handle_time" property="handleTime"/>
        <id column="sku_img" property="skuImg"/>
        <id column="sku_name" property="skuName"/>
        <id column="sku_brand" property="skuBrand"/>
        <id column="sku_attrs_vals" property="skuAttrsVals"/>
        <id column="sku_count" property="skuCount"/>
        <id column="sku_price" property="skuPrice"/>
        <id column="sku_real_price" property="skuRealPrice"/>
        <id column="reason" property="reason"/>
        <id column="description述" property="description述"/>
        <id column="desc_pics" property="descPics"/>
        <id column="handle_note" property="handleNote"/>
        <id column="handle_man" property="handleMan"/>
        <id column="receive_man" property="receiveMan"/>
        <id column="receive_time" property="receiveTime"/>
        <id column="receive_note" property="receiveNote"/>
        <id column="receive_phone" property="receivePhone"/>
        <id column="company_address" property="companyAddress"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,order_id,sku_id,order_sn,create_time,member_username,return_amount,return_name,return_phone,status,handle_time,sku_img,sku_name,sku_brand,sku_attrs_vals,sku_count,sku_price,sku_real_price,reason,description述,desc_pics,handle_note,handle_man,receive_man,receive_time,receive_note,receive_phone,company_address
    </sql>

    <!-- 分页查询订单退货申请内容 -->
    <select id="selectListByPage" resultType="com.mall.order.domain.vo.OrderReturnApplyVo">
        select
        <include refid="Base_Column_List"/>
        from oms_order_return_apply
        <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.skuId != null and dto.skuId != ''">
                and sku_id like CONCAT('%',#{dto.skuId},'%')
            </if>
            <if test="dto.orderSn != null and dto.orderSn != ''">
                and order_sn like CONCAT('%',#{dto.orderSn},'%')
            </if>
            <if test="dto.createTime != null and dto.createTime != ''">
                and create_time like CONCAT('%',#{dto.createTime},'%')
            </if>
            <if test="dto.memberUsername != null and dto.memberUsername != ''">
                and member_username like CONCAT('%',#{dto.memberUsername},'%')
            </if>
            <if test="dto.returnAmount != null and dto.returnAmount != ''">
                and return_amount like CONCAT('%',#{dto.returnAmount},'%')
            </if>
            <if test="dto.returnName != null and dto.returnName != ''">
                and return_name like CONCAT('%',#{dto.returnName},'%')
            </if>
            <if test="dto.returnPhone != null and dto.returnPhone != ''">
                and return_phone like CONCAT('%',#{dto.returnPhone},'%')
            </if>
            <if test="dto.status != null and dto.status != ''">
                and status like CONCAT('%',#{dto.status},'%')
            </if>
            <if test="dto.handleTime != null and dto.handleTime != ''">
                and handle_time like CONCAT('%',#{dto.handleTime},'%')
            </if>
            <if test="dto.skuImg != null and dto.skuImg != ''">
                and sku_img like CONCAT('%',#{dto.skuImg},'%')
            </if>
            <if test="dto.skuName != null and dto.skuName != ''">
                and sku_name like CONCAT('%',#{dto.skuName},'%')
            </if>
            <if test="dto.skuBrand != null and dto.skuBrand != ''">
                and sku_brand like CONCAT('%',#{dto.skuBrand},'%')
            </if>
            <if test="dto.skuAttrsVals != null and dto.skuAttrsVals != ''">
                and sku_attrs_vals like CONCAT('%',#{dto.skuAttrsVals},'%')
            </if>
            <if test="dto.skuCount != null and dto.skuCount != ''">
                and sku_count like CONCAT('%',#{dto.skuCount},'%')
            </if>
            <if test="dto.skuPrice != null and dto.skuPrice != ''">
                and sku_price like CONCAT('%',#{dto.skuPrice},'%')
            </if>
            <if test="dto.skuRealPrice != null and dto.skuRealPrice != ''">
                and sku_real_price like CONCAT('%',#{dto.skuRealPrice},'%')
            </if>
            <if test="dto.reason != null and dto.reason != ''">
                and reason like CONCAT('%',#{dto.reason},'%')
            </if>
            <if test="dto.description述 != null and dto.description述 != ''">
                and description述 like CONCAT('%',#{dto.description述},'%')
            </if>
            <if test="dto.descPics != null and dto.descPics != ''">
                and desc_pics like CONCAT('%',#{dto.descPics},'%')
            </if>
            <if test="dto.handleNote != null and dto.handleNote != ''">
                and handle_note like CONCAT('%',#{dto.handleNote},'%')
            </if>
            <if test="dto.handleMan != null and dto.handleMan != ''">
                and handle_man like CONCAT('%',#{dto.handleMan},'%')
            </if>
            <if test="dto.receiveMan != null and dto.receiveMan != ''">
                and receive_man like CONCAT('%',#{dto.receiveMan},'%')
            </if>
            <if test="dto.receiveTime != null and dto.receiveTime != ''">
                and receive_time like CONCAT('%',#{dto.receiveTime},'%')
            </if>
            <if test="dto.receiveNote != null and dto.receiveNote != ''">
                and receive_note like CONCAT('%',#{dto.receiveNote},'%')
            </if>
            <if test="dto.receivePhone != null and dto.receivePhone != ''">
                and receive_phone like CONCAT('%',#{dto.receivePhone},'%')
            </if>
            <if test="dto.companyAddress != null and dto.companyAddress != ''">
                and company_address like CONCAT('%',#{dto.companyAddress},'%')
            </if>
        </where>
    </select>

</mapper>
