yangys
2024-10-15 131d4bcb26e721c09c89d330f78639af7a0eda72
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?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.qianwen.smartman.modules.tpm.mapper.RepairRecordMapper">
 
    <select id="exportRecordVo" resultType="com.qianwen.smartman.modules.tpm.vo.excel.RepairRecordExcelVO"
            parameterType="com.qianwen.smartman.modules.tpm.dto.RepairRecordExportDTO">
        select
        a.apply_code as applyCode,
        r.record_code as recordCode,
        r.device_code as deviceCode,
        r.device_name as deviceName,
        r.device_type_name as deviceTypeName,
        a.apply_user_name as applyUserName,
        a.description as description,
        r.error_code as errorCode,
        r.malfunction_time as malfunctionTime,
        a.urgency as urgency,
        r.repair_start_time as repairStartTime,
        r.repair_end_time as repairEndTime,
        r.repair_time as repairTime,
        r.repair_user_name as repairUserName,
        r.malfunction_details as malfunctionDetails,
        r.record_type as recordType
        from blade_repair_record r
        left join blade_repair_apply a on r.repair_apply_id = a.id and a.is_deleted =0
        where r.is_deleted = 0
        <if test="tenantId != null and tenantId != ''">
            AND r.tenant_id = #{tenantId}
        </if>
 
        <if test="repairRecordExportDTO.deviceTypeId != null">
            AND r.device_type_id = #{repairRecordExportDTO.deviceTypeId}
        </if>
 
        <if test="repairRecordExportDTO.deviceId != null">
            AND r.device_id = #{repairRecordExportDTO.deviceId}
        </if>
        <if test="repairRecordExportDTO.recordStatusList != null and repairRecordExportDTO.recordStatusList.size() > 0">
            and r.record_status IN
            <foreach collection="repairRecordExportDTO.recordStatusList" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
 
        <if test="repairRecordExportDTO.keyWord != null and repairRecordExportDTO.keyWord != ''">
            AND (r.record_code like concat(#{repairRecordExportDTO.keyWord},'%')
            OR r.device_code like concat(#{repairRecordExportDTO.keyWord},'%')
            OR r.device_name like concat(#{repairRecordExportDTO.keyWord},'%')
            OR a.apply_code like concat(#{repairRecordExportDTO.keyWord},'%')
            )
        </if>
 
        order by r.create_time desc,r.id desc
    </select>
 
    <select id="getRepairRecordPages" resultType="com.qianwen.smartman.modules.tpm.vo.RepairRecordVO">
        select
        r.id as id,
        r.record_code as recordCode,
        a.apply_code as applyCode,
        r.repair_apply_id as repairApplyId,
        r.record_status as recordStatus,
        r.record_type as recordType,
        r.error_code as errorCode,
        r.repair_start_time as repairStartTime,
        r.repair_end_time as repairEndTime,
        r.repair_time as repairTime,
        r.repair_user_id as repairUserId,
        r.repair_user_name as repairUserName,
        r.malfunction_details as malfunctionDetails,
        r.malfunction_time as malfunctionTime,
        r.device_id as deviceId,
        r.device_code as deviceCode,
        r.device_name as deviceName,
        r.device_type_id as deviceTypeId,
        r.device_type_name as deviceTypeName,
        r.is_affect as isAffect,
        a.apply_user_id as applyUserId,
        a.apply_user_name as applyUserName,
        a.description as description,
        r.malfunction_name as malfunctionName,
        r.real_malfunction_id as realMalfunctionId,
        r.real_malfunction_code as realMalfunctionCode,
        r.real_malfunction_name as realMalfunctionName,
        r.remark as remark,
        r.repair_nature as repairNature,
        r.urgency as urgency
        from blade_repair_record r
        LEFT JOIN blade_repair_apply a on r.repair_apply_id = a.id and a.is_deleted =0
        where r.is_deleted = 0
        <if test="searchDTO.keyWords != null and searchDTO.keyWords !=''">
            and r.device_code like concat(#{searchDTO.keyWords},'%')
            or a.apply_code like concat(#{searchDTO.keyWords},'%')
            or r.device_name like concat(#{searchDTO.keyWords},'%')
            or r.record_code like concat(#{searchDTO.keyWords},'%')
        </if>
        <if test="searchDTO.recordStatus != null">
            and r.record_status =#{searchDTO.recordStatus}
        </if>
        <if test="searchDTO.deviceTypeId != null and searchDTO.deviceTypeId !=''">
            and r.device_type_id = #{searchDTO.deviceTypeId}
        </if>
        ORDER BY r.create_time desc,r.id desc
    </select>
 
    <select id="getRepairTodayRecordPages" resultType="com.qianwen.smartman.modules.tpm.vo.RepairRecordVO">
        select
        r.id as id,
        r.record_code as recordCode,
        a.apply_code as applyCode,
        a.urgency as urgency,
        r.repair_apply_id as repairApplyId,
        r.record_status as recordStatus,
        r.record_type as recordType,
        r.error_code as errorCode,
        r.repair_start_time as repairStartTime,
        r.repair_end_time as repairEndTime,
        r.repair_time as repairTime,
        r.repair_user_id as repairUserId,
        r.repair_user_name as repairUserName,
        r.malfunction_details as malfunctionDetails,
        r.malfunction_time as malfunctionTime,
        r.device_id as deviceId,
        r.device_code as deviceCode,
        r.device_name as deviceName,
        r.device_type_id as deviceTypeId,
        r.device_type_name as deviceTypeName,
        r.is_affect as isAffect,
        a.apply_user_id as applyUserId,
        a.apply_user_name as applyUserName,
        a.description as description,
        a.create_time as applyTime,
        r.repair_nature as repairNature,
        r.remark as remark
        from blade_repair_record r
        LEFT JOIN blade_repair_apply a on r.repair_apply_id = a.id and a.is_deleted =0
        where r.is_deleted = 0
        and r.record_status = 1
        <if test="searchVO.applyCode != null and searchVO.applyCode !=''">
            and a.apply_code like concat(#{searchVO.applyCode},'%')
        </if>
        <if test="searchVO.deviceName != null and searchVO.deviceName !=''">
            and r.device_name like concat(#{searchVO.deviceName},'%')
        </if>
        <if test="searchVO.deviceCode != null and searchVO.deviceCode !=''">
            and r.device_code like concat(#{searchVO.deviceCode},'%')
        </if>
        <if test="searchVO.recordType != null">
            and r.record_type = #{searchVO.recordType}
        </if>
        ORDER BY r.record_code desc
    </select>
</mapper>