Lius
2024-03-14 9363b7a09744b3003ad6163ac42591fe40c59c5e
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?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="org.jeecg.modules.mdc.mapper.MdcHomeMapper">
 
    <select id="getProductionByPid" resultType="org.jeecg.modules.system.entity.MdcProduction">
        SELECT
            t1.*
        FROM
            mdc_production t1
                LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id
        WHERE
            t1.parent_id = #{ productionId } AND t2.user_id = #{ userId }
    </select>
 
    <select id="getProcessCount" resultType="java.math.BigDecimal">
        SELECT
            SUM(process_long)
        FROM
            mdc_equipment_statistical_info
        <where>
            <if test="equipmentIdList != null and equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
            AND the_date = #{ date }
        </where>
    </select>
 
    <select id="getOeeByDate" resultType="java.math.BigDecimal">
        SELECT
            SUM(overall_equipment_efficiency)
        FROM
            mdc_overall_equipment_efficiency
        <where>
            <if test="equipmentIdList != null and equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
            AND valid_date = #{ date }
        </where>
    </select>
 
    <select id="getUtilizationByMonth" resultType="java.util.Map">
        SELECT
            SUM(process_long) processLong,
            COUNT(*) processDay
        FROM
            mdc_equipment_statistical_info
        <where>
            <if test="equipmentIdList != null and equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
            AND the_date LIKE CONCAT('%', #{ date } ,'%')
        </where>
    </select>
 
</mapper>