<?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">
<!-- 命名，每一个映射对象不一样
	namespace:必须与对应的接口全类名一致
 -->
<mapper namespace="com.iamberry.wechat.service.mapper.AdminOrderMapper">
	<!-- 后台订单返利信息查询 -->
	<select id="selectOrderRebackByOrderId" parameterType="String" resultType="OrderRebackMoney">
		
		SELECT ( SELECT place_openid FROM tb_iamberry_place_info b WHERE b.place_id = a.logs_place_id
		) name ,
		 (SELECT place_username FROM tb_iamberry_place_info b WHERE b.place_id = a.logs_place_id
		) account ,
		(
		SELECT role_name FROM tb_iamberry_place_role WHERE role_id = (
		SELECT Place_role_id FROM tb_iamberry_place_info b WHERE b.place_id = a.logs_place_id)
		) role,
		logs_num money,logs_create_date TIME,logs_introduction remark FROM tb_iamberry_place_logs a WHERE logs_introduction LIKE  CONCAT('%',#{orderId},'%') 
		UNION ALL
		SELECT 
		(SELECT b.user_openid
		 FROM   tb_iamberry_user_userinfo b WHERE b.user_openid = a.cash_logs_openid
		) name,(SELECT b.user_nickname
		 FROM   tb_iamberry_user_userinfo b WHERE b.user_openid = a.cash_logs_openid
		)  account
		,'微代理'  role
		,cash_logs_num money,cash_logs_create_date TIME,cash_logs_introduction remark FROM tb_iamberry_user_cash_logs  a WHERE cash_logs_orderid =#{orderId} 
		AND cash_logs_type = 1
		AND cash_logs_res_type = 4 
		
	</select>
	
	<!-- 后台订单列表查询 -->
	<select id="selectShopOrder" parameterType="Order" resultType="Order">
		SELECT O.SALES_ORDERID salesOrderid, O.SALES_ADDRESS_NAME salesAddressName, 
			U.USER_NICKNAME userNickname, O.SALES_ADDRESS_TEL salesAddressTel,  
			O.SALES_AMOUNT salesAmount, O.SALES_RATE_AMOUNT salesRateAmount, 
			O.SALES_INTEGRAL_NUM salesIntegralNum, O.SALES_YET_AMOUNT salesYetAmount, 
			O.SALES_STATUS salesStatus, O.SALES_CREATE_DATE salesCreateDate, 
			O.SALES_POST_NUM salesPostNum,O.SALES_POST_FIRM salesPostFirm,
			O.SALES_ADMIN_REMARK salesAdminRemark, O.SALES_COLOR_TYPE salesColorType, 
			O.SALES_USER_REMARK salesUserRemark,
			P.PLACE_NAME storesName, 
			PP.PLACE_NAME vipName,
			PP.PLACE_ROLE_ID vipRole,
			PP.PLACE_OPENID placeOpenID,
			U.USER_RES_TYPE userResource,
			(SELECT IFNULL(SUM(reback_money),0) FROM tb_iamberry_reback WHERE reback_orderid = O.SALES_ORDERID and Reback_status  = 2) placeId
		FROM 
			TB_IAMBERRY_SHOP_SALES_ORDER O 
		LEFT JOIN 
			TB_IAMBERRY_USER_USERINFO U 
		ON 
			O.SALES_OPENID = U.USER_OPENID 
			<!-- 根据用户信息中的dealers查询对应的关系 -->
		LEFT JOIN 
			TB_IAMBERRY_DEALERS D 
		ON 
			U.USER_DEALERS = D.DEALER_ID
			<!-- 查询用户关系对应的商户 -->
		LEFT JOIN 
			TB_IAMBERRY_PLACE_INFO P 
		ON 
			D.DEALER_ID = P.PLACE_PIDS
			<!-- 查询商户的上级，也就是门店 -->
		LEFT JOIN 
			TB_IAMBERRY_PLACE_INFO PP 
		ON
			P.PLACE_PID = PP.PLACE_ID
		WHERE 
			O.SALES_ORDER_TYPE = 1 
			<if test="salesStatus != null and salesStatus != -1">
				AND O.SALES_STATUS = #{salesStatus} 
			</if>
			<if test="salesOrderid != null and salesOrderid!=''">
				AND O.SALES_ORDERID = #{salesOrderid} 
			</if>
		ORDER BY O.SALES_CREATE_DATE DESC 
		LIMIT ${page.recordBegin},${page.pageSize}
	</select>
	
	<!-- 根据订单号，获取订单所属人 -->
	<select id="selectSalesOpenIdByOrderId" parameterType="String" resultType="String">
		SELECT
			SALES_OPENID
		FROM
			TB_IAMBERRY_SHOP_SALES_ORDER
		WHERE
			SALES_ORDERID = #{orderId}
		LIMIT
			0, 1
	</select>
	
	<select id="selectShopOrderByOrderId" parameterType="Order" resultType="Order">
		SELECT O.SALES_ORDERID salesOrderid, O.SALES_ADDRESS_NAME salesAddressName, 
			U.USER_NICKNAME userNickname, O.SALES_ADDRESS_TEL salesAddressTel,  
			O.SALES_AMOUNT salesAmount, O.SALES_RATE_AMOUNT salesRateAmount, 
			O.SALES_INTEGRAL_NUM salesIntegralNum, O.SALES_YET_AMOUNT salesYetAmount, 
			O.SALES_STATUS salesStatus, O.SALES_CREATE_DATE salesCreateDate, 
			O.SALES_ADMIN_REMARK salesAdminRemark, O.SALES_COLOR_TYPE salesColorType,
			o.sales_post_num salesPostNum,o.sales_post_firm salesPostFirm,
			O.SALES_USER_REMARK salesUserRemark 
		FROM 
			TB_IAMBERRY_SHOP_SALES_ORDER O LEFT JOIN TB_IAMBERRY_USER_USERINFO U 
		ON O.SALES_OPENID = U.USER_OPENID 
		<where>
			<if test="salesStatus != null and salesStatus != -1">
				O.SALES_STATUS = #{salesStatus} 
			</if>
			<if test="salesOrderid != null and salesOrderid!=''">
				AND O.SALES_ORDERID LIKE CONCAT('%',#{salesOrderid},'%') 
			</if>
			<if test="salesAddressName != null and salesAddressName != ''">
				AND O.SALES_ADDRESS_NAME LIKE CONCAT('%',#{salesAddressName},'%') 
			</if>
			<if test="salesAddressTel != null and salesAddressTel != ''">
				AND O.SALES_ADDRESS_TEL LIKE CONCAT('%',#{salesAddressTel},'%') 
			</if>
			<if test="salesAddressInfo != null and salesAddressInfo != ''">
				AND O.SALES_ADDRESS_INFO LIKE CONCAT('%',#{salesAddressInfo},'%') 
			</if>
			<if test="beginDate != null">
				<![CDATA[AND DATE_FORMAT(O.SALES_CREATE_DATE, '%Y-%m-%d') >= ]]>DATE_FORMAT(#{beginDate},'%Y-%m-%d') 
			</if>
			<if test="endDate != null">
				<![CDATA[AND DATE_FORMAT(O.SALES_CREATE_DATE, '%Y-%m-%d') <= ]]>DATE_FORMAT(#{endDate},'%Y-%m-%d') 
			</if>
		</where>
		ORDER BY O.SALES_CREATE_DATE DESC 
		LIMIT ${page.recordBegin},${page.pageSize}
	</select>
	
	<!-- 根据条件获取查询数量 -->
	<select id="selectShopOrderCount" parameterType="Order" resultType="int">
		SELECT 
			COUNT(O.SALES_ORDERID)  
		FROM 
			TB_IAMBERRY_SHOP_SALES_ORDER O LEFT JOIN TB_IAMBERRY_USER_USERINFO U 
		ON O.SALES_OPENID = U.USER_OPENID 
		WHERE 
			O.SALES_ORDER_TYPE = 1 
			<if test="salesStatus != null and salesStatus != -1">
				 AND O.SALES_STATUS = #{salesStatus} 
			</if>
			<if test="salesOrderid != null and salesOrderid!=''">
				AND O.SALES_ORDERID LIKE CONCAT('%',#{salesOrderid},'%') 
			</if>
			<if test="salesAddressName != null and salesAddressName != ''">
				AND O.SALES_ADDRESS_NAME LIKE CONCAT('%',#{salesAddressName},'%') 
			</if>
			<if test="salesAddressTel != null and salesAddressTel != ''">
				AND O.SALES_ADDRESS_TEL LIKE CONCAT('%',#{salesAddressTel},'%') 
			</if>
			<if test="salesAddressInfo != null and salesAddressInfo != ''">
				AND O.SALES_ADDRESS_INFO LIKE CONCAT('%',#{salesAddressInfo},'%') 
			</if>
			<if test="beginDate != null">
				<![CDATA[AND DATE_FORMAT(O.SALES_CREATE_DATE, '%Y-%m-%d') >= ]]>DATE_FORMAT(#{beginDate},'%Y-%m-%d') 
			</if>
			<if test="endDate != null">
				<![CDATA[AND DATE_FORMAT(O.SALES_CREATE_DATE, '%Y-%m-%d') <= ]]>DATE_FORMAT(#{endDate},'%Y-%m-%d') 
			</if>
	</select>
			
	<!-- 根据orderId查询订单信息 -->
	<select id="getShopOrderByOrderId" parameterType="String" resultType="Order">
		SELECT O.SALES_ORDERID salesOrderid, U.USER_NICKNAME userNickname, O.SALES_STATUS salesStatus, 
			O.SALES_YET_AMOUNT salesYetAmount, O.SALES_INTEGRAL_NUM salesIntegralNum, O.SALES_RATE_AMOUNT salesRateAmount, 
			O.SALES_POST_FIRM salesPostFirm, O.SALES_POST_NUM salesPostNum, O.SALES_CREATE_DATE salesCreateDate, 
			O.SALES_ADDRESS_POSTNUM salesAddressPostnum,  O.SALES_REWARD_INTEGRAL_NUM salesRewardIntegralNum, 
			O.SALES_ADDRESS_NAME salesAddressName, O.SALES_ADDRESS_TEL salesAddressTel, O.SALES_SEND_DATE salesSendDate, 
			O.SALES_USER_REMARK salesUserRemark, O.SALES_COLOR_TYPE salesColorType, O.SALES_ADMIN_REMARK salesAdminRemark, 
			O.SALES_RETURN_DES salesReturnDes, O.SALES_ADDRESS_INFO salesAddressInfo, O.SALES_RETURN_DATE salesReturnDate,
			O.SALES_AMOUNT salesAmount, O.SALES_TRANSACTION_DATE salesTransactionDate, O.SALES_OPENID salesOpenid, 
			O.SALES_COUPON_RECEIVE_ID couponId, O.SALES_BALANCE_AMOUNT balancePayAmount 
		FROM 
			TB_IAMBERRY_SHOP_SALES_ORDER O LEFT JOIN TB_IAMBERRY_USER_USERINFO U 
			ON O.SALES_OPENID = U.USER_OPENID 
		WHERE 
			O.SALES_ORDERID = #{0} 
		AND 
			O.SALES_ORDER_TYPE = 1 
	</select>
	
	<!-- 根据orderId获取订单项数据 -->
	<select id="getShopOrderItemByOrderId" parameterType="String" resultType="OrderItem">
		SELECT I.ITEM_PRODUCT_NAME itemProductName, I.ITEM_PRODUCT_PIC itemProductPic, I.ITEM_PRODUCT_PRICE itemProductPrice, 
			I.ITEM_PRODUCT_DISCOUNT itemProductDiscount, I.ITEM_NUM itemNum, I.ITEM_TOTAL itemTotal, C.COLOR_NAME productColor,
			C.COLOR_69CODE produectRemark 
		FROM 
			TB_IAMBERRY_SHOP_ORDER_ITEM I LEFT JOIN TB_IAMBERRY_PRODUCT_INFO P 
			ON I.ITEM_PRODUCT_ID = P.PRODUCT_ID 
			LEFT JOIN TB_IAMBERRY_PRODUCT_COLOR C ON I.ITEM_COLOR_ID = C.COLOR_ID 
		WHERE 
			ITEM_SALES_ORDERID = #{0} 
		ORDER BY ITEM_ID DESC
	</select>
	
	<!-- 根据orderId查询订单状态 -->
	<select id="selectOrderStatusByOrderId" parameterType="String" resultType="Order">
		SELECT 
			SALES_STATUS salesStatus, SALES_PROXY_REWARD salesProxyReward, 
			SALES_POST_FIRM salesPostFirm, SALES_POST_NUM salesPostNum ,
			sales_openid salesOpenid
			
		FROM 
			TB_IAMBERRY_SHOP_SALES_ORDER
		WHERE 
			SALES_ORDERID = #{salesOrderid}
	</select>
	
	<!-- 根据orderId修改订单状态 -->
	<update id="updateOrderStatusByOrderId" parameterType="Order">
		UPDATE 
			TB_IAMBERRY_SHOP_SALES_ORDER 
		SET 
			<if test="salesChangeOrderid != null and salesChangeOrderid != ''">
				SALES_CHANGE_ORDERID = #{salesChangeOrderid},
			</if>
			SALES_STATUS = #{salesStatus} 
		WHERE 
			SALES_ORDERID = #{salesOrderid} 
		AND 
			SALES_STATUS = #{oldStatus} 
	</update>
	
	<!-- 根据orderId修改订单状态 -->
	<update id="updateOrderStatusByOrderIdAndToStatus" parameterType="Order">
		UPDATE 
			TB_IAMBERRY_SHOP_SALES_ORDER 
		SET 
			SALES_STATUS = #{salesStatus} 
		WHERE 
			SALES_ORDERID = #{salesOrderid} AND SALES_STATUS = #{salesOpenid}
	</update>
	
	<!-- 根据orderid添加发货信息并修改状态 -->
	<update id="deliverOrderByOrderId" parameterType="Order">
		UPDATE 
			TB_IAMBERRY_SHOP_SALES_ORDER 
		SET 
			SALES_STATUS = #{salesStatus}, 
			SALES_POST_NUM = #{salesPostNum}, 
			SALES_POST_FIRM = #{salesPostFirm}, 
			SALES_SEND_DATE = NOW() 
		WHERE 
			SALES_ORDERID = #{salesOrderid}
	</update>
	
	<!-- 根据orderid添加发货信息并修改状态 -->
	<update id="updateOrderDeliver" parameterType="Order">
		UPDATE 
			TB_IAMBERRY_SHOP_SALES_ORDER 
		SET 
			SALES_STATUS = #{salesStatus}, 
			SALES_POST_NUM = #{salesPostNum}, 
			SALES_POST_FIRM = #{salesPostFirm}, 
			SALES_SEND_DATE = NOW() 
		WHERE 
			SALES_ORDERID = #{salesOrderid} 
		AND 
			SALES_STATUS = #{oldStatus}
	</update>
	
	<!-- 修改订单的备注信息 -->
	<update id="updateOrderAdminRemarkByOrderId" parameterType="Order" >
		UPDATE 
			TB_IAMBERRY_SHOP_SALES_ORDER 
		<set>
			<if test="salesColorType != null and salesColorType != ''">
				SALES_COLOR_TYPE = #{salesColorType}, 
			</if>
			<if test="salesAdminRemark != null and salesAdminRemark != ''">
				SALES_ADMIN_REMARK = #{salesAdminRemark} 
			</if>
		</set>
		WHERE 
			SALES_ORDERID = #{salesOrderid}
	</update>
	
	<!-- 查询订单中没有奖励积分的数据 -->
	<select id="selectOrderByIntegral" resultType="Order" resultMap="orderMap">
		SELECT 
			O.SALES_ORDERID, 
			O.SALES_OPENID, 
			O.SALES_AMOUNT, 
			O.SALES_REWARD_INTEGRAL_NUM  
		FROM 
			TB_IAMBERRY_SHOP_SALES_ORDER O 
		WHERE 
			O.SALES_PROXY_REWARD = 1 
		AND 
			<![CDATA[ TIMESTAMPDIFF(SECOND,O.SALES_SEND_DATE,NOW()) >= #{deadline} ]]>
		AND 
			O.SALES_STATUS = 5 
		ORDER BY O.SALES_SEND_DATE ASC 
		LIMIT ${page.recordBegin},${page.pageSize}
	</select>
	
	<resultMap type="com.iamberry.wechat.core.entity.order.Order" id="orderMap">
		<id column="SALES_ORDERID" property="salesOrderid"/>
		<result column="SALES_OPENID" property="salesOpenid"/>
		<result column="SALES_AMOUNT" property="salesAmount"/>
		<result column="SALES_REWARD_INTEGRAL_NUM" property="salesRewardIntegralNum"/>
		<collection property="orderItemList" column="SALES_ORDERID" ofType="com.iamberry.wechat.core.entity.order.OrderItem" select="selectOrderItem"/>
	</resultMap>
	
	<!-- 查询订单的订单项 -->
	<select id="selectOrderItem" parameterType="String" resultType="com.iamberry.wechat.core.entity.order.OrderItem">
		SELECT I.ITEM_ID itemId, 
			I.ITEM_SALES_ORDERID itemSalesOrderid, I.ITEM_PRODUCT_NAME itemProductName, 
			I.ITEM_NUM itemNum, I.ITEM_PRODUCT_TYPE itemProductType 
		FROM 
			TB_IAMBERRY_SHOP_ORDER_ITEM I 
		WHERE 
			I.ITEM_SALES_ORDERID = #{itemSalesOrderid} 
		ORDER BY I.ITEM_ID DESC
	</select>
	
	
	<!-- 通过openid查询用户购买商品的渠道 -->
	<select id="getUserByOpenId" parameterType="String" resultType="Member">
		SELECT 
			USER_RES_TYPE userResType,
			USER_ID userId, 
			USER_OPENID userOpenid,
			USER_INTEGRAL userIntegral,
			USER_INCOME userIncome,
			USER_DEALERS userDealers,
			USER_TEMPLATE_ID templateId,
			USER_SURPLUS_INTEGRAL userSurplusIntegral 
		FROM 
			TB_IAMBERRY_USER_USERINFO 
		WHERE 
			USER_OPENID = #{openId}
	</select>
	
	<!-- 根据推荐人id查询推荐人信息 -->
	<select id="getUserByUserRefereeid" parameterType="Integer" resultType="Member">
		SELECT 
			USER_OPENID userOpenid,
			USER_INTEGRAL userIntegral,
			USER_INCOME userIncome,
			USER_SURPLUS_INTEGRAL userSurplusIntegral 
		FROM 
			TB_IAMBERRY_USER_USERINFO 
		WHERE 
			USER_ID = #{userId}
	</select>
	
	<!-- 根据userid修改会员表信息 -->
	<update id="updateUserByUserId" parameterType="Member">
		UPDATE 
			TB_IAMBERRY_USER_USERINFO 
		SET 
			USER_INCOME =(USER_INCOME + #{userIncome}) 
		<where>
			<if test="userId != null and userId != ''">
				USER_ID = #{userId} 
			</if>
			<if test="userOpenid != null and userOpenid != ''">
				AND USER_OPENID = #{userOpenid}
			</if>
		</where>
	</update>
	
	<update id="updatePlaceInfo" parameterType="PlaceInfo">
	     update 
	     	tb_iamberry_place_info 
	     SET 
	          PLACE_AMOUNT =(PLACE_AMOUNT + #{amount}) 
	      WHERE 
	     	PLACE_ID = #{id} 
     </update>
     
     <select id="getPlaceInfoByPlaceId" parameterType="integer" resultType="PlaceInfo">
		SELECT 
			PLACE_ID id,
			PLACE_SUPPER_ID supperId,
			PLACE_NAME  name,
			PLACE_ADDR   addr,
			PLACE_USERNAME  userName,
			PLACE_TEL  tel,
			PLACE_AMOUNT  amount,
			PLACE_CREATE_DATE  createDate,
			PLACE_STATUS  status,
			PLACE_OPENID  openid,
			PLACE_ROLE_ID roleId,
			PLACE_PID  placePid ,
			PLACE_INIT_CODE  initCode 
        FROM tb_iamberry_place_info WHERE place_id = #{appid}
	</select>
	
	<!-- 根据id查询系统规则表信息 -->
	<select id="getReluByRid" parameterType="Integer" resultType="ShopSystemRule">
		SELECT R_NUM ruleNum, R_TYPE ruleType FROM TB_IAMBERRY_ADMIN_RELU WHERE R_ID = #{rId} 
	</select>
	
	<!-- 根据类型查询系统推责表信息 -->
	<select id="getReluByRtype" parameterType="Integer" resultType="ShopSystemRule">
		SELECT R_NUM ruleNum FROM TB_IAMBERRY_ADMIN_RELU WHERE R_TYPE = #{ruleType} 
	</select>
	
	<!-- 查询订单表中有多少是可以奖励积分的单的数量 -->
	<select id="getOrderNum"  resultType="Integer" parameterType="Order">
		SELECT 
			COUNT(SALES_ORDERID) 
		FROM 
			TB_IAMBERRY_SHOP_SALES_ORDER O 
		WHERE 
			O.SALES_PROXY_REWARD = 1 
		AND 
			<![CDATA[ TIMESTAMPDIFF(SECOND,O.SALES_SEND_DATE,NOW()) >= #{deadline} ]]> 
		AND 
			O.SALES_STATUS = 5 
		ORDER BY O.SALES_SEND_DATE ASC 
	</select>
	
	<!-- 对客户进行积分奖励 -->
	<update id="updateOrderIntegral" parameterType="String">
		UPDATE 
			TB_IAMBERRY_SHOP_SALES_ORDER 
		SET 
			SALES_PROXY_REWARD = 2, 
			SALES_STATUS = 12 
		WHERE 
			SALES_ORDERID = #{0}
	</update>
	
	<!-- 根据规定的订单关闭时间查询大于该时间且是待支付的订单 -->
	<select id="getOrderByCreateTime" resultType="Order" parameterType="Order">
		SELECT 
			T.SALES_ORDERID salesOrderid,T.SALES_COUPON_RECEIVE_ID couponId,T.SALES_OPENID salesOpenid 
			
		FROM 
			TB_IAMBERRY_SHOP_SALES_ORDER T 
		WHERE 
			T.SALES_STATUS = 1 
		AND 
			<![CDATA[ TIMESTAMPDIFF(SECOND,T.SALES_CREATE_DATE,NOW()) >= #{deadline} ]]> 
	</select>
	
	<!-- 根据规定的订单关闭时间查询大于该时间且是待支付的订单 -->
	<select id="getOrderByCreateTimeAndFiveMinutes" resultType="Order" parameterType="Order">
		
			SELECT 
				T.SALES_ORDERID salesOrderid,T.SALES_OPENID salesOpenid ,
				T.SALES_CREATE_DATE salesCreateDate
			FROM 
				TB_IAMBERRY_SHOP_SALES_ORDER T 
			WHERE 
				T.SALES_STATUS = 1 
			AND 
				<![CDATA[  #{deadline}-TIMESTAMPDIFF(SECOND,T.SALES_CREATE_DATE,NOW()) <= 900 ]]> 
	</select>
	
	
	<!-- 根据orderId修改订单状态，关闭订单 -->
	<update id="updateOrderByOrderId" parameterType="java.util.List">
		UPDATE 
			TB_IAMBERRY_SHOP_SALES_ORDER 
		SET 
			SALES_STATUS = 0 
		WHERE 
			SALES_ORDERID  IN (
				<foreach collection="list" item="item" separator=",">
					#{item} 
		        </foreach>) 
	</update>
	
		
	<!-- 获取某个订单的所有产品的总个数 -->
  <select id="getItemsNumByOrderId"  parameterType="string" resultType="com.iamberry.wechat.core.entity.order.OrderItem">
    select 
    	sum(g.item_num) itemNum,
    	c.color_69code produectRemark 
    from 
    	tb_iamberry_shop_order_item g  LEFT JOIN tb_iamberry_product_color c on g.item_color_id = c.color_id 
    where 
		g.item_sales_orderid=#{id} 
	GROUP BY 
		c.color_69code
  </select>
  
  <!-- 查询状态为待发货的所有订单号 -->
  <select id="getOrderList" resultType="Order" parameterType="Order">
  	SELECT 
  		SALES_ORDERID salesOrderid 
  	FROM 
  		TB_IAMBERRY_SHOP_SALES_ORDER 
  	WHERE 
  		SALES_STATUS = #{salesStatus} 
  </select>
  
  <!-- 批量修改订单状态 -->
  <update id="updateOrderListStatus" parameterType="java.util.List">
  		<foreach collection="list" item="item" index="index" separator=";" open="" close="">
			UPDATE 
				TB_IAMBERRY_SHOP_SALES_ORDER 
			SET 
				SALES_STATUS = 5, 
				SALES_POST_NUM = #{item.salesPostNum,jdbcType=VARCHAR}, 
				SALES_POST_FIRM = #{item.salesPostFirm,jdbcType=VARCHAR}, 
				SALES_SEND_DATE = #{item.salesSendDate,javaType=DATE} 
			WHERE 
				SALES_ORDERID  =  #{item.salesOrderid,jdbcType=VARCHAR} 
		</foreach>
	</update>
	
</mapper>