|  | @@ -4,6 +4,9 @@
 | 
											
												
													
														|  |      <resultMap id="BaseResultMap" type="com.yami.shop.bean.model.Order">
 |  |      <resultMap id="BaseResultMap" type="com.yami.shop.bean.model.Order">
 | 
											
												
													
														|  |          <id column="order_id" jdbcType="BIGINT" property="orderId"/>
 |  |          <id column="order_id" jdbcType="BIGINT" property="orderId"/>
 | 
											
												
													
														|  |          <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
 |  |          <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="channel_id" jdbcType="BIGINT" property="channelId"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="channel_name" jdbcType="VARCHAR" property="channelName"/>
 | 
											
												
													
														|  |          <result column="prod_name" jdbcType="VARCHAR" property="prodName"/>
 |  |          <result column="prod_name" jdbcType="VARCHAR" property="prodName"/>
 | 
											
												
													
														|  |          <result column="user_id" jdbcType="VARCHAR" property="userId"/>
 |  |          <result column="user_id" jdbcType="VARCHAR" property="userId"/>
 | 
											
												
													
														|  |          <result column="order_number" jdbcType="VARCHAR" property="orderNumber"/>
 |  |          <result column="order_number" jdbcType="VARCHAR" property="orderNumber"/>
 | 
											
										
											
												
													
														|  | @@ -12,6 +15,7 @@
 | 
											
												
													
														|  |          <result column="pay_type" jdbcType="INTEGER" property="payType"/>
 |  |          <result column="pay_type" jdbcType="INTEGER" property="payType"/>
 | 
											
												
													
														|  |          <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
 |  |          <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
 | 
											
												
													
														|  |          <result column="hb_order_status" jdbcType="INTEGER" property="hbOrderStatus"/>
 |  |          <result column="hb_order_status" jdbcType="INTEGER" property="hbOrderStatus"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="dvy_status" jdbcType="VARCHAR" property="dvyStatus"/>
 | 
											
												
													
														|  |          <result column="dvy_type" jdbcType="VARCHAR" property="dvyType"/>
 |  |          <result column="dvy_type" jdbcType="VARCHAR" property="dvyType"/>
 | 
											
												
													
														|  |          <result column="dvy_id" jdbcType="BIGINT" property="dvyId"/>
 |  |          <result column="dvy_id" jdbcType="BIGINT" property="dvyId"/>
 | 
											
												
													
														|  |          <result column="dvy_flow_id" jdbcType="VARCHAR" property="dvyFlowId"/>
 |  |          <result column="dvy_flow_id" jdbcType="VARCHAR" property="dvyFlowId"/>
 | 
											
										
											
												
													
														|  | @@ -80,9 +84,14 @@
 | 
											
												
													
														|  |      <resultMap type="com.yami.shop.bean.model.Order" id="orderAndOrderItemMap">
 |  |      <resultMap type="com.yami.shop.bean.model.Order" id="orderAndOrderItemMap">
 | 
											
												
													
														|  |          <id column="order_id" jdbcType="BIGINT" property="orderId"/>
 |  |          <id column="order_id" jdbcType="BIGINT" property="orderId"/>
 | 
											
												
													
														|  |          <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
 |  |          <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="channel_id" jdbcType="BIGINT" property="channelId"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="channel_name" jdbcType="VARCHAR" property="channelName"/>
 | 
											
												
													
														|  |          <result column="prod_name" jdbcType="VARCHAR" property="prodName"/>
 |  |          <result column="prod_name" jdbcType="VARCHAR" property="prodName"/>
 | 
											
												
													
														|  |          <result column="user_id" jdbcType="VARCHAR" property="userId"/>
 |  |          <result column="user_id" jdbcType="VARCHAR" property="userId"/>
 | 
											
												
													
														|  |          <result column="order_number" jdbcType="VARCHAR" property="orderNumber"/>
 |  |          <result column="order_number" jdbcType="VARCHAR" property="orderNumber"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="hb_order_status" jdbcType="VARCHAR" property="hbOrderStatus"/>
 | 
											
												
													
														|  | 
 |  | +        <result column="dvy_status" jdbcType="VARCHAR" property="dvyStatus"/>
 | 
											
												
													
														|  |          <result column="total" jdbcType="DECIMAL" property="total"/>
 |  |          <result column="total" jdbcType="DECIMAL" property="total"/>
 | 
											
												
													
														|  |          <result column="actual_total" jdbcType="DECIMAL" property="actualTotal"/>
 |  |          <result column="actual_total" jdbcType="DECIMAL" property="actualTotal"/>
 | 
											
												
													
														|  |          <result column="pay_type" jdbcType="INTEGER" property="payType"/>
 |  |          <result column="pay_type" jdbcType="INTEGER" property="payType"/>
 | 
											
										
											
												
													
														|  | @@ -408,6 +417,12 @@
 | 
											
												
													
														|  |  <!--            <if test="orderParam.payType != null">-->
 |  |  <!--            <if test="orderParam.payType != null">-->
 | 
											
												
													
														|  |  <!--                and o.pay_type = #{orderParam.payType}-->
 |  |  <!--                and o.pay_type = #{orderParam.payType}-->
 | 
											
												
													
														|  |  <!--            </if>-->
 |  |  <!--            </if>-->
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.dvyType != null">
 | 
											
												
													
														|  | 
 |  | +                and o.dvy_type = #{orderParam.dvyType}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.channelId != null">
 | 
											
												
													
														|  | 
 |  | +                and o.channel_id = #{orderParam.channelId}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  |              <if test="orderParam.shopId != null">
 |  |              <if test="orderParam.shopId != null">
 | 
											
												
													
														|  |                  and o.shop_id = #{orderParam.shopId}
 |  |                  and o.shop_id = #{orderParam.shopId}
 | 
											
												
													
														|  |              </if>
 |  |              </if>
 | 
											
										
											
												
													
														|  | @@ -499,13 +514,13 @@
 | 
											
												
													
														|  |                  </if>
 |  |                  </if>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  <if test="orderParam.orderStatus == 'paddingReceived'">
 |  |                  <if test="orderParam.orderStatus == 'paddingReceived'">
 | 
											
												
													
														|  | -                    AND a.hb_order_status in (20,30,40,50,70)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    AND a.hb_order_status in (20,30,40,70)
 | 
											
												
													
														|  |                  </if>
 |  |                  </if>
 | 
											
												
													
														|  |                  <if test="orderParam.orderStatus == 'completed'">
 |  |                  <if test="orderParam.orderStatus == 'completed'">
 | 
											
												
													
														|  |                      AND a.hb_order_status in (80)
 |  |                      AND a.hb_order_status in (80)
 | 
											
												
													
														|  |                  </if>
 |  |                  </if>
 | 
											
												
													
														|  |                  <if test="orderParam.orderStatus == 'cancel'">
 |  |                  <if test="orderParam.orderStatus == 'cancel'">
 | 
											
												
													
														|  | -                    AND a.hb_order_status in (60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    AND a.hb_order_status in (50,60)
 | 
											
												
													
														|  |                  </if>
 |  |                  </if>
 | 
											
												
													
														|  |              </if>
 |  |              </if>
 | 
											
												
													
														|  |          </where>
 |  |          </where>
 | 
											
										
											
												
													
														|  | @@ -554,13 +569,13 @@
 | 
											
												
													
														|  |                  </if>
 |  |                  </if>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  <if test="orderParam.orderStatus == 'paddingReceived'">
 |  |                  <if test="orderParam.orderStatus == 'paddingReceived'">
 | 
											
												
													
														|  | -                    AND a.hb_order_status in (20,30,40,50,70)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    AND a.hb_order_status in (20,30,40,70)
 | 
											
												
													
														|  |                  </if>
 |  |                  </if>
 | 
											
												
													
														|  |                  <if test="orderParam.orderStatus == 'completed'">
 |  |                  <if test="orderParam.orderStatus == 'completed'">
 | 
											
												
													
														|  |                      AND a.hb_order_status in (80)
 |  |                      AND a.hb_order_status in (80)
 | 
											
												
													
														|  |                  </if>
 |  |                  </if>
 | 
											
												
													
														|  |                  <if test="orderParam.orderStatus == 'cancel'">
 |  |                  <if test="orderParam.orderStatus == 'cancel'">
 | 
											
												
													
														|  | -                    AND a.hb_order_status in (60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    AND a.hb_order_status in (50,60)
 | 
											
												
													
														|  |                  </if>
 |  |                  </if>
 | 
											
												
													
														|  |              </if>
 |  |              </if>
 | 
											
												
													
														|  |          </where>
 |  |          </where>
 | 
											
										
											
												
													
														|  | @@ -575,15 +590,22 @@
 | 
											
												
													
														|  |          JOIN tz_user_addr_order uao
 |  |          JOIN tz_user_addr_order uao
 | 
											
												
													
														|  |          ON o.addr_order_id = uao.addr_order_id
 |  |          ON o.addr_order_id = uao.addr_order_id
 | 
											
												
													
														|  |          <where>
 |  |          <where>
 | 
											
												
													
														|  | 
 |  | +            o.delete_status = 0
 | 
											
												
													
														|  |              <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
 |  |              <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
 | 
											
												
													
														|  |                  and o.order_number = #{orderParam.orderNumber}
 |  |                  and o.order_number = #{orderParam.orderNumber}
 | 
											
												
													
														|  |              </if>
 |  |              </if>
 | 
											
												
													
														|  | -            <if test="orderParam.orderStatus != null">
 |  | 
 | 
											
												
													
														|  | -                and o.hb_order_status = #{orderParam.orderStatus}
 |  | 
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.hbOrderStatus != null">
 | 
											
												
													
														|  | 
 |  | +                and o.hb_order_status = #{orderParam.hbOrderStatus}
 | 
											
												
													
														|  |              </if>
 |  |              </if>
 | 
											
												
													
														|  |              <if test="orderParam.shopId != null">
 |  |              <if test="orderParam.shopId != null">
 | 
											
												
													
														|  |                  and o.shop_id = #{orderParam.shopId}
 |  |                  and o.shop_id = #{orderParam.shopId}
 | 
											
												
													
														|  |              </if>
 |  |              </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.channelId != null">
 | 
											
												
													
														|  | 
 |  | +                and o.channel_id = #{orderParam.channelId}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.dvyType != null">
 | 
											
												
													
														|  | 
 |  | +                and o.dvy_type = #{orderParam.dvyType}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  |              <if test="orderParam.isPayed != null">
 |  |              <if test="orderParam.isPayed != null">
 | 
											
												
													
														|  |                  and o.is_payed = #{orderParam.isPayed}
 |  |                  and o.is_payed = #{orderParam.isPayed}
 | 
											
												
													
														|  |                  and o.hb_order_status != 60
 |  |                  and o.hb_order_status != 60
 | 
											
										
											
												
													
														|  | @@ -966,5 +988,99 @@
 | 
											
												
													
														|  |              #{status}
 |  |              #{status}
 | 
											
												
													
														|  |          </foreach>
 |  |          </foreach>
 | 
											
												
													
														|  |      </select>
 |  |      </select>
 | 
											
												
													
														|  | 
 |  | +    <select id="selectOrderCount" resultType="com.yami.shop.bean.param.OrderCountParam">
 | 
											
												
													
														|  | 
 |  | +        SELECT
 | 
											
												
													
														|  | 
 |  | +        count(1) as allCount,
 | 
											
												
													
														|  | 
 |  | +        count(case when hb_order_status = 0 then 1 end) as payedCount,
 | 
											
												
													
														|  | 
 |  | +        count(case when hb_order_status = 20 then 1 end) as readyCount,
 | 
											
												
													
														|  | 
 |  | +        count(case when hb_order_status = 30 then 1 end) as deliveryCount,
 | 
											
												
													
														|  | 
 |  | +        count(case when hb_order_status = 40 then 1 end) as shippingCount,
 | 
											
												
													
														|  | 
 |  | +        count(case when hb_order_status = 50 then 1 end) as cancelAuditCount,
 | 
											
												
													
														|  | 
 |  | +        count(case when hb_order_status = 60 then 1 end) as canceledCount,
 | 
											
												
													
														|  | 
 |  | +        count(case when hb_order_status = 70 then 1 end) as arrivedCount,
 | 
											
												
													
														|  | 
 |  | +        count(case when hb_order_status = 80 then 1 end) as completedCount
 | 
											
												
													
														|  | 
 |  | +        FROM tz_order
 | 
											
												
													
														|  | 
 |  | +        <where>
 | 
											
												
													
														|  | 
 |  | +            delete_status = 0
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
 | 
											
												
													
														|  | 
 |  | +                and o.order_number = #{orderParam.orderNumber}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.hbOrderStatus != null">
 | 
											
												
													
														|  | 
 |  | +                and o.hb_order_status = #{orderParam.hbOrderStatus}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.dvyType != null">
 | 
											
												
													
														|  | 
 |  | +                and o.dvy_type = #{orderParam.dvyType}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.channelId != null">
 | 
											
												
													
														|  | 
 |  | +                and o.channel_id = #{orderParam.channelId}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.shopId != null">
 | 
											
												
													
														|  | 
 |  | +                and o.shop_id = #{orderParam.shopId}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.startTime != null">
 | 
											
												
													
														|  | 
 |  | +                and o.create_time > #{orderParam.startTime}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.endTime != null">
 | 
											
												
													
														|  | 
 |  | +                and o.create_time < #{orderParam.endTime}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.orderType != null">
 | 
											
												
													
														|  | 
 |  | +                and o.order_type = #{orderParam.orderType}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.refundStatus == 0">
 | 
											
												
													
														|  | 
 |  | +                and o.refund_status  IS NULL
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +        </where>
 | 
											
												
													
														|  | 
 |  | +    </select>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    <select id="deliveryOrder" resultMap="BaseResultMap">
 | 
											
												
													
														|  | 
 |  | +        SELECT o.*, sd.shop_name,ch.channel_name
 | 
											
												
													
														|  | 
 |  | +        FROM tz_order o
 | 
											
												
													
														|  | 
 |  | +        LEFT JOIN tz_shop_detail sd ON o.shop_id = sd.shop_id
 | 
											
												
													
														|  | 
 |  | +        LEFT JOIN tz_channel ch ON o.channel_id = ch.id
 | 
											
												
													
														|  | 
 |  | +        join tz_user_addr_order uao ON o.addr_order_id = uao.addr_order_id
 | 
											
												
													
														|  | 
 |  | +        <where>
 | 
											
												
													
														|  | 
 |  | +            o.delete_status = 0 AND o.dvy_type = #{orderParam.dvyType}
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
 | 
											
												
													
														|  | 
 |  | +                AND o.order_number  LIKE concat('%',  #{orderParam.orderNumber}, '%')
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.mobile != null and orderParam.mobile != ''">
 | 
											
												
													
														|  | 
 |  | +                AND uao.mobile LIKE concat('%', #{orderParam.mobile}, '%')
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.receiver != null and orderParam.receiver != ''">
 | 
											
												
													
														|  | 
 |  | +                AND uao.receiver LIKE concat('%', #{orderParam.receiver}, '%')
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.startTime != null">
 | 
											
												
													
														|  | 
 |  | +                AND o.create_time >= #{orderParam.startTime}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.endTime != null">
 | 
											
												
													
														|  | 
 |  | +                AND o.create_time <= #{orderParam.endTime}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.channelId != null">
 | 
											
												
													
														|  | 
 |  | +                AND o.channel_id = #{orderParam.channelId}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.shopId != null">
 | 
											
												
													
														|  | 
 |  | +                AND o.shopId = #{orderParam.shopId}
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            <if test="orderParam.hbOrderStatus != null">
 | 
											
												
													
														|  | 
 |  | +                <if test="orderParam.hbOrderStatus == 0">
 | 
											
												
													
														|  | 
 |  | +                    AND o.hb_order_status = 0
 | 
											
												
													
														|  | 
 |  | +                </if>
 | 
											
												
													
														|  | 
 |  | +                <if test="orderParam.hbOrderStatus == 20">
 | 
											
												
													
														|  | 
 |  | +                    AND o.hb_order_status = 20
 | 
											
												
													
														|  | 
 |  | +                </if>
 | 
											
												
													
														|  | 
 |  | +                <if test="orderParam.hbOrderStatus == 70">
 | 
											
												
													
														|  | 
 |  | +                    AND o.hb_order_status in (30,40,70)
 | 
											
												
													
														|  | 
 |  | +                </if>
 | 
											
												
													
														|  | 
 |  | +                <if test="orderParam.hbOrderStatus == 80">
 | 
											
												
													
														|  | 
 |  | +                    AND o.hb_order_status = 80
 | 
											
												
													
														|  | 
 |  | +                </if>
 | 
											
												
													
														|  | 
 |  | +                <if test="orderParam.hbOrderStatus == 60">
 | 
											
												
													
														|  | 
 |  | +                    AND o.hb_order_status in (50, 60)
 | 
											
												
													
														|  | 
 |  | +                </if>
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +        </where>
 | 
											
												
													
														|  | 
 |  | +        ORDER BY o.create_time DESC
 | 
											
												
													
														|  | 
 |  | +    </select>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  </mapper>
 |  |  </mapper>
 |