Authored by simba

update

... ... @@ -10,7 +10,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
... ... @@ -27,10 +29,10 @@ public class HostInfoCtrl {
@Autowired
IHostInfoService hostInfoService;
@RequestMapping("/getMechineInfos")
@RequestMapping("/getHostInfos")
@ResponseBody
public Response<PageResponse<HostInfo>> getHostInfos(HostInfoReq req) throws Exception {
log.info("getMechineInfos with param is {}", req);
log.info("getHostInfos with param is {}", req);
// 查询列表
PageResponse<HostInfo> responseBO = hostInfoService.getHostInfos(req);
if (responseBO == null || CollectionUtils.isEmpty(responseBO.getRows())) {
... ... @@ -41,29 +43,29 @@ public class HostInfoCtrl {
response.setRows(responseBO.getRows());
response.setPageSize(responseBO.getPageSize());
response.setTotal(responseBO.getTotal());
log.info("getMechineInfos success and total={}", response.getTotal());
log.info("getHostInfos success and total={}", response.getTotal());
return new Response<PageResponse<HostInfo>>(response);
}
@RequestMapping("/saveMechineInfo")
@RequestMapping("/saveHostInfo")
@ResponseBody
public Response<Integer> saveMechineInfo(String req) throws Exception {
public Response<Integer> saveHostInfo(@RequestBody HostInfo req) throws Exception {
log.info("saveMechineInfo with param is {}", req);
return hostInfoService.saveHostInfo(req);
return hostInfoService.saveHostInfo(null);
}
@RequestMapping("/delMechineInfo")
@RequestMapping("/delHostInfo")
@ResponseBody
public Response<Integer> delMechineInfo(int id) throws Exception {
public Response<Integer> delHostInfo(@RequestParam(value = "id", required = true) Integer id ) throws Exception {
log.info("delMechineInfo with param is {}", id);
return hostInfoService.delHostInfoById(id);
}
@RequestMapping("/getMechineInfoById")
@RequestMapping("/getHostInfoById")
@ResponseBody
public Response<HostInfo> getMechineInfoById(int id) throws Exception {
log.info("getMechineInfoById with param is {}", id);
public Response<HostInfo> getHostInfoById(int id) throws Exception {
log.info("getHostInfoById with param is {}", id);
return hostInfoService.getHostInfoById(id);
}
... ...
package com.monitor.model.request;
import com.monitor.model.page.PageRequest;
import lombok.Data;
/**
* Created by yoho on 2016/6/14.
*/
@Data
public class HostInfoReq extends PageRequest {
private String alias;
... ... @@ -15,35 +17,4 @@ public class HostInfoReq extends PageRequest {
private String tags;
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getHostIp() {
return hostIp;
}
public void setHostIp(String hostIp) {
this.hostIp = hostIp;
}
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
}
... ...
... ... @@ -22,4 +22,6 @@ public class HostInfo implements Serializable {
private String updateTime;
}
\ No newline at end of file
... ...