Commit dd774514 by levphon

车辆监控搜索条件空判断

1 parent 880627c2
...@@ -126,6 +126,7 @@ ...@@ -126,6 +126,7 @@
left join t_device td on tvd.sn = td.sn left join t_device td on tvd.sn = td.sn
where tv.del_flag = 0 and tvd.del_flag = 0 where tv.del_flag = 0 and tvd.del_flag = 0
and tvd.bind_status = 1 and tvd.bind_status = 1
<if test="term != null and term != ''">
<choose> <choose>
<when test="termType == 1"> <when test="termType == 1">
and tvd.sn like concat('%',#{term},'%') and tvd.sn like concat('%',#{term},'%')
...@@ -134,6 +135,7 @@ ...@@ -134,6 +135,7 @@
and tv.vin like concat('%',#{term},'%') and tv.vin like concat('%',#{term},'%')
</when> </when>
</choose> </choose>
</if>
<if test="shopId != null"> <if test="shopId != null">
and tv.created_by = #{shopId} and tv.created_by = #{shopId}
</if> </if>
...@@ -275,6 +277,7 @@ ...@@ -275,6 +277,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="term != null and term != ''">
<choose> <choose>
<when test="termType == 1"> <when test="termType == 1">
and tvd.sn like concat('%',#{term},'%') and tvd.sn like concat('%',#{term},'%')
...@@ -286,6 +289,7 @@ ...@@ -286,6 +289,7 @@
and tv.owner_name like concat('%',#{term},'%') and tv.owner_name like concat('%',#{term},'%')
</when> </when>
</choose> </choose>
</if>
group by tv.id group by tv.id
order by tv.id desc order by tv.id desc
</select> </select>
...@@ -311,6 +315,7 @@ ...@@ -311,6 +315,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="term != null and term != ''">
<choose> <choose>
<when test="termType == 1"> <when test="termType == 1">
and tvd.sn like concat('%',#{term},'%') and tvd.sn like concat('%',#{term},'%')
...@@ -322,6 +327,7 @@ ...@@ -322,6 +327,7 @@
and tv.owner_name like concat('%',#{term},'%') and tv.owner_name like concat('%',#{term},'%')
</when> </when>
</choose> </choose>
</if>
order by tv.id desc order by tv.id desc
<if test="threshold != null and threshold gt 0"> <if test="threshold != null and threshold gt 0">
limit #{threshold} limit #{threshold}
...@@ -347,6 +353,7 @@ ...@@ -347,6 +353,7 @@
<foreach collection="userIds" separator="," open="(" close=")" item="item"> <foreach collection="userIds" separator="," open="(" close=")" item="item">
#{item} #{item}
</foreach> </foreach>
<if test="term != null and term != ''">
<choose> <choose>
<when test="termType == 1"> <when test="termType == 1">
and tvd.sn like concat('%',#{term},'%') and tvd.sn like concat('%',#{term},'%')
...@@ -358,6 +365,7 @@ ...@@ -358,6 +365,7 @@
and tv.owner_name like concat('%',#{term},'%') and tv.owner_name like concat('%',#{term},'%')
</when> </when>
</choose> </choose>
</if>
order by tv.id desc order by tv.id desc
<if test="threshold != null and threshold gt 0"> <if test="threshold != null and threshold gt 0">
limit #{threshold} limit #{threshold}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!