89 lines
5.4 KiB
XML
89 lines
5.4 KiB
XML
<?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.suisung.mall.shop.order.mapper.ShopOrderItemMapper">
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="Base_Column_List">order_item_id
|
|
, order_id, buyer_id, store_id, product_id, item_id,
|
|
item_name, category_id, spec_id, spec_info, item_unit_price, item_unit_points, item_unit_sp,
|
|
order_item_unit_price,
|
|
item_platform_price, item_cost_price, order_item_quantity, order_item_inventory_lock, order_item_image,
|
|
order_item_return_num, order_item_return_subtotal, order_item_return_agree_amount, order_item_amount,
|
|
order_item_discount_amount, order_item_adjust_fee, order_item_points_fee, order_item_payment_amount,
|
|
order_item_evaluation_status, activity_type_id, activity_id, order_item_commission_rate,
|
|
order_item_commission_fee,
|
|
order_item_commission_fee_refund, policy_discountrate, item_voucher, order_item_note, order_item_file,
|
|
order_item_confirm_file, order_item_confirm_status, design_file_images, order_item_saler_id, item_src_id,
|
|
order_item_supplier_sync, src_order_id
|
|
</sql>
|
|
<select id="listItem" resultType="java.util.Map">
|
|
SELECT
|
|
shop_order_item.store_id,
|
|
shop_order_item.product_id,
|
|
shop_order_item.item_id,
|
|
|
|
shop_order_item.item_name,
|
|
shop_order_item.item_unit_price,
|
|
shop_order_item.order_item_image,
|
|
|
|
shop_product_index.product_unit_price,
|
|
shop_product_index.product_unit_price_max,
|
|
sum(
|
|
shop_order_item.order_item_quantity ) AS item_total
|
|
FROM
|
|
shop_order_info
|
|
INNER
|
|
JOIN shop_order_delivery_address ON shop_order_delivery_address.order_id = shop_order_info.order_id
|
|
|
|
INNER JOIN shop_order_item ON shop_order_info.order_id = shop_order_item.order_id
|
|
INNER JOIN
|
|
shop_product_index ON shop_order_item.product_id = shop_product_index.product_id
|
|
<where>
|
|
<if test="map.store_id!=null">shop_order_info.store_id=#{map.store_id}</if>
|
|
<if test="map.item_name!=null">and shop_order_item.item_name like concat('%', #{map.item_name}, '%')</if>
|
|
<if test="map.product_name!=null">and shop_product_index.product_name like concat('%', #{map.product_name},
|
|
'%')
|
|
</if>
|
|
<if test="map.category_id!=null">and shop_order_item.category_id=#{map.category_id}</if>
|
|
<if test="map.product_id!=null">and shop_order_item.product_id=#{map.product_id}</if>
|
|
<if test="map.order_st_time!=null">and shop_order_info.order_time >=#{map.order_st_time}</if>
|
|
<if test="map.order_ed_time">and shop_order_info.order_time <=#{map.order_ed_time}</if>
|
|
<if test="map.da_province_id!=null">and shop_order_delivery_address.da_province_id =#{map.da_province_id}
|
|
</if>
|
|
<if test="map.da_city_id!=null">and shop_order_delivery_address.da_city_id =#{map.da_city_id}</if>
|
|
<if test="map.da_county_id!=null">and shop_order_delivery_address.da_county_id =#{map.da_county_id}</if>
|
|
<if test="map.da_address!=null">and shop_order_delivery_address.da_address like concat('%',
|
|
#{map.da_address}, '%')
|
|
</if>
|
|
<if test="map.order_is_paid!=null">and shop_order_info.order_is_paid =#{map.order_is_paid}</if>
|
|
<if test="map.subsite_id!=null">and shop_order_info.subsite_id =#{map.subsite_id}</if>
|
|
</where>
|
|
GROUP BY
|
|
shop_order_item.item_id
|
|
ORDER BY
|
|
item_total DESC
|
|
</select>
|
|
<select id="getOrderItemList" resultType="java.util.Map">
|
|
select *
|
|
from shop_order_item m left join shop_order_info o on m.order_id = o.order_id
|
|
left join shop_order_delivery_address a ON a.order_id = o.order_id
|
|
left join shop_product_base b ON m.product_id = b.product_id
|
|
<where>
|
|
<if test="params.store_id!=null">m.store_id=#{params.store_id}</if>
|
|
<if test="params.order_id!=null">and m.order_id=#{params.order_id}</if>
|
|
<if test="params.item_id!=null">and m.item_id=#{params.item_id}</if>
|
|
<if test="params.order_is_paid!=null">and o.order_is_paid=#{params.order_is_paid}</if>
|
|
<if test="params.order_st_time!=null">and o.order_time >=#{params.order_st_time}</if>
|
|
<if test="params.order_ed_time">and o.order_time <=#{params.order_ed_time}</if>
|
|
<if test="params.query_order_st_time!=null">and o.order_time >=#{params.query_order_st_time}</if>
|
|
<if test="params.query_order_ed_time!=null">and o.order_time <=#{params.query_order_ed_time}</if>
|
|
<if test="params.category_id!=null">and m.category_id=#{params.category_id}</if>
|
|
<if test="params.product_name!=null">and b.product_name like concat('%', #{params.product_name}, '%')</if>
|
|
<if test="params.product_id!=null">and m.product_id=#{params.product_id}</if>
|
|
<if test="params.da_province_id!=null">and a.da_province_id =#{params.da_province_id}</if>
|
|
<if test="params.da_city_id!=null">and a.da_city_id =#{params.da_city_id}</if>
|
|
<if test="params.da_county_id!=null">and a.da_county_id =#{params.da_county_id}</if>
|
|
<if test="params.da_address!=null">and a.da_address like concat('%', #{params.da_address}, '%')</if>
|
|
</where>
|
|
</select>
|
|
</mapper>
|