2025-01-19 11:30:15 +08:00
|
|
|
<?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.TicketMapper">
|
|
|
|
|
|
|
|
|
|
<sql id="searchWhereCondition">
|
2025-01-27 16:08:17 +08:00
|
|
|
<if test="request.title!=null and request.title!=''">
|
2025-01-19 11:30:15 +08:00
|
|
|
AND t.title LIKE CONCAT('%', #{request.title}, '%')
|
|
|
|
|
</if>
|
2025-01-27 16:08:17 +08:00
|
|
|
<if test="request.deviceNo!=null and request.deviceNo!=''">
|
2025-01-19 11:30:15 +08:00
|
|
|
AND t.device_no LIKE CONCAT('%', #{request.deviceNo}, '%')
|
|
|
|
|
</if>
|
2025-01-27 16:08:17 +08:00
|
|
|
<if test="request.component!=null and request.component!=''">
|
2025-01-19 11:30:15 +08:00
|
|
|
AND t.component LIKE CONCAT('%', #{request.component}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.state!=null">
|
|
|
|
|
AND t.state=#{request.state}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.startTime!=null">
|
|
|
|
|
AND t.create_time>=#{request.startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.endTime!=null">
|
|
|
|
|
AND t.create_time < #{request.endTime}
|
|
|
|
|
</if>
|
|
|
|
|
</sql>
|
2025-01-25 23:11:05 +08:00
|
|
|
|
|
|
|
|
<sql id="adminSearchWhereCondition">
|
|
|
|
|
<where>
|
|
|
|
|
<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.state!=null">
|
|
|
|
|
AND t.state=#{request.state}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.urgency!=null">
|
|
|
|
|
AND t.urgency=#{request.urgency}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.component!=null and request.component!=''">
|
|
|
|
|
AND t.component=#{request.component}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.handleUserName!=null and request.handleUserName!=''">
|
|
|
|
|
AND u.handle LIKE CONCAT('%', #{request.handleUserName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.companyId!=null">
|
|
|
|
|
AND u.company_id=#{request.companyId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.areaId!=null">
|
|
|
|
|
AND u.area_id=#{request.areaId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.question!=null and request.question!=''">
|
|
|
|
|
AND t.question=#{request.question}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.createUserName!=null and request.createUserName!=''">
|
|
|
|
|
AND u.name LIKE CONCAT('%', #{request.createUserName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.startTime!=null">
|
|
|
|
|
AND t.create_time>=#{request.startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.endTime!=null">
|
|
|
|
|
AND t.create_time <= #{request.endTime}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</sql>
|
|
|
|
|
|
2025-01-19 11:30:15 +08:00
|
|
|
<select id="searchMy" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
|
2025-02-06 13:19:24 +08:00
|
|
|
SELECT t.*,a.`name` AS 'areaName',IF(tf.id IS NULL, false, true) AS 'followed',u.`name` AS 'createBy'
|
2025-01-19 11:30:15 +08:00
|
|
|
FROM ticket t
|
2025-02-06 13:19:24 +08:00
|
|
|
LEFT JOIN app_user u ON t.user_id=u.id
|
|
|
|
|
LEFT JOIN app_area a ON u.area_id=a.id
|
|
|
|
|
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id
|
2025-01-19 11:30:15 +08:00
|
|
|
WHERE t.user_id=#{userId}
|
|
|
|
|
<include refid="searchWhereCondition"/>
|
|
|
|
|
</select>
|
2025-01-25 23:11:05 +08:00
|
|
|
|
2025-01-19 11:30:15 +08:00
|
|
|
<select id="searchFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
|
2025-02-06 13:19:24 +08:00
|
|
|
SELECT t.*,a.`name` AS 'areaName',true AS 'followed',u.`name` AS 'createBy'
|
2025-01-19 11:30:15 +08:00
|
|
|
FROM ticket t
|
2025-02-06 13:19:24 +08:00
|
|
|
LEFT JOIN app_user u ON t.user_id=u.id
|
|
|
|
|
LEFT JOIN app_area a ON u.area_id=a.id
|
2025-01-19 11:30:15 +08:00
|
|
|
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id
|
|
|
|
|
WHERE tf.user_id=#{userId}
|
|
|
|
|
<include refid="searchWhereCondition"/>
|
|
|
|
|
</select>
|
2025-01-25 23:11:05 +08:00
|
|
|
|
2025-01-19 11:30:15 +08:00
|
|
|
<select id="searchArea" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
|
2025-02-06 13:19:24 +08:00
|
|
|
SELECT t.*,a.`name` AS 'areaName',u.`name` AS 'createBy'
|
2025-01-19 11:30:15 +08:00
|
|
|
FROM ticket t
|
2025-02-06 13:19:24 +08:00
|
|
|
LEFT JOIN app_user u ON t.user_id=u.id
|
|
|
|
|
LEFT JOIN app_area a ON u.area_id=a.id
|
2025-02-03 16:01:20 +08:00
|
|
|
WHERE u.company_id IN
|
|
|
|
|
<foreach collection="companyIds" item="companyId" open="(" separator="," close=")">
|
|
|
|
|
#{companyId}
|
|
|
|
|
</foreach>
|
2025-01-19 11:30:15 +08:00
|
|
|
<include refid="searchWhereCondition"/>
|
|
|
|
|
</select>
|
2025-01-25 23:11:05 +08:00
|
|
|
|
2025-02-05 13:14:52 +08:00
|
|
|
<select id="searchFromAdmin" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
|
|
|
|
|
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,a.`name` AS 'areaName'
|
|
|
|
|
,c.agency_company_name AS 'companyName',u.`name` AS 'createUserName',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
|
|
|
|
|
,t.create_time AS 'createTime',t.handle,t.solve_time AS 'solveTime',di.name AS 'warrantyStatusDesc'
|
2025-01-25 23:11:05 +08:00
|
|
|
FROM ticket t
|
|
|
|
|
LEFT JOIN app_user u ON t.user_id=u.id
|
2025-01-27 22:34:35 +08:00
|
|
|
LEFT JOIN t_base_customer c ON u.company_id=c.id
|
2025-01-25 23:11:05 +08:00
|
|
|
LEFT JOIN app_area a ON u.area_id=a.id
|
2025-02-05 13:14:52 +08:00
|
|
|
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1
|
|
|
|
|
LEFT JOIN dictionary_item di ON d.warranty_state=di.id
|
2025-01-25 23:11:05 +08:00
|
|
|
<include refid="adminSearchWhereCondition"/>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="completeTicket">
|
|
|
|
|
UPDATE ticket
|
|
|
|
|
SET state=2,update_time=NOW()
|
|
|
|
|
WHERE state=1 AND FIND_IN_SET(#{userId},handle)>0 AND id IN
|
|
|
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="closeTicket">
|
|
|
|
|
UPDATE ticket
|
|
|
|
|
SET state=3,update_time=NOW()
|
|
|
|
|
WHERE state=2 AND id IN
|
|
|
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="searchAllFromAdmin" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
|
2025-02-05 13:14:52 +08:00
|
|
|
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,a.`name` AS 'areaName'
|
|
|
|
|
,c.agency_company_name AS 'companyName',u.`name` AS 'createUserName',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
|
|
|
|
|
,t.create_time AS 'createTime',t.handle,t.solve_time AS 'solveTime',di.name AS 'warrantyStatusDesc'
|
2025-01-25 23:11:05 +08:00
|
|
|
FROM ticket t
|
|
|
|
|
LEFT JOIN app_user u ON t.user_id=u.id
|
2025-01-27 22:34:35 +08:00
|
|
|
LEFT JOIN t_base_customer c ON u.company_id=c.id
|
2025-01-25 23:11:05 +08:00
|
|
|
LEFT JOIN app_area a ON u.area_id=a.id
|
2025-02-05 13:14:52 +08:00
|
|
|
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1
|
|
|
|
|
LEFT JOIN dictionary_item di ON d.warranty_state=di.id
|
2025-01-25 23:11:05 +08:00
|
|
|
<include refid="adminSearchWhereCondition"/>
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-02-05 13:14:52 +08:00
|
|
|
<select id="searchFromAdminAndFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
|
|
|
|
|
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,a.`name` AS 'areaName'
|
|
|
|
|
,c.agency_company_name AS 'companyName',u.`name` AS 'createUserName',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
|
|
|
|
|
,t.create_time AS 'createTime',t.handle,t.solve_time AS 'solveTime',di.name AS 'warrantyStatusDesc'
|
2025-01-25 23:11:05 +08:00
|
|
|
FROM ticket t
|
|
|
|
|
LEFT JOIN app_user u ON t.user_id=u.id
|
2025-01-27 22:34:35 +08:00
|
|
|
LEFT JOIN t_base_customer c ON u.company_id=c.id
|
2025-01-25 23:11:05 +08:00
|
|
|
LEFT JOIN app_area a ON u.area_id=a.id
|
|
|
|
|
INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId}
|
2025-02-05 13:14:52 +08:00
|
|
|
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1
|
|
|
|
|
LEFT JOIN dictionary_item di ON d.warranty_state=di.id
|
2025-01-25 23:11:05 +08:00
|
|
|
<include refid="adminSearchWhereCondition"/>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="searchAllFromAdminAndFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
|
2025-02-05 13:14:52 +08:00
|
|
|
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,a.`name` AS 'areaName'
|
|
|
|
|
,c.agency_company_name AS 'companyName',u.`name` AS 'createUserName',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
|
|
|
|
|
,t.create_time AS 'createTime',t.handle,t.solve_time AS 'solveTime',di.name AS 'warrantyStatusDesc'
|
2025-01-25 23:11:05 +08:00
|
|
|
FROM ticket t
|
|
|
|
|
LEFT JOIN app_user u ON t.user_id=u.id
|
2025-01-27 22:34:35 +08:00
|
|
|
LEFT JOIN t_base_customer c ON u.company_id=c.id
|
2025-01-25 23:11:05 +08:00
|
|
|
LEFT JOIN app_area a ON u.area_id=a.id
|
|
|
|
|
INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId}
|
2025-02-05 13:14:52 +08:00
|
|
|
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1
|
|
|
|
|
LEFT JOIN dictionary_item di ON d.warranty_state=di.id
|
2025-01-25 23:11:05 +08:00
|
|
|
<include refid="adminSearchWhereCondition"/>
|
|
|
|
|
</select>
|
2025-01-19 11:30:15 +08:00
|
|
|
</mapper>
|