<?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="SDdglOrderStoreMapper" >
    <!-- 通用查询映射结果 -->

    <select id="selectSDdglOrderStoreList" parameterType="pd" resultType="pd">
        select * from s_ddgl_order_store where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="orderId !=null and orderId !='' ">
            and orderId = #{orderId}
        </if>
        <if test="deliveryType !=null and deliveryType !='' ">
            and deliveryType = #{deliveryType}
        </if>
        <if test="mobileNumber !=null and mobileNumber !='' ">
            and mobileNumber = #{mobileNumber}
        </if>
        <if test="channelName !=null and channelName !='' ">
            and channelName = #{channelName}
        </if>
        <if test="channelOrderNo !=null and channelOrderNo !='' ">
            and channelOrderNo = #{channelOrderNo}
        </if>
        <if test="psoSaleOrderNo !=null and psoSaleOrderNo !='' ">
            and psoSaleOrderNo = #{psoSaleOrderNo}
        </if>
        <if test="orderStatus !=null and orderStatus !='' ">
            and orderStatus = #{orderStatus}
        </if>
        <if test="deliveryStatus !=null and deliveryStatus !='' ">
            and deliveryStatus = #{deliveryStatus}
        </if>
        <if test="orderDate !=null and orderDate !='' ">
            and orderDate = #{orderDate}
        </if>
        <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
            and orderDate between #{beginTime} and #{endTime}
        </if>
        <if test="storeName !=null and storeName !='' ">
            and storeName = #{storeName}
        </if>
        <if test="consumptionTime !=null and consumptionTime !='' ">
            and consumptionTime = #{consumptionTime}
        </if>
        <if test="memberId !=null and memberId !='' ">
            and memberId = #{memberId}
        </if>
        <if test="memberName !=null and memberName !='' ">
            and memberName = #{memberName}
        </if>
        <if test="systemLoginUserId !=null and systemLoginUserId !='' ">
            and systemLoginUserId = #{systemLoginUserId}
        </if>
        <if test="orderPlacer !=null and orderPlacer !='' ">
            and orderPlacer = #{orderPlacer}
        </if>
        <if test="orderTime !=null and orderTime !='' ">
            and orderTime = #{orderTime}
        </if>
        <if test="settlementId !=null and settlementId !='' ">
            and settlementId = #{settlementId}
        </if>
        <if test="settlementCode !=null and settlementCode !='' ">
            and settlementCode = #{settlementCode}
        </if>
        <if test="finalPaymentTime !=null and finalPaymentTime !='' ">
            and finalPaymentTime = #{finalPaymentTime}
        </if>
        <if test="totalDrugQuantity !=null and totalDrugQuantity !='' ">
            and totalDrugQuantity = #{totalDrugQuantity}
        </if>
        <if test="cardNumber !=null and cardNumber !='' ">
            and cardNumber = #{cardNumber}
        </if>
        <if test="shippingAddress !=null and shippingAddress !='' ">
            and shippingAddress = #{shippingAddress}
        </if>
        <if test="orderAddress !=null and orderAddress !='' ">
            and orderAddress = #{orderAddress}
        </if>
        <if test="orderType !=null and orderType !='' ">
            and orderType = #{orderType}
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            and orderSource = #{orderSource}
        </if>
        <if test="totalAmount !=null and totalAmount !='' ">
            and totalAmount = #{totalAmount}
        </if>
        <if test="deliveryFee !=null and deliveryFee !='' ">
            and deliveryFee = #{deliveryFee}
        </if>
        <if test="refundAmount !=null and refundAmount !='' ">
            and refundAmount = #{refundAmount}
        </if>
        <if test="deliveryPickupMethod !=null and deliveryPickupMethod !='' ">
            and deliveryPickupMethod = #{deliveryPickupMethod}
        </if>
        <if test="deliveryPickupTime !=null and deliveryPickupTime !='' ">
            and deliveryPickupTime = #{deliveryPickupTime}
        </if>
        <if test="remarks !=null and remarks !='' ">
            and remarks = #{remarks}
        </if>
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
    </select>


    <update id="updateSDdglOrderStore" parameterType="pd" >
        update s_ddgl_order_store
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="orderId !=null and orderId !='' ">
            orderId = #{orderId},
        </if>
        <if test="deliveryType !=null and deliveryType !='' ">
            deliveryType = #{deliveryType},
        </if>
        <if test="mobileNumber !=null and mobileNumber !='' ">
            mobileNumber = #{mobileNumber},
        </if>
        <if test="channelName !=null and channelName !='' ">
            channelName = #{channelName},
        </if>
        <if test="channelOrderNo !=null and channelOrderNo !='' ">
            channelOrderNo = #{channelOrderNo},
        </if>
        <if test="psoSaleOrderNo !=null and psoSaleOrderNo !='' ">
            psoSaleOrderNo = #{psoSaleOrderNo},
        </if>
        <if test="orderStatus !=null and orderStatus !='' ">
            orderStatus = #{orderStatus},
        </if>
        <if test="deliveryStatus !=null and deliveryStatus !='' ">
            deliveryStatus = #{deliveryStatus},
        </if>
        <if test="orderDate !=null and orderDate !='' ">
            orderDate = #{orderDate},
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName = #{storeName},
        </if>
        <if test="consumptionTime !=null and consumptionTime !='' ">
            consumptionTime = #{consumptionTime},
        </if>
        <if test="memberId !=null and memberId !='' ">
            memberId = #{memberId},
        </if>
        <if test="memberName !=null and memberName !='' ">
            memberName = #{memberName},
        </if>
        <if test="systemLoginUserId !=null and systemLoginUserId !='' ">
            systemLoginUserId = #{systemLoginUserId},
        </if>
        <if test="orderPlacer !=null and orderPlacer !='' ">
            orderPlacer = #{orderPlacer},
        </if>
        <if test="orderTime !=null and orderTime !='' ">
            orderTime = #{orderTime},
        </if>
        <if test="settlementId !=null and settlementId !='' ">
            settlementId = #{settlementId},
        </if>
        <if test="settlementCode !=null and settlementCode !='' ">
            settlementCode = #{settlementCode},
        </if>
        <if test="finalPaymentTime !=null and finalPaymentTime !='' ">
            finalPaymentTime = #{finalPaymentTime},
        </if>
        <if test="totalDrugQuantity !=null and totalDrugQuantity !='' ">
            totalDrugQuantity = #{totalDrugQuantity},
        </if>
        <if test="cardNumber !=null and cardNumber !='' ">
            cardNumber = #{cardNumber},
        </if>
        <if test="shippingAddress !=null and shippingAddress !='' ">
            shippingAddress = #{shippingAddress},
        </if>
        <if test="orderAddress !=null and orderAddress !='' ">
            orderAddress = #{orderAddress},
        </if>
        <if test="orderType !=null and orderType !='' ">
            orderType = #{orderType},
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            orderSource = #{orderSource},
        </if>
        <if test="totalAmount !=null and totalAmount !='' ">
            totalAmount = #{totalAmount},
        </if>
        <if test="deliveryFee !=null and deliveryFee !='' ">
            deliveryFee = #{deliveryFee},
        </if>
        <if test="refundAmount !=null and refundAmount !='' ">
            refundAmount = #{refundAmount},
        </if>
        <if test="deliveryPickupMethod !=null and deliveryPickupMethod !='' ">
            deliveryPickupMethod = #{deliveryPickupMethod},
        </if>
        <if test="deliveryPickupTime !=null and deliveryPickupTime !='' ">
            deliveryPickupTime = #{deliveryPickupTime},
        </if>
        <if test="remarks !=null and remarks !='' ">
            remarks = #{remarks},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

    <delete id="SDdglOrderStoreRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_ddgl_order_store where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

    <insert id="addSDdglOrderStore" parameterType="pd" >

        insert into s_ddgl_order_store
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">

        <if test="orderId !=null and orderId !='' ">
            orderId,
        </if>
        <if test="deliveryType !=null and deliveryType !='' ">
            deliveryType,
        </if>
        <if test="mobileNumber !=null and mobileNumber !='' ">
            mobileNumber,
        </if>
        <if test="channelName !=null and channelName !='' ">
            channelName,
        </if>
        <if test="channelOrderNo !=null and channelOrderNo !='' ">
            channelOrderNo,
        </if>
        <if test="psoSaleOrderNo !=null and psoSaleOrderNo !='' ">
            psoSaleOrderNo,
        </if>
        <if test="orderStatus !=null and orderStatus !='' ">
            orderStatus,
        </if>
        <if test="deliveryStatus !=null and deliveryStatus !='' ">
            deliveryStatus,
        </if>
        <if test="orderDate !=null and orderDate !='' ">
            orderDate,
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName,
        </if>
        <if test="consumptionTime !=null and consumptionTime !='' ">
            consumptionTime,
        </if>
        <if test="memberId !=null and memberId !='' ">
            memberId,
        </if>
        <if test="memberName !=null and memberName !='' ">
            memberName,
        </if>
        <if test="systemLoginUserId !=null and systemLoginUserId !='' ">
            systemLoginUserId,
        </if>
        <if test="orderPlacer !=null and orderPlacer !='' ">
            orderPlacer,
        </if>
        <if test="orderTime !=null and orderTime !='' ">
            orderTime,
        </if>
        <if test="settlementId !=null and settlementId !='' ">
            settlementId,
        </if>
        <if test="settlementCode !=null and settlementCode !='' ">
            settlementCode,
        </if>
        <if test="finalPaymentTime !=null and finalPaymentTime !='' ">
            finalPaymentTime,
        </if>
        <if test="totalDrugQuantity !=null and totalDrugQuantity !='' ">
            totalDrugQuantity,
        </if>
        <if test="cardNumber !=null and cardNumber !='' ">
            cardNumber,
        </if>
        <if test="shippingAddress !=null and shippingAddress !='' ">
            shippingAddress,
        </if>
        <if test="orderAddress !=null and orderAddress !='' ">
            orderAddress,
        </if>
        <if test="orderType !=null and orderType !='' ">
            orderType,
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            orderSource,
        </if>
        <if test="totalAmount !=null and totalAmount !='' ">
            totalAmount,
        </if>
        <if test="deliveryFee !=null and deliveryFee !='' ">
            deliveryFee,
        </if>
        <if test="refundAmount !=null and refundAmount !='' ">
            refundAmount,
        </if>
        <if test="deliveryPickupMethod !=null and deliveryPickupMethod !='' ">
            deliveryPickupMethod,
        </if>
        <if test="deliveryPickupTime !=null and deliveryPickupTime !='' ">
            deliveryPickupTime,
        </if>
        <if test="remarks !=null and remarks !='' ">
            remarks,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="orderId !=null and orderId !='' ">
             #{orderId},
        </if>
        <if test="deliveryType !=null and deliveryType !='' ">
             #{deliveryType},
        </if>
        <if test="mobileNumber !=null and mobileNumber !='' ">
             #{mobileNumber},
        </if>
        <if test="channelName !=null and channelName !='' ">
             #{channelName},
        </if>
        <if test="channelOrderNo !=null and channelOrderNo !='' ">
             #{channelOrderNo},
        </if>
        <if test="psoSaleOrderNo !=null and psoSaleOrderNo !='' ">
             #{psoSaleOrderNo},
        </if>
        <if test="orderStatus !=null and orderStatus !='' ">
             #{orderStatus},
        </if>
        <if test="deliveryStatus !=null and deliveryStatus !='' ">
             #{deliveryStatus},
        </if>
        <if test="orderDate !=null and orderDate !='' ">
             #{orderDate},
        </if>
        <if test="storeName !=null and storeName !='' ">
             #{storeName},
        </if>
        <if test="consumptionTime !=null and consumptionTime !='' ">
             #{consumptionTime},
        </if>
        <if test="memberId !=null and memberId !='' ">
             #{memberId},
        </if>
        <if test="memberName !=null and memberName !='' ">
             #{memberName},
        </if>
        <if test="systemLoginUserId !=null and systemLoginUserId !='' ">
             #{systemLoginUserId},
        </if>
        <if test="orderPlacer !=null and orderPlacer !='' ">
             #{orderPlacer},
        </if>
        <if test="orderTime !=null and orderTime !='' ">
             #{orderTime},
        </if>
        <if test="settlementId !=null and settlementId !='' ">
             #{settlementId},
        </if>
        <if test="settlementCode !=null and settlementCode !='' ">
             #{settlementCode},
        </if>
        <if test="finalPaymentTime !=null and finalPaymentTime !='' ">
             #{finalPaymentTime},
        </if>
        <if test="totalDrugQuantity !=null and totalDrugQuantity !='' ">
             #{totalDrugQuantity},
        </if>
        <if test="cardNumber !=null and cardNumber !='' ">
             #{cardNumber},
        </if>
        <if test="shippingAddress !=null and shippingAddress !='' ">
             #{shippingAddress},
        </if>
        <if test="orderAddress !=null and orderAddress !='' ">
             #{orderAddress},
        </if>
        <if test="orderType !=null and orderType !='' ">
             #{orderType},
        </if>
        <if test="orderSource !=null and orderSource !='' ">
             #{orderSource},
        </if>
        <if test="totalAmount !=null and totalAmount !='' ">
             #{totalAmount},
        </if>
        <if test="deliveryFee !=null and deliveryFee !='' ">
             #{deliveryFee},
        </if>
        <if test="refundAmount !=null and refundAmount !='' ">
             #{refundAmount},
        </if>
        <if test="deliveryPickupMethod !=null and deliveryPickupMethod !='' ">
             #{deliveryPickupMethod},
        </if>
        <if test="deliveryPickupTime !=null and deliveryPickupTime !='' ">
             #{deliveryPickupTime},
        </if>
        <if test="remarks !=null and remarks !='' ">
             #{remarks},
        </if>
        </trim>

    </insert>

</mapper>
