<?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>
|