mobilebroken/nflg-mobilebroken-repository/src/main/resources/mapper/AnonymousTicketMapper.xml

45 lines
2.3 KiB
XML
Raw Normal View History

<?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.nflg.mobilebroken.repository.mapper.AnonymousTicketMapper">
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.AnonymousTicketSearchVO">
2025-05-08 15:50:18 +08:00
SELECT t.id,t.`no`,t.title,p.part_name AS 'component',d.customer_name AS 'customerName',d.agent_name AS 'agentName'
,t.device_no AS 'deviceNo',t.use_time AS 'useTime',t.create_time AS 'createTime',di.name AS 'warrantyStatusDesc'
,d.device_type AS 'deviceType',d.model_no AS 'equipmentModel',d.shipment_date AS 'shipmentDate',t.phone,t.email
2025-05-08 15:50:18 +08:00
,t.description,c.area_name
FROM anonymous_ticket t
LEFT JOIN device d ON t.device_no=d.device_no
LEFT JOIN t_base_device_type dt ON d.device_type=dt.device_type
LEFT JOIN dictionary_item di ON d.warranty_state=di.id
2025-05-08 15:50:18 +08:00
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN t_base_customer c ON c.agency_company_code=d.agent_code
<where>
<if test="request.component!=null and request.component!=''">
AND t.component=#{request.component}
</if>
<if test="request.warrantyStatus!=null">
AND d.warranty_state=#{request.warrantyStatus}
</if>
<if test="request.startTime!=null">
AND t.create_time>=#{request.startTime}
</if>
<if test="request.endTime!=null">
AND t.create_time &lt;= #{request.endTime}
</if>
<if test="request.title!=null and request.title!=''">
AND (t.title LIKE CONCAT('%', #{request.title}, '%') OR t.no LIKE CONCAT('%', #{request.title}, '%'))
</if>
<if test="request.deviceNo!=null and request.deviceNo!=''">
AND t.device_no LIKE CONCAT('%', #{request.deviceNo}, '%')
</if>
<if test="request.phone!=null and request.phone!=''">
AND t.phone LIKE CONCAT('%', #{request.phone}, '%')
</if>
<if test="request.email!=null and request.email!=''">
AND t.email LIKE CONCAT('%', #{request.email}, '%')
</if>
</where>
ORDER BY t.id DESC
</select>
</mapper>