<?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.hzya.frame.plugin.lets.dao.impl.BusidataTocreturnsDaoImpl">

    <resultMap id="get-BusidataTocreturnsEntity-result" type="com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity" >
       <result property="actualRefundAmount" column="actual_refund_amount" jdbcType="VARCHAR"/>
           <result property="checkTime" column="check_time" jdbcType="VARCHAR"/>
           <result property="createdTime" column="created_time" jdbcType="VARCHAR"/>
           <result property="customerNo" column="customer_no" jdbcType="VARCHAR"/>
           <result property="fenxiaoNick" column="fenxiao_nick" jdbcType="VARCHAR"/>
           <result property="flagName" column="flag_name" jdbcType="VARCHAR"/>
           <result property="goodsCount" column="goods_count" jdbcType="VARCHAR"/>
           <result property="logisticsId" column="logistics_id" jdbcType="VARCHAR"/>
           <result property="logisticsName" column="logistics_name" jdbcType="VARCHAR"/>
           <result property="logisticsNo" column="logistics_no" jdbcType="VARCHAR"/>
           <result property="modified" column="modified" jdbcType="VARCHAR"/>
           <result property="operatorName" column="operator_name" jdbcType="VARCHAR"/>
           <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
           <result property="processStatus" column="process_status" jdbcType="VARCHAR"/>
           <result property="reason" column="reason" jdbcType="VARCHAR"/>
           <result property="reasonId" column="reason_id" jdbcType="VARCHAR"/>
           <result property="refundAmount" column="refund_amount" jdbcType="VARCHAR"/>
           <result property="refundNo" column="refund_no" jdbcType="VARCHAR"/>
           <result property="remark" column="remark" jdbcType="VARCHAR"/>
           <result property="seqNo" column="seq_no" jdbcType="VARCHAR"/>
           <result property="shopId" column="shop_id" jdbcType="VARCHAR"/>
           <result property="shopName" column="shop_name" jdbcType="VARCHAR"/>
           <result property="shopNo" column="shop_no" jdbcType="VARCHAR"/>
           <result property="shopPlatformId" column="shop_platform_id" jdbcType="VARCHAR"/>
           <result property="shopRemark" column="shop_remark" jdbcType="VARCHAR"/>
           <result property="srcOrderId" column="src_order_id" jdbcType="VARCHAR"/>
           <result property="status" column="status" jdbcType="VARCHAR"/>
           <result property="stockinId" column="stockin_id" jdbcType="VARCHAR"/>
           <result property="subPlatformId" column="sub_platform_id" jdbcType="VARCHAR"/>
           <result property="tidList" column="tid_list" jdbcType="VARCHAR"/>
           <result property="totalGoodsStockinNum" column="total_goods_stockin_num" jdbcType="VARCHAR"/>
           <result property="totalPrice" column="total_price" jdbcType="VARCHAR"/>
           <result property="tradeNoList" column="trade_no_list" jdbcType="VARCHAR"/>
           <result property="warehouseId" column="warehouse_id" jdbcType="VARCHAR"/>
           <result property="warehouseName" column="warehouse_name" jdbcType="VARCHAR"/>
           <result property="warehouseNo" column="warehouse_no" jdbcType="VARCHAR"/>
           <result property="id" column="id" jdbcType="INTEGER"/>
        </resultMap>

    <!-- 查询的字段-->
    <sql id = "BusidataTocreturnsEntity_Base_Column_List">
        actual_refund_amount
       ,check_time 
        ,created_time 
        ,customer_no 
        ,fenxiao_nick 
        ,flag_name 
        ,goods_count 
        ,logistics_id 
        ,logistics_name 
        ,logistics_no 
        ,modified 
        ,operator_name 
        ,order_no 
        ,process_status 
        ,reason 
        ,reason_id 
        ,refund_amount 
        ,refund_no 
        ,remark 
        ,seq_no 
        ,shop_id 
        ,shop_name 
        ,shop_no 
        ,shop_platform_id 
        ,shop_remark 
        ,src_order_id 
        ,status 
        ,stockin_id 
        ,sub_platform_id 
        ,tid_list 
        ,total_goods_stockin_num 
        ,total_price 
        ,trade_no_list 
        ,warehouse_id 
        ,warehouse_name 
        ,warehouse_no 
        ,id 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-BusidataTocreturnsEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity">
    select
    <include refid="BusidataTocreturnsEntity_Base_Column_List" />
    from busidata_tocreturns
    <trim prefix="where" prefixOverrides="and"> 
        <if test="actualRefundAmount != null and actualRefundAmount != ''"> and actual_refund_amount = #{actualRefundAmount} </if>
            <if test="checkTime != null and checkTime != ''"> and check_time = #{checkTime} </if>
            <if test="createdTime != null and createdTime != ''"> and created_time = #{createdTime} </if>
            <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo} </if>
            <if test="fenxiaoNick != null and fenxiaoNick != ''"> and fenxiao_nick = #{fenxiaoNick} </if>
            <if test="flagName != null and flagName != ''"> and flag_name = #{flagName} </if>
            <if test="goodsCount != null and goodsCount != ''"> and goods_count = #{goodsCount} </if>
            <if test="logisticsId != null and logisticsId != ''"> and logistics_id = #{logisticsId} </if>
            <if test="logisticsName != null and logisticsName != ''"> and logistics_name = #{logisticsName} </if>
            <if test="logisticsNo != null and logisticsNo != ''"> and logistics_no = #{logisticsNo} </if>
            <if test="modified != null and modified != ''"> and modified = #{modified} </if>
            <if test="operatorName != null and operatorName != ''"> and operator_name = #{operatorName} </if>
            <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo} </if>
            <if test="processStatus != null and processStatus != ''"> and process_status = #{processStatus} </if>
            <if test="reason != null and reason != ''"> and reason = #{reason} </if>
            <if test="reasonId != null and reasonId != ''"> and reason_id = #{reasonId} </if>
            <if test="refundAmount != null and refundAmount != ''"> and refund_amount = #{refundAmount} </if>
            <if test="refundNo != null and refundNo != ''"> and refund_no = #{refundNo} </if>
            <if test="remark != null and remark != ''"> and remark = #{remark} </if>
            <if test="seqNo != null and seqNo != ''"> and seq_no = #{seqNo} </if>
            <if test="shopId != null and shopId != ''"> and shop_id = #{shopId} </if>
            <if test="shopName != null and shopName != ''"> and shop_name = #{shopName} </if>
            <if test="shopNo != null and shopNo != ''"> and shop_no = #{shopNo} </if>
            <if test="shopPlatformId != null and shopPlatformId != ''"> and shop_platform_id = #{shopPlatformId} </if>
            <if test="shopRemark != null and shopRemark != ''"> and shop_remark = #{shopRemark} </if>
            <if test="srcOrderId != null and srcOrderId != ''"> and src_order_id = #{srcOrderId} </if>
            <if test="status != null and status != ''"> and status = #{status} </if>
            <if test="stockinId != null and stockinId != ''"> and stockin_id = #{stockinId} </if>
            <if test="subPlatformId != null and subPlatformId != ''"> and sub_platform_id = #{subPlatformId} </if>
            <if test="tidList != null and tidList != ''"> and tid_list = #{tidList} </if>
            <if test="totalGoodsStockinNum != null and totalGoodsStockinNum != ''"> and total_goods_stockin_num = #{totalGoodsStockinNum} </if>
            <if test="totalPrice != null and totalPrice != ''"> and total_price = #{totalPrice} </if>
            <if test="tradeNoList != null and tradeNoList != ''"> and trade_no_list = #{tradeNoList} </if>
            <if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId} </if>
            <if test="warehouseName != null and warehouseName != ''"> and warehouse_name = #{warehouseName} </if>
            <if test="warehouseNo != null and warehouseNo != ''"> and warehouse_no = #{warehouseNo} </if>
            <if test="id != null"> and id = #{id} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity">
        select  count(1)   from busidata_tocreturns
    <trim prefix="where" prefixOverrides="and"> 
        <if test="actualRefundAmount != null and actualRefundAmount != ''"> and actual_refund_amount = #{actualRefundAmount} </if>
            <if test="checkTime != null and checkTime != ''"> and check_time = #{checkTime} </if>
            <if test="createdTime != null and createdTime != ''"> and created_time = #{createdTime} </if>
            <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo} </if>
            <if test="fenxiaoNick != null and fenxiaoNick != ''"> and fenxiao_nick = #{fenxiaoNick} </if>
            <if test="flagName != null and flagName != ''"> and flag_name = #{flagName} </if>
            <if test="goodsCount != null and goodsCount != ''"> and goods_count = #{goodsCount} </if>
            <if test="logisticsId != null and logisticsId != ''"> and logistics_id = #{logisticsId} </if>
            <if test="logisticsName != null and logisticsName != ''"> and logistics_name = #{logisticsName} </if>
            <if test="logisticsNo != null and logisticsNo != ''"> and logistics_no = #{logisticsNo} </if>
            <if test="modified != null and modified != ''"> and modified = #{modified} </if>
            <if test="operatorName != null and operatorName != ''"> and operator_name = #{operatorName} </if>
            <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo} </if>
            <if test="processStatus != null and processStatus != ''"> and process_status = #{processStatus} </if>
            <if test="reason != null and reason != ''"> and reason = #{reason} </if>
            <if test="reasonId != null and reasonId != ''"> and reason_id = #{reasonId} </if>
            <if test="refundAmount != null and refundAmount != ''"> and refund_amount = #{refundAmount} </if>
            <if test="refundNo != null and refundNo != ''"> and refund_no = #{refundNo} </if>
            <if test="remark != null and remark != ''"> and remark = #{remark} </if>
            <if test="seqNo != null and seqNo != ''"> and seq_no = #{seqNo} </if>
            <if test="shopId != null and shopId != ''"> and shop_id = #{shopId} </if>
            <if test="shopName != null and shopName != ''"> and shop_name = #{shopName} </if>
            <if test="shopNo != null and shopNo != ''"> and shop_no = #{shopNo} </if>
            <if test="shopPlatformId != null and shopPlatformId != ''"> and shop_platform_id = #{shopPlatformId} </if>
            <if test="shopRemark != null and shopRemark != ''"> and shop_remark = #{shopRemark} </if>
            <if test="srcOrderId != null and srcOrderId != ''"> and src_order_id = #{srcOrderId} </if>
            <if test="status != null and status != ''"> and status = #{status} </if>
            <if test="stockinId != null and stockinId != ''"> and stockin_id = #{stockinId} </if>
            <if test="subPlatformId != null and subPlatformId != ''"> and sub_platform_id = #{subPlatformId} </if>
            <if test="tidList != null and tidList != ''"> and tid_list = #{tidList} </if>
            <if test="totalGoodsStockinNum != null and totalGoodsStockinNum != ''"> and total_goods_stockin_num = #{totalGoodsStockinNum} </if>
            <if test="totalPrice != null and totalPrice != ''"> and total_price = #{totalPrice} </if>
            <if test="tradeNoList != null and tradeNoList != ''"> and trade_no_list = #{tradeNoList} </if>
            <if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId} </if>
            <if test="warehouseName != null and warehouseName != ''"> and warehouse_name = #{warehouseName} </if>
            <if test="warehouseNo != null and warehouseNo != ''"> and warehouse_no = #{warehouseNo} </if>
            <if test="id != null"> and id = #{id} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-BusidataTocreturnsEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity">
    select
    <include refid="BusidataTocreturnsEntity_Base_Column_List" />
    from busidata_tocreturns
    <trim prefix="where" prefixOverrides="and"> 
        <if test="actualRefundAmount != null and actualRefundAmount != ''"> and actual_refund_amount like concat('%',#{actualRefundAmount},'%') </if>
            <if test="checkTime != null and checkTime != ''"> and check_time like concat('%',#{checkTime},'%') </if>
            <if test="createdTime != null and createdTime != ''"> and created_time like concat('%',#{createdTime},'%') </if>
            <if test="customerNo != null and customerNo != ''"> and customer_no like concat('%',#{customerNo},'%') </if>
            <if test="fenxiaoNick != null and fenxiaoNick != ''"> and fenxiao_nick like concat('%',#{fenxiaoNick},'%') </if>
            <if test="flagName != null and flagName != ''"> and flag_name like concat('%',#{flagName},'%') </if>
            <if test="goodsCount != null and goodsCount != ''"> and goods_count like concat('%',#{goodsCount},'%') </if>
            <if test="logisticsId != null and logisticsId != ''"> and logistics_id like concat('%',#{logisticsId},'%') </if>
            <if test="logisticsName != null and logisticsName != ''"> and logistics_name like concat('%',#{logisticsName},'%') </if>
            <if test="logisticsNo != null and logisticsNo != ''"> and logistics_no like concat('%',#{logisticsNo},'%') </if>
            <if test="modified != null and modified != ''"> and modified like concat('%',#{modified},'%') </if>
            <if test="operatorName != null and operatorName != ''"> and operator_name like concat('%',#{operatorName},'%') </if>
            <if test="orderNo != null and orderNo != ''"> and order_no like concat('%',#{orderNo},'%') </if>
            <if test="processStatus != null and processStatus != ''"> and process_status like concat('%',#{processStatus},'%') </if>
            <if test="reason != null and reason != ''"> and reason like concat('%',#{reason},'%') </if>
            <if test="reasonId != null and reasonId != ''"> and reason_id like concat('%',#{reasonId},'%') </if>
            <if test="refundAmount != null and refundAmount != ''"> and refund_amount like concat('%',#{refundAmount},'%') </if>
            <if test="refundNo != null and refundNo != ''"> and refund_no like concat('%',#{refundNo},'%') </if>
            <if test="remark != null and remark != ''"> and remark like concat('%',#{remark},'%') </if>
            <if test="seqNo != null and seqNo != ''"> and seq_no like concat('%',#{seqNo},'%') </if>
            <if test="shopId != null and shopId != ''"> and shop_id like concat('%',#{shopId},'%') </if>
            <if test="shopName != null and shopName != ''"> and shop_name like concat('%',#{shopName},'%') </if>
            <if test="shopNo != null and shopNo != ''"> and shop_no like concat('%',#{shopNo},'%') </if>
            <if test="shopPlatformId != null and shopPlatformId != ''"> and shop_platform_id like concat('%',#{shopPlatformId},'%') </if>
            <if test="shopRemark != null and shopRemark != ''"> and shop_remark like concat('%',#{shopRemark},'%') </if>
            <if test="srcOrderId != null and srcOrderId != ''"> and src_order_id like concat('%',#{srcOrderId},'%') </if>
            <if test="status != null and status != ''"> and status like concat('%',#{status},'%') </if>
            <if test="stockinId != null and stockinId != ''"> and stockin_id like concat('%',#{stockinId},'%') </if>
            <if test="subPlatformId != null and subPlatformId != ''"> and sub_platform_id like concat('%',#{subPlatformId},'%') </if>
            <if test="tidList != null and tidList != ''"> and tid_list like concat('%',#{tidList},'%') </if>
            <if test="totalGoodsStockinNum != null and totalGoodsStockinNum != ''"> and total_goods_stockin_num like concat('%',#{totalGoodsStockinNum},'%') </if>
            <if test="totalPrice != null and totalPrice != ''"> and total_price like concat('%',#{totalPrice},'%') </if>
            <if test="tradeNoList != null and tradeNoList != ''"> and trade_no_list like concat('%',#{tradeNoList},'%') </if>
            <if test="warehouseId != null and warehouseId != ''"> and warehouse_id like concat('%',#{warehouseId},'%') </if>
            <if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%',#{warehouseName},'%') </if>
            <if test="warehouseNo != null and warehouseNo != ''"> and warehouse_no like concat('%',#{warehouseNo},'%') </if>
            <if test="id != null"> and id like concat('%',#{id},'%') </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="BusidataTocreturnsentity_list_or" resultMap="get-BusidataTocreturnsEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity">
    select
    <include refid="BusidataTocreturnsEntity_Base_Column_List" />
    from busidata_tocreturns
    <trim prefix="where" prefixOverrides="and"> 
         <if test="actualRefundAmount != null and actualRefundAmount != ''"> or actual_refund_amount = #{actualRefundAmount} </if>
             <if test="checkTime != null and checkTime != ''"> or check_time = #{checkTime} </if>
             <if test="createdTime != null and createdTime != ''"> or created_time = #{createdTime} </if>
             <if test="customerNo != null and customerNo != ''"> or customer_no = #{customerNo} </if>
             <if test="fenxiaoNick != null and fenxiaoNick != ''"> or fenxiao_nick = #{fenxiaoNick} </if>
             <if test="flagName != null and flagName != ''"> or flag_name = #{flagName} </if>
             <if test="goodsCount != null and goodsCount != ''"> or goods_count = #{goodsCount} </if>
             <if test="logisticsId != null and logisticsId != ''"> or logistics_id = #{logisticsId} </if>
             <if test="logisticsName != null and logisticsName != ''"> or logistics_name = #{logisticsName} </if>
             <if test="logisticsNo != null and logisticsNo != ''"> or logistics_no = #{logisticsNo} </if>
             <if test="modified != null and modified != ''"> or modified = #{modified} </if>
             <if test="operatorName != null and operatorName != ''"> or operator_name = #{operatorName} </if>
             <if test="orderNo != null and orderNo != ''"> or order_no = #{orderNo} </if>
             <if test="processStatus != null and processStatus != ''"> or process_status = #{processStatus} </if>
             <if test="reason != null and reason != ''"> or reason = #{reason} </if>
             <if test="reasonId != null and reasonId != ''"> or reason_id = #{reasonId} </if>
             <if test="refundAmount != null and refundAmount != ''"> or refund_amount = #{refundAmount} </if>
             <if test="refundNo != null and refundNo != ''"> or refund_no = #{refundNo} </if>
             <if test="remark != null and remark != ''"> or remark = #{remark} </if>
             <if test="seqNo != null and seqNo != ''"> or seq_no = #{seqNo} </if>
             <if test="shopId != null and shopId != ''"> or shop_id = #{shopId} </if>
             <if test="shopName != null and shopName != ''"> or shop_name = #{shopName} </if>
             <if test="shopNo != null and shopNo != ''"> or shop_no = #{shopNo} </if>
             <if test="shopPlatformId != null and shopPlatformId != ''"> or shop_platform_id = #{shopPlatformId} </if>
             <if test="shopRemark != null and shopRemark != ''"> or shop_remark = #{shopRemark} </if>
             <if test="srcOrderId != null and srcOrderId != ''"> or src_order_id = #{srcOrderId} </if>
             <if test="status != null and status != ''"> or status = #{status} </if>
             <if test="stockinId != null and stockinId != ''"> or stockin_id = #{stockinId} </if>
             <if test="subPlatformId != null and subPlatformId != ''"> or sub_platform_id = #{subPlatformId} </if>
             <if test="tidList != null and tidList != ''"> or tid_list = #{tidList} </if>
             <if test="totalGoodsStockinNum != null and totalGoodsStockinNum != ''"> or total_goods_stockin_num = #{totalGoodsStockinNum} </if>
             <if test="totalPrice != null and totalPrice != ''"> or total_price = #{totalPrice} </if>
             <if test="tradeNoList != null and tradeNoList != ''"> or trade_no_list = #{tradeNoList} </if>
             <if test="warehouseId != null and warehouseId != ''"> or warehouse_id = #{warehouseId} </if>
             <if test="warehouseName != null and warehouseName != ''"> or warehouse_name = #{warehouseName} </if>
             <if test="warehouseNo != null and warehouseNo != ''"> or warehouse_no = #{warehouseNo} </if>
             <if test="id != null"> or id = #{id} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString()  "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity" keyProperty="id" useGeneratedKeys="true">
    insert into busidata_tocreturns(
  <trim suffix="" suffixOverrides=",">
       <if test="actualRefundAmount != null and actualRefundAmount != ''"> actual_refund_amount , </if>
            <if test="checkTime != null and checkTime != ''"> check_time , </if>
            <if test="createdTime != null and createdTime != ''"> created_time , </if>
            <if test="customerNo != null and customerNo != ''"> customer_no , </if>
            <if test="fenxiaoNick != null and fenxiaoNick != ''"> fenxiao_nick , </if>
            <if test="flagName != null and flagName != ''"> flag_name , </if>
            <if test="goodsCount != null and goodsCount != ''"> goods_count , </if>
            <if test="logisticsId != null and logisticsId != ''"> logistics_id , </if>
            <if test="logisticsName != null and logisticsName != ''"> logistics_name , </if>
            <if test="logisticsNo != null and logisticsNo != ''"> logistics_no , </if>
            <if test="modified != null and modified != ''"> modified , </if>
            <if test="operatorName != null and operatorName != ''"> operator_name , </if>
            <if test="orderNo != null and orderNo != ''"> order_no , </if>
            <if test="processStatus != null and processStatus != ''"> process_status , </if>
            <if test="reason != null and reason != ''"> reason , </if>
            <if test="reasonId != null and reasonId != ''"> reason_id , </if>
            <if test="refundAmount != null and refundAmount != ''"> refund_amount , </if>
            <if test="refundNo != null and refundNo != ''"> refund_no , </if>
            <if test="remark != null and remark != ''"> remark , </if>
            <if test="seqNo != null and seqNo != ''"> seq_no , </if>
            <if test="shopId != null and shopId != ''"> shop_id , </if>
            <if test="shopName != null and shopName != ''"> shop_name , </if>
            <if test="shopNo != null and shopNo != ''"> shop_no , </if>
            <if test="shopPlatformId != null and shopPlatformId != ''"> shop_platform_id , </if>
            <if test="shopRemark != null and shopRemark != ''"> shop_remark , </if>
            <if test="srcOrderId != null and srcOrderId != ''"> src_order_id , </if>
            <if test="status != null and status != ''"> status , </if>
            <if test="stockinId != null and stockinId != ''"> stockin_id , </if>
            <if test="subPlatformId != null and subPlatformId != ''"> sub_platform_id , </if>
            <if test="tidList != null and tidList != ''"> tid_list , </if>
            <if test="totalGoodsStockinNum != null and totalGoodsStockinNum != ''"> total_goods_stockin_num , </if>
            <if test="totalPrice != null and totalPrice != ''"> total_price , </if>
            <if test="tradeNoList != null and tradeNoList != ''"> trade_no_list , </if>
            <if test="warehouseId != null and warehouseId != ''"> warehouse_id , </if>
            <if test="warehouseName != null and warehouseName != ''"> warehouse_name , </if>
            <if test="warehouseNo != null and warehouseNo != ''"> warehouse_no , </if>
            <if test="id != null"> id , </if>
            <if test="sorts == null ">sorts,</if>
    <if test="sts == null ">sts,</if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="actualRefundAmount != null and actualRefundAmount != ''"> #{actualRefundAmount} ,</if>
            <if test="checkTime != null and checkTime != ''"> #{checkTime} ,</if>
            <if test="createdTime != null and createdTime != ''"> #{createdTime} ,</if>
            <if test="customerNo != null and customerNo != ''"> #{customerNo} ,</if>
            <if test="fenxiaoNick != null and fenxiaoNick != ''"> #{fenxiaoNick} ,</if>
            <if test="flagName != null and flagName != ''"> #{flagName} ,</if>
            <if test="goodsCount != null and goodsCount != ''"> #{goodsCount} ,</if>
            <if test="logisticsId != null and logisticsId != ''"> #{logisticsId} ,</if>
            <if test="logisticsName != null and logisticsName != ''"> #{logisticsName} ,</if>
            <if test="logisticsNo != null and logisticsNo != ''"> #{logisticsNo} ,</if>
            <if test="modified != null and modified != ''"> #{modified} ,</if>
            <if test="operatorName != null and operatorName != ''"> #{operatorName} ,</if>
            <if test="orderNo != null and orderNo != ''"> #{orderNo} ,</if>
            <if test="processStatus != null and processStatus != ''"> #{processStatus} ,</if>
            <if test="reason != null and reason != ''"> #{reason} ,</if>
            <if test="reasonId != null and reasonId != ''"> #{reasonId} ,</if>
            <if test="refundAmount != null and refundAmount != ''"> #{refundAmount} ,</if>
            <if test="refundNo != null and refundNo != ''"> #{refundNo} ,</if>
            <if test="remark != null and remark != ''"> #{remark} ,</if>
            <if test="seqNo != null and seqNo != ''"> #{seqNo} ,</if>
            <if test="shopId != null and shopId != ''"> #{shopId} ,</if>
            <if test="shopName != null and shopName != ''"> #{shopName} ,</if>
            <if test="shopNo != null and shopNo != ''"> #{shopNo} ,</if>
            <if test="shopPlatformId != null and shopPlatformId != ''"> #{shopPlatformId} ,</if>
            <if test="shopRemark != null and shopRemark != ''"> #{shopRemark} ,</if>
            <if test="srcOrderId != null and srcOrderId != ''"> #{srcOrderId} ,</if>
            <if test="status != null and status != ''"> #{status} ,</if>
            <if test="stockinId != null and stockinId != ''"> #{stockinId} ,</if>
            <if test="subPlatformId != null and subPlatformId != ''"> #{subPlatformId} ,</if>
            <if test="tidList != null and tidList != ''"> #{tidList} ,</if>
            <if test="totalGoodsStockinNum != null and totalGoodsStockinNum != ''"> #{totalGoodsStockinNum} ,</if>
            <if test="totalPrice != null and totalPrice != ''"> #{totalPrice} ,</if>
            <if test="tradeNoList != null and tradeNoList != ''"> #{tradeNoList} ,</if>
            <if test="warehouseId != null and warehouseId != ''"> #{warehouseId} ,</if>
            <if test="warehouseName != null and warehouseName != ''"> #{warehouseName} ,</if>
            <if test="warehouseNo != null and warehouseNo != ''"> #{warehouseNo} ,</if>
            <if test="id != null"> #{id} ,</if>
            <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from busidata_tocreturns a WHERE a.sts = 'Y' ),</if>
    <if test="sts == null ">'Y',</if>
  </trim>
  )  
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
  insert IGNORE into busidata_tocreturns(actual_refund_amount, check_time, created_time, customer_no, fenxiao_nick, flag_name, goods_count, logistics_id, logistics_name, logistics_no, modified, operator_name, order_no, process_status, reason, reason_id, refund_amount, refund_no, remark, seq_no, shop_id, shop_name, shop_no, shop_platform_id, shop_remark, src_order_id, status, stockin_id, sub_platform_id, tid_list, total_goods_stockin_num, total_price, trade_no_list, warehouse_id, warehouse_name, warehouse_no,business_month,business_date)
    values
    <foreach collection="list" item="entity" separator=",">
    (#{entity.actualRefundAmount},#{entity.checkTime},#{entity.createdTime},#{entity.customerNo},#{entity.fenxiaoNick},#{entity.flagName},#{entity.goodsCount},#{entity.logisticsId},#{entity.logisticsName},#{entity.logisticsNo},#{entity.modified},#{entity.operatorName},#{entity.orderNo},#{entity.processStatus},#{entity.reason},#{entity.reasonId},#{entity.refundAmount},#{entity.refundNo},#{entity.remark},#{entity.seqNo},#{entity.shopId},#{entity.shopName},#{entity.shopNo},#{entity.shopPlatformId},#{entity.shopRemark},#{entity.srcOrderId},#{entity.status},#{entity.stockinId},#{entity.subPlatformId},#{entity.tidList},#{entity.totalGoodsStockinNum},#{entity.totalPrice},#{entity.tradeNoList},#{entity.warehouseId},#{entity.warehouseName},#{entity.warehouseNo},#{entity.business_month},#{entity.business_date})
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
    insert into busidata_tocreturns(actual_refund_amount, check_time, created_time, customer_no, fenxiao_nick, flag_name, goods_count, logistics_id, logistics_name, logistics_no, modified, operator_name, order_no, process_status, reason, reason_id, refund_amount, refund_no, remark, seq_no, shop_id, shop_name, shop_no, shop_platform_id, shop_remark, src_order_id, status, stockin_id, sub_platform_id, tid_list, total_goods_stockin_num, total_price, trade_no_list, warehouse_id, warehouse_name, warehouse_no,business_month,business_date)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.actualRefundAmount},#{entity.checkTime},#{entity.createdTime},#{entity.customerNo},#{entity.fenxiaoNick},#{entity.flagName},#{entity.goodsCount},#{entity.logisticsId},#{entity.logisticsName},#{entity.logisticsNo},#{entity.modified},#{entity.operatorName},#{entity.orderNo},#{entity.processStatus},#{entity.reason},#{entity.reasonId},#{entity.refundAmount},#{entity.refundNo},#{entity.remark},#{entity.seqNo},#{entity.shopId},#{entity.shopName},#{entity.shopNo},#{entity.shopPlatformId},#{entity.shopRemark},#{entity.srcOrderId},#{entity.status},#{entity.stockinId},#{entity.subPlatformId},#{entity.tidList},#{entity.totalGoodsStockinNum},#{entity.totalPrice},#{entity.tradeNoList},#{entity.warehouseId},#{entity.warehouseName},#{entity.warehouseNo},#{entity.business_month},#{entity.business_date})
    </foreach>
    on duplicate key update
    actual_refund_amount = values(actual_refund_amount),
    check_time = values(check_time),
    created_time = values(created_time),
    customer_no = values(customer_no),
    fenxiao_nick = values(fenxiao_nick),
    flag_name = values(flag_name),
    goods_count = values(goods_count),
    logistics_id = values(logistics_id),
    logistics_name = values(logistics_name),
    logistics_no = values(logistics_no),
    modified = values(modified),
    operator_name = values(operator_name),
    order_no = values(order_no),
    process_status = values(process_status),
    reason = values(reason),
    reason_id = values(reason_id),
    refund_amount = values(refund_amount),
    refund_no = values(refund_no),
    remark = values(remark),
    seq_no = values(seq_no),
    shop_id = values(shop_id),
    shop_name = values(shop_name),
    shop_no = values(shop_no),
    shop_platform_id = values(shop_platform_id),
    shop_remark = values(shop_remark),
    src_order_id = values(src_order_id),
    status = values(status),
    stockin_id = values(stockin_id),
    sub_platform_id = values(sub_platform_id),
    tid_list = values(tid_list),
    total_goods_stockin_num = values(total_goods_stockin_num),
    total_price = values(total_price),
    trade_no_list = values(trade_no_list),
    warehouse_id = values(warehouse_id),
    warehouse_name = values(warehouse_name),
    warehouse_no = values(warehouse_no)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity" >
update busidata_tocreturns  set
<trim suffix="" suffixOverrides=",">
  <if test="actualRefundAmount != null and actualRefundAmount != ''"> actual_refund_amount = #{actualRefundAmount},</if>
  <if test="checkTime != null and checkTime != ''"> check_time = #{checkTime},</if>
  <if test="createdTime != null and createdTime != ''"> created_time = #{createdTime},</if>
  <if test="customerNo != null and customerNo != ''"> customer_no = #{customerNo},</if>
  <if test="fenxiaoNick != null and fenxiaoNick != ''"> fenxiao_nick = #{fenxiaoNick},</if>
  <if test="flagName != null and flagName != ''"> flag_name = #{flagName},</if>
  <if test="goodsCount != null and goodsCount != ''"> goods_count = #{goodsCount},</if>
  <if test="logisticsId != null and logisticsId != ''"> logistics_id = #{logisticsId},</if>
  <if test="logisticsName != null and logisticsName != ''"> logistics_name = #{logisticsName},</if>
  <if test="logisticsNo != null and logisticsNo != ''"> logistics_no = #{logisticsNo},</if>
  <if test="modified != null and modified != ''"> modified = #{modified},</if>
  <if test="operatorName != null and operatorName != ''"> operator_name = #{operatorName},</if>
  <if test="orderNo != null and orderNo != ''"> order_no = #{orderNo},</if>
  <if test="processStatus != null and processStatus != ''"> process_status = #{processStatus},</if>
  <if test="reason != null and reason != ''"> reason = #{reason},</if>
  <if test="reasonId != null and reasonId != ''"> reason_id = #{reasonId},</if>
  <if test="refundAmount != null and refundAmount != ''"> refund_amount = #{refundAmount},</if>
  <if test="refundNo != null and refundNo != ''"> refund_no = #{refundNo},</if>
  <if test="remark != null and remark != ''"> remark = #{remark},</if>
  <if test="seqNo != null and seqNo != ''"> seq_no = #{seqNo},</if>
  <if test="shopId != null and shopId != ''"> shop_id = #{shopId},</if>
  <if test="shopName != null and shopName != ''"> shop_name = #{shopName},</if>
  <if test="shopNo != null and shopNo != ''"> shop_no = #{shopNo},</if>
  <if test="shopPlatformId != null and shopPlatformId != ''"> shop_platform_id = #{shopPlatformId},</if>
  <if test="shopRemark != null and shopRemark != ''"> shop_remark = #{shopRemark},</if>
  <if test="srcOrderId != null and srcOrderId != ''"> src_order_id = #{srcOrderId},</if>
  <if test="status != null and status != ''"> status = #{status},</if>
  <if test="stockinId != null and stockinId != ''"> stockin_id = #{stockinId},</if>
  <if test="subPlatformId != null and subPlatformId != ''"> sub_platform_id = #{subPlatformId},</if>
  <if test="tidList != null and tidList != ''"> tid_list = #{tidList},</if>
  <if test="totalGoodsStockinNum != null and totalGoodsStockinNum != ''"> total_goods_stockin_num = #{totalGoodsStockinNum},</if>
  <if test="totalPrice != null and totalPrice != ''"> total_price = #{totalPrice},</if>
  <if test="tradeNoList != null and tradeNoList != ''"> trade_no_list = #{tradeNoList},</if>
  <if test="warehouseId != null and warehouseId != ''"> warehouse_id = #{warehouseId},</if>
  <if test="warehouseName != null and warehouseName != ''"> warehouse_name = #{warehouseName},</if>
  <if test="warehouseNo != null and warehouseNo != ''"> warehouse_no = #{warehouseNo},</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity" >
update busidata_tocreturns  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.entity.BusidataTocreturnsEntity" >
update busidata_tocreturns  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
 <trim prefix="where" prefixOverrides="and"> 
        <if test="actualRefundAmount != null and actualRefundAmount != ''"> and actual_refund_amount = #{actualRefundAmount} </if>
            <if test="checkTime != null and checkTime != ''"> and check_time = #{checkTime} </if>
            <if test="createdTime != null and createdTime != ''"> and created_time = #{createdTime} </if>
            <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo} </if>
            <if test="fenxiaoNick != null and fenxiaoNick != ''"> and fenxiao_nick = #{fenxiaoNick} </if>
            <if test="flagName != null and flagName != ''"> and flag_name = #{flagName} </if>
            <if test="goodsCount != null and goodsCount != ''"> and goods_count = #{goodsCount} </if>
            <if test="logisticsId != null and logisticsId != ''"> and logistics_id = #{logisticsId} </if>
            <if test="logisticsName != null and logisticsName != ''"> and logistics_name = #{logisticsName} </if>
            <if test="logisticsNo != null and logisticsNo != ''"> and logistics_no = #{logisticsNo} </if>
            <if test="modified != null and modified != ''"> and modified = #{modified} </if>
            <if test="operatorName != null and operatorName != ''"> and operator_name = #{operatorName} </if>
            <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo} </if>
            <if test="processStatus != null and processStatus != ''"> and process_status = #{processStatus} </if>
            <if test="reason != null and reason != ''"> and reason = #{reason} </if>
            <if test="reasonId != null and reasonId != ''"> and reason_id = #{reasonId} </if>
            <if test="refundAmount != null and refundAmount != ''"> and refund_amount = #{refundAmount} </if>
            <if test="refundNo != null and refundNo != ''"> and refund_no = #{refundNo} </if>
            <if test="remark != null and remark != ''"> and remark = #{remark} </if>
            <if test="seqNo != null and seqNo != ''"> and seq_no = #{seqNo} </if>
            <if test="shopId != null and shopId != ''"> and shop_id = #{shopId} </if>
            <if test="shopName != null and shopName != ''"> and shop_name = #{shopName} </if>
            <if test="shopNo != null and shopNo != ''"> and shop_no = #{shopNo} </if>
            <if test="shopPlatformId != null and shopPlatformId != ''"> and shop_platform_id = #{shopPlatformId} </if>
            <if test="shopRemark != null and shopRemark != ''"> and shop_remark = #{shopRemark} </if>
            <if test="srcOrderId != null and srcOrderId != ''"> and src_order_id = #{srcOrderId} </if>
            <if test="status != null and status != ''"> and status = #{status} </if>
            <if test="stockinId != null and stockinId != ''"> and stockin_id = #{stockinId} </if>
            <if test="subPlatformId != null and subPlatformId != ''"> and sub_platform_id = #{subPlatformId} </if>
            <if test="tidList != null and tidList != ''"> and tid_list = #{tidList} </if>
            <if test="totalGoodsStockinNum != null and totalGoodsStockinNum != ''"> and total_goods_stockin_num = #{totalGoodsStockinNum} </if>
            <if test="totalPrice != null and totalPrice != ''"> and total_price = #{totalPrice} </if>
            <if test="tradeNoList != null and tradeNoList != ''"> and trade_no_list = #{tradeNoList} </if>
            <if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId} </if>
            <if test="warehouseName != null and warehouseName != ''"> and warehouse_name = #{warehouseName} </if>
            <if test="warehouseNo != null and warehouseNo != ''"> and warehouse_no = #{warehouseNo} </if>
            <if test="id != null"> and id = #{id} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from busidata_tocreturns where id = #{id}
</delete>

</mapper>

