Authored by qinchao

修改bug

... ... @@ -24,10 +24,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
... ... @@ -67,6 +64,14 @@ public class HostInfoCtrl {
public BaseResponse<PageResponse<HostInfo>> getHostInfos(@RequestBody HostInfoReq req) throws Exception {
log.info("getHostInfos with param is {}", req);
if(StringUtils.isNotBlank(req.getHostIp())){
String[] arrayIps=req.getHostIp().split(",");
if(arrayIps.length>1){
req.setHostIp("");
List<String> ipList=Arrays.asList(arrayIps);
req.setHostIpList(ipList);
}
}
// 查询列表
PageResponse<HostInfo> responseBO = hostInfoService.getHostInfos(req);
if (responseBO == null || CollectionUtils.isEmpty(responseBO.getRows())) {
... ...
... ... @@ -4,6 +4,7 @@ import com.monitor.model.page.PageRequest;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* Created by yoho on 2016/6/14.
... ... @@ -15,6 +16,7 @@ public class HostInfoReq extends PageRequest {
private String hostIp;
// 1 只显示标签为空,0 只显示标签不为空 ,“” 全部显示
private String onlyShowTagsIsNull;
private int cloudType;
... ... @@ -24,5 +26,6 @@ public class HostInfoReq extends PageRequest {
private String tags;
private ArrayList<String> tagsList;
private List<String> hostIpList;
}
... ...
... ... @@ -141,17 +141,28 @@
<if test="params.hostIp != null &amp;&amp; params.hostIp != ''" >
and a.host_ip = #{params.hostIp}
</if>
<if test="params.hostIpList != null &amp;&amp; params.hostIpList.size()>0" >
and a.host_ip in
<foreach open="(" close=")" item="item" index="index" collection="params.hostIpList" separator=",">
#{item}
</foreach>
</if>
<choose>
<when test="params.onlyShowTagsIsNull != null &amp;&amp; params.onlyShowTagsIsNull != '' ">
and ( ISNULL(a.tags) or trim(a.tags) = "")
</when>
<otherwise>
<if test="params.tagsList != null &amp;&amp; params.tagsList.size()>0" >
and
<foreach collection="params.tagsList" index="index" item="item" separator="and">
instr(a.tags, concat(#{item},',')) &gt; 0
</foreach>
</if>
<when test='params.onlyShowTagsIsNull != null &amp;&amp; params.onlyShowTagsIsNull == "1" '>
and ( ISNULL(a.tags) or trim(a.tags) = "")
</when>
<otherwise>
<if test='params.onlyShowTagsIsNull != null &amp;&amp; params.onlyShowTagsIsNull == "0" '>
and (a.tags is not null and a.tags !='')
</if>
<if test="params.tagsList != null &amp;&amp; params.tagsList.size()>0" >
and
<foreach collection="params.tagsList" index="index" item="item" separator="and">
instr(a.tags, concat(#{item},',')) &gt; 0
</foreach>
</if>
</otherwise>
</choose>
</select>
... ... @@ -171,12 +182,22 @@
<if test="params.hostIp != null &amp;&amp; params.hostIp != ''" >
and a.host_ip = #{params.hostIp}
</if>
<if test="params.hostIpList != null &amp;&amp; params.hostIpList.size()>0" >
and a.host_ip in
<foreach open="(" close=")" item="item" index="index" collection="params.hostIpList" separator=",">
#{item}
</foreach>
</if>
<choose>
<when test="params.onlyShowTagsIsNull != null &amp;&amp; params.onlyShowTagsIsNull != '' ">
<when test='params.onlyShowTagsIsNull != null &amp;&amp; params.onlyShowTagsIsNull == "1" '>
and ( ISNULL(a.tags) or trim(a.tags) = "")
</when>
<otherwise>
<if test='params.onlyShowTagsIsNull != null &amp;&amp; params.onlyShowTagsIsNull == "0" '>
and (a.tags is not null and a.tags !='')
</if>
<if test="params.tagsList != null &amp;&amp; params.tagsList.size()>0" >
and
<foreach collection="params.tagsList" index="index" item="item" separator="and">
... ...