Authored by jack.xue

fix bean setter getter

@@ -11,6 +11,7 @@ import com.monitor.model.response.BaseResponse; @@ -11,6 +11,7 @@ import com.monitor.model.response.BaseResponse;
11 import org.apache.commons.lang.StringUtils; 11 import org.apache.commons.lang.StringUtils;
12 import org.slf4j.Logger; 12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.BeanUtils;
14 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.web.bind.annotation.*; 16 import org.springframework.web.bind.annotation.*;
16 17
@@ -167,22 +168,12 @@ public class MObjectInfoCtrl { @@ -167,22 +168,12 @@ public class MObjectInfoCtrl {
167 168
168 MObjectModel model = new MObjectModel(); 169 MObjectModel model = new MObjectModel();
169 170
170 - model.setMoId(mObjectInfo.getMoId());  
171 -  
172 - model.setMoName(mObjectInfo.getMoName());  
173 -  
174 - model.setMoHostIp(mObjectInfo.getMoHostIp());  
175 -  
176 - model.setMoTypeId(mObjectInfo.getMoTypeId()); 171 + BeanUtils.copyProperties(mObjectInfo,model);
177 172
178 model.setMoTypeName(typeInfoService.queryTypeInfo(mObjectInfo.getMoTypeId()).getTypeName()); 173 model.setMoTypeName(typeInfoService.queryTypeInfo(mObjectInfo.getMoTypeId()).getTypeName());
179 174
180 model.setMoStatus("normal"); 175 model.setMoStatus("normal");
181 176
182 - model.setMoTags(mObjectInfo.getMoTags());  
183 -  
184 - model.setMoUrl(mObjectInfo.getMoUrl());  
185 -  
186 modelList.add(model); 177 modelList.add(model);
187 178
188 } 179 }
@@ -211,15 +202,7 @@ public class MObjectInfoCtrl { @@ -211,15 +202,7 @@ public class MObjectInfoCtrl {
211 202
212 MObjectInfo info = new MObjectInfo(); 203 MObjectInfo info = new MObjectInfo();
213 204
214 - info.setMoName(request.getMoName());  
215 -  
216 - info.setMoUrl(request.getMoUrl());  
217 -  
218 - info.setMoTypeId(request.getMoTypeId());  
219 -  
220 - info.setMoHostIp(request.getMoHostIp());  
221 -  
222 - info.setMoTags(request.getMoTags()); 205 + BeanUtils.copyProperties(request,info);
223 206
224 mobjectService.addMObjectInfo(info); 207 mobjectService.addMObjectInfo(info);
225 } 208 }
@@ -280,17 +263,7 @@ public class MObjectInfoCtrl { @@ -280,17 +263,7 @@ public class MObjectInfoCtrl {
280 263
281 MObjectInfo info = new MObjectInfo(); 264 MObjectInfo info = new MObjectInfo();
282 265
283 - info.setMoId(request.getMoId());  
284 -  
285 - info.setMoTags(request.getMoTags());  
286 -  
287 - info.setMoTypeId(request.getMoTypeId());  
288 -  
289 - info.setMoHostIp(request.getMoHostIp());  
290 -  
291 - info.setMoUrl(request.getMoUrl());  
292 -  
293 - info.setMoName(request.getMoName()); 266 + BeanUtils.copyProperties(request,info);
294 267
295 mobjectService.updateMObjectInfo(info); 268 mobjectService.updateMObjectInfo(info);
296 } 269 }
@@ -314,4 +287,5 @@ public class MObjectInfoCtrl { @@ -314,4 +287,5 @@ public class MObjectInfoCtrl {
314 } 287 }
315 return true; 288 return true;
316 } 289 }
  290 +
317 } 291 }