Lius
2025-05-08 80cabc1fec87b8f8cf8026ae1a5c14aa2cab4527
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
<?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.MdcOeeInfoMapper">
 
    <!--分页列表-->
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcOeeInfo">
        SELECT
            *
        FROM
            mdc_oee_info
        <where>
            <if test="mdcOeeInfoVo.equipmentId != null and mdcOeeInfoVo.equipmentId != ''">
                AND equipment_id = #{ mdcOeeInfoVo.equipmentId }
            </if>
            <if test="mdcOeeInfoVo.startTime != null and mdcOeeInfoVo.startTime != ''">
                AND the_date &gt;= #{ mdcOeeInfoVo.startTime }
            </if>
            <if test="mdcOeeInfoVo.endTime != null and mdcOeeInfoVo.endTime != ''">
                AND the_date &lt;= #{mdcOeeInfoVo.endTime }
            </if>
            <if test="mdcOeeInfoVo.equipmentIdList != null and mdcOeeInfoVo.equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="mdcOeeInfoVo.equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
        </where>
        ORDER BY the_date DESC, equipment_id ASC
    </select>
 
    <select id="findByEquIdsAndDate" resultType="org.jeecg.modules.mdc.entity.MdcOeeInfo">
        SELECT
            the_date,
            AVG ( oee ) oee
        FROM
            mdc_oee_info
        <where>
            the_date BETWEEN #{start} AND #{end}
            AND equipment_id IN
            <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                #{ id }
            </foreach>
        </where>
        GROUP BY
            the_date
        ORDER BY
            the_date
    </select>
 
    <select id="findByEquIdAndDate" resultType="org.jeecg.modules.mdc.entity.MdcOeeInfo">
        SELECT * FROM mdc_oee_info WHERE the_date BETWEEN #{start} AND #{end} AND equipment_id = #{equipmentId} ORDER BY the_date
    </select>
 
    <select id="findByEquIdAndMonth" resultType="java.math.BigDecimal">
        SELECT
            AVG(oee)
        FROM
            mdc_oee_info
        WHERE
            the_date LIKE CONCAT(#{month}, '%')
          AND equipment_id = #{equipmentId}
    </select>
</mapper>