51 lines
2.1 KiB
XML
51 lines
2.1 KiB
XML
|
|
<?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">
|
||
|
|
<if test="request.title!=''">
|
||
|
|
AND t.title LIKE CONCAT('%', #{request.title}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="request.deviceNo!=''">
|
||
|
|
AND t.device_no LIKE CONCAT('%', #{request.deviceNo}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="request.component!=''">
|
||
|
|
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>
|
||
|
|
<select id="searchMy" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
|
||
|
|
SELECT t.*,a.`name`
|
||
|
|
FROM ticket t
|
||
|
|
LEFT JOIN app_user u ON t.user_id=u.id AND u.state=1
|
||
|
|
LEFT JOIN app_area a ON u.area_id=a.id AND a.`enable`=1
|
||
|
|
WHERE t.user_id=#{userId}
|
||
|
|
<include refid="searchWhereCondition"/>
|
||
|
|
</select>
|
||
|
|
<select id="searchFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
|
||
|
|
SELECT t.*,a.`name`
|
||
|
|
FROM ticket t
|
||
|
|
LEFT JOIN app_user u ON t.user_id=u.id AND u.state=1
|
||
|
|
LEFT JOIN app_area a ON u.area_id=a.id AND a.`enable`=1
|
||
|
|
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id
|
||
|
|
WHERE tf.user_id=#{userId}
|
||
|
|
<include refid="searchWhereCondition"/>
|
||
|
|
</select>
|
||
|
|
<select id="searchArea" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
|
||
|
|
SELECT t.*,a.`name`
|
||
|
|
FROM ticket t
|
||
|
|
LEFT JOIN app_user u ON t.user_id=u.id AND u.state=1
|
||
|
|
LEFT JOIN app_area a ON u.area_id=a.id AND a.`enable`=1
|
||
|
|
WHERE u.company_id=#{companyId}
|
||
|
|
<include refid="searchWhereCondition"/>
|
||
|
|
</select>
|
||
|
|
</mapper>
|