ZengTao
2025-04-14 559ab830a6341fec1b920a44bafd18342f16d712
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?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.mes.bigstoragecagetask.mapper.BigStorageCageHistoryTaskMapper">
 
    <resultMap id="baseMap" type="com.mes.largenscreen.entity.DailyProductionVO">
        <result column="date" property="date"/>
        <result column="count_out_one" property="countOutOne"/>
        <result column="total_area_out_one" property="totalAreaOutOne"/>
        <result column="count_out_two" property="countOutTwo"/>
        <result column="total_area_out_two" property="totalAreaOutTwo"/>
        <result column="count_in" property="countIn"/>
        <result column="total_area_in" property="totalAreaIn"/>
        <result column="count_out" property="countOut"/>
        <result column="total_area_out" property="totalAreaOut"/>
        <result column="hollow_count_out_one" property="hollowCountOutOne"/>
        <result column="hollow_total_area_out_one" property="hollowTotalAreaOutOne"/>
        <result column="hollow_count_out_two" property="hollowCountOutTwo"/>
        <result column="hollow_total_area_out_two" property="hollowTotalAreaOutTwo"/>
    </resultMap>
 
    <select id="queryBigDailyProduction" resultMap="baseMap">
        with big_storage_in_temp as (
        select count(t.glass_id) as count_in, round(sum(t1.width * t1.height) / 1000000, 2) as total_area_in
        from big_storage_cage_history_task t
        INNER JOIN glass_info t1 on t.glass_id = t1.glass_id
        where t.task_type = 1
        <if test="beginDate != null and beginDate != ''">
            AND STR_TO_DATE( t.create_time, '%Y-%m-%d' ) BETWEEN #{beginDate}
            AND #{endDate}
        </if>
        ),
        big_storage_out_temp as (
        select count(t.glass_id) as count_out, round(sum(t1.width * t1.height) / 1000000, 2) as total_area_out
        from big_storage_cage_history_task t
        INNER JOIN glass_info t1 on t.glass_id = t1.glass_id
        where t.task_type = 2
        <if test="beginDate != null and beginDate != ''">
            AND STR_TO_DATE( t.create_time, '%Y-%m-%d' ) BETWEEN #{beginDate}
            AND #{endDate}
        </if>
        )
        select *
        from big_storage_in_temp
        INNER join big_storage_out_temp on 1 = 1
 
    </select>
 
</mapper>