yangys
2025-04-11 120755e6874893d284fda5f617924d46960286c0
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
<?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.RepairApplyMapper">
 
    <select id="exportApplyVo" resultType="com.qianwen.smartman.modules.tpm.vo.excel.RepairApplyExcelVO"
            parameterType="com.qianwen.smartman.modules.tpm.vo.RepairApplyExportVO">
        select
        r.apply_code as applyCode,
        r.urgency as urgency,
        r.device_code as deviceCode,
        r.device_name as deviceName,
        r.device_type_name as deviceTypeName,
        r.malfunction_time as malfunctionTime,
        r.apply_user_name as applyUserName,
        r.description as description
        from blade_repair_apply r
        where r.is_deleted = 0
        <if test="tenantId != null and tenantId != ''">
            AND r.tenant_id = #{tenantId}
        </if>
        <if test="repairApplyExportVO.deviceTypeId != null">
            AND r.device_type_id = #{repairApplyExportVO.deviceTypeId}
        </if>
 
        <if test="repairApplyExportVO.deviceId != null">
            AND r.device_id = #{repairApplyExportVO.deviceId}
        </if>
        <if test="repairApplyExportVO.applyStatusList != null and repairApplyExportVO.applyStatusList.size() > 0">
            AND r.apply_status IN
            <foreach collection="repairApplyExportVO.applyStatusList" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="repairApplyExportVO.keyWord != null and repairApplyExportVO.keyWord != ''">
            AND (r.apply_code like concat(#{repairApplyExportVO.keyWord},'%')
            OR r.device_code like concat(#{repairApplyExportVO.keyWord},'%')
            OR r.device_name like concat(#{repairApplyExportVO.keyWord},'%')
            )
        </if>
        order by r.is_affect asc,nvl(r.urgency,''),r.urgency desc,r.create_time desc,r.id desc
    </select>
</mapper>