cuilei
7 天以前 767ba5a54ca5597de816015f387981776b928f7b
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
65
66
<?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.eam.mapper.EamRepairOrderMapper">
 
    <select id="pageList" resultType="org.jeecg.modules.eam.entity.EamRepairOrder">
        SELECT
            t1.*,
            t2.equipment_name
        FROM
            eam_repair_order t1
                LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
        <where>
            <choose>
                <when test="equipmentIds != null and equipmentIds.size() > 0 ">
                    AND t2.equipment_code IN
                    <foreach collection="equipmentIds" item="equipmentId" index="index" open="(" close=")" separator=",">
                        #{equipmentId}
                    </foreach>
                </when>
                <otherwise>
                    EXISTS ( SELECT 1 FROM mdc_user_production t3 WHERE t3.user_id = #{userId} AND t3.pro_id= t2.org_id )
                </otherwise>
            </choose>
            <if test="eamRepairOrder.equipmentCode != null and eamRepairOrder.equipmentCode != ''">
                AND t2.equipment_code LIKE CONCAT(CONCAT('%',#{ eamRepairOrder.equipmentCode }),'%')
            </if>
            <if test="eamRepairOrder.equipmentId != null and eamRepairOrder.equipmentId != ''">
                AND t2.id = #{ eamRepairOrder.equipmentId }
            </if>
            <if test="eamRepairOrder.equipmentName != null and eamRepairOrder.equipmentName != ''">
                AND t2.equipment_name LIKE CONCAT(CONCAT('%',#{ eamRepairOrder.equipmentName }),'%')
            </if>
            <if test="eamRepairOrder.repairStatus != null and eamRepairOrder.repairStatus != ''">
                AND t1.repair_status = #{ eamRepairOrder.repairStatus }
            </if>
            <if test="eamRepairOrder.repairer != null and eamRepairOrder.repairer != ''">
                AND t1.repairer LIKE CONCAT(CONCAT('%',#{ eamRepairOrder.repairer }),'%')
            </if>
            <if test="eamRepairOrder.repairCode != null and eamRepairOrder.repairCode != ''">
                AND t1.repair_code LIKE CONCAT(CONCAT('%',#{ eamRepairOrder.repairCode }),'%')
            </if>
            <if test="eamRepairOrder.sparePartDescription != null and eamRepairOrder.sparePartDescription != ''">
                AND t1.spare_part_description LIKE CONCAT(CONCAT('%',#{ eamRepairOrder.sparePartDescription }),'%')
            </if>
        </where>
        ORDER BY t1.create_time DESC
    </select>
 
    <select id="repairmanRanking" resultType="org.jeecg.modules.eam.vo.RepairmanRankingVO">
        select t.repairer, COUNT(1) as repairNumber
        from eam_repair_order t
        where t.repair_status = 'COMPLETE'
          and t.del_flag = 0
          and t.actual_end_time &gt;= #{start}
          and t.actual_end_time &lt; #{end}
        group by t.repairer
        order by repairNumber desc
    </select>
    <select id="queryPageList" resultType="org.jeecg.modules.eam.entity.EamRepairOrder">
        select wmo.*, e.equipment_code, e.equipment_name, e.installation_position
        from eam_repair_order wmo
        inner join eam_equipment e
        on wmo.equipment_id = e.id
        ${ew.customSqlSegment}
    </select>
</mapper>