Authored by mlge

主机管理---标签 单选更改为 多选

@@ -3,6 +3,8 @@ package com.monitor.model.request; @@ -3,6 +3,8 @@ package com.monitor.model.request;
3 import com.monitor.model.page.PageRequest; 3 import com.monitor.model.page.PageRequest;
4 import lombok.Data; 4 import lombok.Data;
5 5
  6 +import java.util.ArrayList;
  7 +
6 /** 8 /**
7 * Created by yoho on 2016/6/14. 9 * Created by yoho on 2016/6/14.
8 */ 10 */
@@ -19,4 +21,6 @@ public class HostInfoReq extends PageRequest { @@ -19,4 +21,6 @@ public class HostInfoReq extends PageRequest {
19 21
20 private String tags; 22 private String tags;
21 23
  24 + private ArrayList<String> tagsList;
  25 +
22 } 26 }
@@ -141,8 +141,11 @@ @@ -141,8 +141,11 @@
141 <if test="params.hostIp != null &amp;&amp; params.hostIp != ''" > 141 <if test="params.hostIp != null &amp;&amp; params.hostIp != ''" >
142 and a.host_ip = #{params.hostIp} 142 and a.host_ip = #{params.hostIp}
143 </if> 143 </if>
144 - <if test="params.tags != null &amp;&amp; params.tags != ''" >  
145 - and instr(a.tags, #{params.tags}) &gt; 0 144 + <if test="params.tagsList != null &amp;&amp; params.tagsList != ''" >
  145 + and
  146 + <foreach collection="params.tagsList" index="index" item="item" separator="and">
  147 + instr(a.tags, #{item}) &gt; 0
  148 + </foreach>
146 </if> 149 </if>
147 </select> 150 </select>
148 151
@@ -161,9 +164,13 @@ @@ -161,9 +164,13 @@
161 <if test="params.hostIp != null &amp;&amp; params.hostIp != ''" > 164 <if test="params.hostIp != null &amp;&amp; params.hostIp != ''" >
162 and a.host_ip = #{params.hostIp} 165 and a.host_ip = #{params.hostIp}
163 </if> 166 </if>
164 - <if test="params.tags != null &amp;&amp; params.tags != ''" >  
165 - and instr(a.tags, #{params.tags}) &gt; 0 167 + <if test="params.tagsList != null &amp;&amp; params.tagsList != ''" >
  168 + and
  169 + <foreach collection="params.tagsList" index="index" item="item" separator="and">
  170 + instr(a.tags, #{item}) &gt; 0
  171 + </foreach>
166 </if> 172 </if>
  173 +
167 order by a.create_time desc 174 order by a.create_time desc
168 limit #{startIndex},#{pageSize} 175 limit #{startIndex},#{pageSize}
169 </select> 176 </select>