WebShareOrderMapper.xml 4.7 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.integral.web.dao.WebShareOrderDao">
	<sql id="Base_DoingOrder_column">
		order_id,member_id,order_code,order_status,order_from,
		order_platform,contact,phone,province,city,
		area,address,zipcode,total_integral,total_money,freight,buyer_remark,
		erp_download,erp_import,create_dt,main_order_code,delete_flag,buyer_username,buyer_phone,express_name,
		user_coupon_id,user_coupon_money,deduction_vb,deduction_money,share_member_id,share_order_money
	</sql>
	<sql id="Base_DoingOrder1_column">
		order1_id,member_id,order_id,sort_index,product_id,
		purchase_quantity,shipped_quantity,integral,line_integral,price,line_price
	</sql>


	<resultMap type="com.sibu.orderHelper.integral.reponse.ShareRewardOrderResponse" id="listIMOrderColumn">
		<id column="id" property="id" />
		<result column="share_user_id" property="shareUserId" />
		<result column="buyer_user_id" property="buyerUserId" />
		<result column="order_id" property="orderId" />
		<result column="order_code" property="orderCode" />
		<result column="profit_money" property="profitMoney" />
		<result column="refund_money" property="refundMoney" />
		<result column="profit_status" property="profitStatus" />
		<result column="product_id" property="productId" />
		<result column="product_price" property="productPrice" />
		<result column="product_share_percentage" property="productSharePercentage" />
		<result column="product_amount" property="productAmount" />
		<result column="profit_dt" property="profitDt" />
		<result column="order_dt" property="orderDt" />
		<result column="refund_dt" property="refundDt" />
		<result column="create_dt" property="createDt" />
		<result column="update_dt" property="updateDt" />
		<result column="settlement_dt" property="settlementDt" />
		<result column="phone" property="shareUserPhone" />
		<result column="true_name" property="shareUserName" />
		<result column="nick_name" property="nickName" />
		<result column="line_price" property="linePrice" />
		<result column="discount_line_price" property="discountLinePrice" />
		<result column="receive_dt" property="receiveDt" />
		<result column="create_dt" property="orderCreateDt" />
		<result column="order_status" property="orderStatus" />
	</resultMap>

	<!-- 分页查询分享奖励订单列表 -->
	<select id="listShareRewardOrder" parameterType="map" resultMap="listIMOrderColumn">
		SELECT spr.*,m.phone,m.true_name,m.nick_name,sop.discount_line_price,sop.line_price,so.receive_dt,so.create_dt,so.order_status
		FROM t_share_order_product sop
		LEFT JOIN t_share_order so ON sop.order_id=so.order_id
		LEFT JOIN t_share_profit_record spr ON so.order_id=spr.`order_id`
		LEFT JOIN t_member_info m ON so.member_id=m.member_id
		WHERE so.delete_flag=1
		<if test="phone != null and phone != ''">
			AND m.phone like concat('%',#{phone},'%')
		</if>
		<if test="orderCode != null and orderCode != ''">
			AND spr.order_code = #{orderCode}
		</if>
		<if test="startOrderDt != null and startOrderDt !=''">
			and spr.order_dt >= #{startOrderDt}
		</if>
		<if test="endOrderDt != null and endOrderDt != ''">
			<![CDATA[
		   and spr.order_dt <= #{endOrderDt}
		  ]]>
		</if>
		<if test="startReceiveDt != null and startReceiveDt !=''">
			and so.receive_dt >= #{startReceiveDt}
		</if>
		<if test="endReceiveDt != null and endReceiveDt != ''">
			<![CDATA[
		   and so.receive_dt <= #{endReceiveDt}
		  ]]>
		</if>
		order by spr.create_dt desc
		limit ${pageNow}, ${pageSize}
	</select>
	<select id="countShareRewardOrder" parameterType="map" resultType="java.lang.Integer">
		select count(1)
		FROM t_share_order_product sop
		INNER JOIN t_share_order so ON sop.order_id=so.order_id
		INNER JOIN t_share_profit_record spr ON so.order_id=spr.`order_id`
		INNER JOIN t_member_info m ON spr.share_user_id=m.member_id
		WHERE so.delete_flag=1
		<if test="phone != null and phone != ''">
			AND m.phone like concat('%',#{phone},'%')
		</if>
		<if test="orderCode != null and orderCode != ''">
			AND spr.order_code = #{orderCode}
		</if>
		<if test="startOrderDt != null and startOrderDt !=''">
			and spr.order_dt >= #{startOrderDt}
		</if>
		<if test="endOrderDt != null and endOrderDt != ''">
			<![CDATA[
		   and spr.order_dt <= #{endOrderDt}
		  ]]>
		</if>
		<if test="startReceiveDt != null and startReceiveDt !=''">
			and so.receive_dt >= #{startReceiveDt}
		</if>
		<if test="endReceiveDt != null and endReceiveDt != ''">
			<![CDATA[
		   and so.receive_dt <= #{endReceiveDt}
		  ]]>
		</if>
	</select>

	<update id="updateShareOrderByOrderCode" parameterType="map">
		UPDATE t_share_order SET order_status=#{orderStatus}  WHERE order_code = #{orderCode}
	</update>
</mapper>