MemberWriteMapper.xml 2.5 KB
<?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.sibu.orderHelper.mall.member.write.MemberWriteDao">

 	<select id="count" resultType="java.lang.Integer">
		select count(*) from member
	</select>

	<!-- 根据订单号查询订单信息  只查询不是主订单的订单 -->
	<select id="getOrdersByMap" parameterType="java.util.Map"  resultMap="orders">
		select * from orders  where  order_sn=#{orderSn,jdbcType=VARCHAR} AND seller_id=#{sellerId,jdbcType=INTEGER} AND  is_parent = 0
	</select>

	<!-- 修改订单备注 -->
	<update id="updateOdersRemark" parameterType="java.util.Map">
		UPDATE orders SET remark = #{remark},update_time = now() WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
	</update>


	<!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
	<update id="updateOrdersState">
		UPDATE orders
		<set>
			<if test="name !=null and name !=''">
				name = #{name},
			</if>
			<if test="addressInfo !=null and addressInfo !=''">
				address_info = #{addressInfo},
			</if>
			<if test="logisticsNumber !=null and logisticsNumber !=''">
				logistics_number = #{logisticsNumber},
			</if>
			<if test="mobile !=null and mobile !=''">
				mobile = #{mobile},
			</if>
			<if test="addressAll !=null and addressAll !=''">
				address_all = #{addressAll},
			</if>
			<if test="orderState !=null and orderState !=''">
				order_state = #{orderState},
			</if>
			<if test="provinceId !=null and provinceId !=''">
				province_id = #{provinceId},
			</if>
			<if test="areaId !=null and areaId !=''">
				area_id = #{areaId},
			</if>
			<if test="cityId !=null and cityId !=''">
				city_id = #{cityId},
			</if>
			<if test="deliverTime !=null and deliverTime !=''">
				deliver_time = now(),
			</if>
			<if test="logisticsName !=null and logisticsName !=''">
				logistics_name = #{logisticsName},
			</if>
			<if test="logisticsId !=null and logisticsId !=''">
				logistics_id = #{logisticsId},
			</if>
			update_time = now()
		</set>
		WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
	</update>



	<!-- 更新SKU库存-->
	<update id="updateSkuStock" parameterType="java.util.Map">
		UPDATE product_goods SET product_stock = #{stock} WHERE sku = #{skuId} and product_id = #{productId}
	</update>

	<!-- 更新产品库存-->
	<update id="updateProductStock" parameterType="java.util.Map">
		UPDATE product SET product_stock = #{productStock} WHERE id = #{productId}
	</update>

</mapper>