Commit dd774514 by levphon

车辆监控搜索条件空判断

1 parent 880627c2
...@@ -126,14 +126,16 @@ ...@@ -126,14 +126,16 @@
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
<choose> <if test="term != null and term != ''">
<when test="termType == 1"> <choose>
and tvd.sn like concat('%',#{term},'%') <when test="termType == 1">
</when> and tvd.sn like concat('%',#{term},'%')
<when test="termType == 2"> </when>
and tv.vin like concat('%',#{term},'%') <when test="termType == 2">
</when> and tv.vin like concat('%',#{term},'%')
</choose> </when>
</choose>
</if>
<if test="shopId != null"> <if test="shopId != null">
and tv.created_by = #{shopId} and tv.created_by = #{shopId}
</if> </if>
...@@ -275,17 +277,19 @@ ...@@ -275,17 +277,19 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<choose> <if test="term != null and term != ''">
<when test="termType == 1"> <choose>
and tvd.sn like concat('%',#{term},'%') <when test="termType == 1">
</when> and tvd.sn like concat('%',#{term},'%')
<when test="termType == 2"> </when>
and tv.vin like concat('%',#{term},'%') <when test="termType == 2">
</when> and tv.vin like concat('%',#{term},'%')
<when test="termType == 3"> </when>
and tv.owner_name like concat('%',#{term},'%') <when test="termType == 3">
</when> and tv.owner_name like concat('%',#{term},'%')
</choose> </when>
</choose>
</if>
group by tv.id group by tv.id
order by tv.id desc order by tv.id desc
</select> </select>
...@@ -311,17 +315,19 @@ ...@@ -311,17 +315,19 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<choose> <if test="term != null and term != ''">
<when test="termType == 1"> <choose>
and tvd.sn like concat('%',#{term},'%') <when test="termType == 1">
</when> and tvd.sn like concat('%',#{term},'%')
<when test="termType == 2"> </when>
and tv.vin like concat('%',#{term},'%') <when test="termType == 2">
</when> and tv.vin like concat('%',#{term},'%')
<when test="termType == 3"> </when>
and tv.owner_name like concat('%',#{term},'%') <when test="termType == 3">
</when> and tv.owner_name like concat('%',#{term},'%')
</choose> </when>
</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,17 +353,19 @@ ...@@ -347,17 +353,19 @@
<foreach collection="userIds" separator="," open="(" close=")" item="item"> <foreach collection="userIds" separator="," open="(" close=")" item="item">
#{item} #{item}
</foreach> </foreach>
<choose> <if test="term != null and term != ''">
<when test="termType == 1"> <choose>
and tvd.sn like concat('%',#{term},'%') <when test="termType == 1">
</when> and tvd.sn like concat('%',#{term},'%')
<when test="termType == 2"> </when>
and tv.vin like concat('%',#{term},'%') <when test="termType == 2">
</when> and tv.vin like concat('%',#{term},'%')
<when test="termType == 3"> </when>
and tv.owner_name like concat('%',#{term},'%') <when test="termType == 3">
</when> and tv.owner_name like concat('%',#{term},'%')
</choose> </when>
</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!