Helius
2021-11-10 e497a05ce312d26864b0c23cad97da9eb32c2cc1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?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.xzx.gc.shop.mapper.OrderInfoMapper">
 
    <select id="selectOrderTitleStatistics" resultType="java.util.Map">
        select
            f.title title,
            sum(e.weight) weight
        from xzx_order_info a
            inner join xzx_electronic_fence b on a.town_id=b.id
            inner join xzx_sys_address_level_info c on b.town_code=c.adcode
            inner join xzx_sys_environmental_info d on c.level_3_id=d.city_id
            inner join xzx_order_item_info e on d.item_type=e.item_type and a.order_id=e.order_id and e.weight !=0
            inner join xzx_sys_environmental_info f on f.id=d.parent_id
        where a.order_status in (5)
        <if test="userId != null and userId != ''">
            and a.create_user_id = #{userId}
        </if>
        group by f.title
    </select>
 
    <select id="selectOrderCnt" resultType="java.lang.Integer">
        select IFNULL(count(1),0) from xzx_order_info
        where order_status = 5
        <if test="userId != null and userId != ''">
            and create_user_id = #{userId}
        </if>
    </select>
</mapper>