Authored by FengRuwei

查询所有javaapp

... ... @@ -423,6 +423,7 @@ public class MObjectInfoCtrl {
/**
* 获取所有java app服务
*
* @return
*/
@RequestMapping(value = "/javaapi")
... ... @@ -445,18 +446,13 @@ public class MObjectInfoCtrl {
if (null == allTypeInfo) {
return response;
}
String ids="";
for(TypeInfo type:allTypeInfo){
if(ids.equals(""))
ids+=type.getTypeId();
else
ids+=","+type.getTypeId();
ArrayList<Integer> ids = new ArrayList<>();
for (TypeInfo type : allTypeInfo) {
ids.add(type.getTypeId());
}
MObjectInfoReq req=new MObjectInfoReq();
req.setIsType(1);
req.setTypeIds(ids);
return queryMObjectByType(req);
List<MObjectInfo> javaApps = mobjectService.queryMObjectsInfoByTypes(ids);
response.setData(javaApps);
} catch (Exception e) {
DEBUG.error("Failed to query all typeInfo, error: {}", e);
... ...
... ... @@ -25,4 +25,6 @@ public interface IMObjectInfoService {
List<MObjectInfo> queryMObjectsInfoByTypes(List<Integer> typeIds);
}
... ...
... ... @@ -103,4 +103,9 @@ public class MObjectInfoServiceImpl implements IMObjectInfoService {
public void updateMObjectInfo(MObjectInfo info) {
mObjectInfoMapper.updateMoInfo(info);
}
@Override
public List<MObjectInfo> queryMObjectsInfoByTypes(List<Integer> typeIds) {
return mObjectInfoMapper.selectMObjectsInfoByTypes(typeIds);
}
}
... ...
... ... @@ -19,7 +19,7 @@ public class ScheduledPlan {
JavaApiClient javaApiClient;
@Scheduled(fixedRate=10000)
@Scheduled(fixedRate=10000000)
public void run() {
log.info("task start...");
... ...
... ... @@ -16,6 +16,11 @@ public interface MObjectInfoMapper {
List<MObjectInfo> getAllMosInfo();
//TODO xml map * -> fields
List<MObjectInfo> selectMObjectsInfoByTypes(List<Integer> typeIds);
/* List<MObjectInfo> getTypeMosInfo(int typeId);
List<MObjectInfo> getHostMosInfo(int hostId);*/
... ...
... ... @@ -38,4 +38,17 @@
</update>
<select id="selectMObjectsInfoByTypes" resultType="com.model.MObjectInfo" resultMap="mobjectInfoMapper" useCache="true">
SELECT * FROM mobject_info
where type_id in
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
ORDER BY id asc
</select>
</mapper>
\ No newline at end of file
... ...