MemberWriteMapper.xml 5.4 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">

	<!-- 订单实体 -->
	<resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
		<result property="id" column="id" />
		<result property="sellerId" column="seller_id" />
		<result property="sellerName" column="seller_name" />
		<result property="orderId" column="order_id" />
		<result property="orderSn" column="order_sn" />
		<result property="orderProductId" column="order_product_id" />
		<result property="productId" column="product_id" />
		<result property="productName" column="product_name" />
		<result property="memberId" column="member_id" />
		<result property="memberName" column="member_name" />
		<result property="provinceId" column="province_id" />
		<result property="cityId" column="city_id" />
		<result property="areaId" column="area_id" />
		<result property="addressAll" column="address_all" />
		<result property="addressInfo" column="address_info" />
		<result property="zipCode" column="zip_code" />
		<result property="changeName" column="change_name" />
		<result property="phone" column="phone" />
		<result property="logisticsId" column="logistics_id" />
		<result property="logisticsName" column="logistics_name" />
		<result property="logisticsMark" column="logistics_mark" />
		<result property="logisticsNumber" column="logistics_number" />
		<result property="number" column="number" />
		<result property="question" column="question" />
		<result property="image" column="image" />
		<result property="name" column="name" />
		<result property="state" column="state" />
		<result property="optId" column="opt_id" />
		<result property="optName" column="opt_name" />
		<result property="remark" column="remark" />
		<result property="createTime" column="create_time" />
		<result property="updateTime" column="update_time" />
		<result property="regionName1" column="regionName1" />
		<result property="regionName2" column="regionName2" />
		<result property="regionName3" column="regionName3" />
		<result property="orderState" column="order_state" />
		<result property="moneyOrder" column="money_order" />
		<result property="moneyPaidBalance" column="money_paid_balance" />
		<result property="moneyCoupon" column="money_coupon" />
		<result property="moneyLogistics" column="money_logistics" />
		<result property="moneyProduct" column="money_product" />
		<result property="moneyActFull" column="money_act_full" />
		<result property="moneyDiscount" column="money_discount" />
		<result property="moneyBack" column="money_back" />
		<result property="moneyIntegral" column="money_integral" />
		<result property="payTime" column="pay_time" />
	</resultMap>

 	<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>

	<!-- 订单发货-->
	<!-- 验证订单号是否已存在-->
	<select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
		select count(*) from orders  where  order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
	</select>


	<!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
	<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>