cuijian
2023-08-19 bdd0875d4b13a3f1ef472f64d4b6a95e0ef64b22
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?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.RepairOrderMapper">
    <select id="getRepairOrderList" resultType="org.jeecg.modules.eam.entity.RepairOrder">
        select
        t1.id id,
        t1.status status,
        t1.num num,
        t1.equipment_id equipmentId,
        t1.team_id teamId,
        t1.recipient_user_id recipientUserId,
        t1.report_repair_id reportRepairId,
        t1.project_maintenance_order_id projectMaintenanceOrderId,
        t2.num equipmentNum,
        t2.name equipmentName,
        t2.model equipmentModel,
        t2.specific_equipment specificEquipment,
        t1.fault_description faultDescription,
        t1.fault_time faultTime,
        t1.photo photo,
        t1.is_stop isStop,
        t1.maintenance_method maintenanceMethod,
        t1.working_hour_quota workingHourQuota,
        t1.create_by createBy,
        t1.create_time createTime,
        t1.plan_start_time planStartTime,
        t1.plan_end_time planEndTime,
        t1.actual_start_time actualStartTime,
        t1.actual_end_time actualEndTime,
        t1.report_user_id reportUserId,
        t1.depart_id departId,
        t1.dispatch_method dispatchMethod,
        t1.urgency urgency,
        t1.business_type businessType,
        t1.responsibility_id responsibilityId,
        t1.outsourcing_unit outsourcingUnit,
        t1.remark,
        t3.depart_name departName,
        t4.name outsourcingUnitName,
        t5.realname responsibilityName,
        t6.`name` teamName
        from mom_eam_repair_order t1
        left join(select * from mom_eam_equipment where del_flag = 0 and status = 1) t2 on t1.equipment_id= t2.id
        left join sys_depart t3 on t3.id = t1.depart_id
        left join mom_base_supplier t4 on t1.outsourcing_unit = t4.id
        left join sys_user t5 on t5.id = t1.responsibility_id
        left join mom_base_team t6 on t6.id=t1.team_id
        where t1.del_flag = 0
        <if test="num != null and num != ''">
            and t1.num like concat('%',#{num},'%')
        </if>
        <if test="equipmentNum != null and equipmentNum != ''">
            and t2.num like concat('%',#{equipmentNum},'%')
        </if>
        <if test="equipmentName != null and equipmentName != ''">
            and t2.name like concat('%',#{equipmentName},'%')
        </if>
        <if test="status != null and status != ''">
            and t1.status = #{status}
        </if>
        and t1.repair_order_type = #{repairOrderType} order by t1.create_time desc
    </select>
 
 
    <select id="getUserTeam" resultType="org.jeecg.modules.eam.vo.UsetTeamVo">
        select
        t1.realname as realName,
        t1.id,
        t1.user_code as userCode,
        t3.name as teamName,
        t3.id as teamId
        FROM sys_user t1
        LEFT JOIN mom_base_team_class t2 on t2.id =t1.team_class_id
        LEFT JOIN mom_base_team t3 on t3.id =t2.team_id
        where t1.realname IS NOT NULL
        <if test="realname != null and realname != ''">
            and t1.realname like concat('%',#{realname},'%')
        </if>
        order by t1.create_time desc
    </select>
 
 
    <select id="getMaterialSpareList" resultType="org.jeecg.modules.eam.vo.SparePartListVo">
 
        select
        t1.id,
        t1.spare_part_id as sparePartId,
        IFNULL(t1.use_quantity,0) as useQuantity,
        t2.num,
        t2.id as outboundOrderId,
        IFNULL(t1.outbound_main_quantity,0) as mainQuantity,
        (IFNULL(t1.outbound_main_quantity,0)-IFNULL(t1.use_quantity,0)) as availableQuantity,
        t3.num as spareNum,
        t3.name as  spareName,
        t3.model,
        t3.specification,
        t4.name as constructorName,
        t4.id as  constructorId,
        t5.name as mainUnitName,
        t5.id as mainUnitId
        FROM   mom_eam_spare_part_outbound_detail  t1
        LEFT JOIN  mom_eam_spare_part_outbound t2 on t2.id = t1.spare_part_outbound_id
        LEFT JOIN  mom_eam_spare_part   t3  on  t3.id =t1.spare_part_id
        LEFT JOIN  mom_base_constructor   t4  on  t4.id =t3.constructor_id
        LEFT JOIN  mom_base_unit   t5  on  t5.id =t1.main_unit_id
        where t1.del_flag = 0 and t1.outbound_main_quantity != 0 and  (IFNULL(t1.outbound_main_quantity,0)-IFNULL(t1.use_quantity,0)) != 0
        <if test="status != null and status != ''">
            and t1.status = #{status}
        </if>
        <if test="num != null and num != ''">
            and t2.num like concat('%',#{num},'%')
        </if>
        order by t1.create_time desc
 
 
    </select>
</mapper>