Authored by simba

updateMerge branch 'master' of http://git.yoho.cn/ops/monitor-service

Showing 25 changed files with 580 additions and 66 deletions
package com.monitor.cmdb.ctrl;
import com.model.HostInfo;
import com.model.JavaApiInfo;
import com.monitor.cmdb.service.IJavaApiInfoService;
import com.monitor.cmdb.service.impl.JavaApiInfoService;
import com.monitor.model.request.JavaApiInfoReq;
import com.monitor.model.response.BaseResponse;
import com.monitor.model.response.PageResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by fruwei on 2016/6/20.
*/
@RestController
@RequestMapping(value = "/javaApi")
public class JavaApiInfoCtrl {
Logger log = LoggerFactory.getLogger(JavaApiInfoCtrl.class);
@Autowired
private IJavaApiInfoService javaApiInfoService;
@RequestMapping("/query")
@ResponseBody
public BaseResponse<PageResponse<JavaApiInfo>> getJavaApiInfos(@RequestBody JavaApiInfoReq req) throws Exception {
log.info("getJavaApiInfos with param is {}", req);
// 查询列表
PageResponse<JavaApiInfo> responseBO = javaApiInfoService.getJavaApiInfos(req);
if (responseBO == null || CollectionUtils.isEmpty(responseBO.getRows())) {
return new BaseResponse<PageResponse<JavaApiInfo>>();
}
PageResponse<JavaApiInfo> response = new PageResponse<JavaApiInfo>();
response.setCurrentPage(responseBO.getCurrentPage());
response.setRows(responseBO.getRows());
response.setPageSize(responseBO.getPageSize());
response.setTotal(responseBO.getTotal());
log.info("getJavaApiInfos success and total={}", response.getTotal());
return new BaseResponse<PageResponse<JavaApiInfo>>(response);
}
@RequestMapping("/save")
@ResponseBody
public BaseResponse<Integer> saveJavaApiInfo(@RequestBody JavaApiInfo req) throws Exception {
log.info("saveMechineInfo with param is {}", req);
return javaApiInfoService.saveJavaApiInfo(req);
}
@RequestMapping("/del")
@ResponseBody
public BaseResponse<Integer> delJavaApiInfo(@RequestParam(value = "id", required = true) Integer id) throws Exception {
log.info("delMechineInfo with param is {}", id);
return javaApiInfoService.delJavaApiInfo(id);
}
}
... ...
package com.monitor.cmdb.ctrl;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.model.HostGroup;
import com.model.HostInfo;
import com.model.MObjectInfo;
import com.model.TypeInfo;
import com.monitor.cmdb.service.IHostGroupService;
import com.monitor.cmdb.service.IHostInfoService;
import com.monitor.cmdb.service.IMObjectInfoService;
... ... @@ -47,10 +49,21 @@ public class MObjectInfoCtrl {
ITypeInfoService typeInfoService;
@RequestMapping(value = "/queryHost", method = RequestMethod.POST)
public BaseResponse queryMObject(@RequestBody MObjectHostInfoReq request) {
public BaseResponse queryMObjectHost(@RequestBody MObjectHostInfoReq request) {
DEBUG.debug("Query mobject host info by request: {}", request.getSelectIp());
DEBUG.debug("Query mobject host info by request: {}", request);
BaseResponse response = null;
if (0 == request.getIsGroup()) {
response = queryMHostInfoByIp(request);
} else {
response = queryMHostInfoByGroup(request);
}
return response;
}
private BaseResponse queryMHostInfoByIp(MObjectHostInfoReq request) {
BaseResponse response = new BaseResponse();
MObjectHostInfoModel model = new MObjectHostInfoModel();
... ... @@ -72,10 +85,11 @@ public class MObjectInfoCtrl {
selectIp = info.getHostIp();
selectGroup = info.getGroupName();
selectGroupId = info.getGroupId();
selectGroup = groupService.getHostGroupById(selectGroupId).getData().getGroupName();
} else {
if (sourceGroupList.size() > 0) {
selectGroup = sourceGroupList.get(0).getGroupName();
... ... @@ -111,6 +125,50 @@ public class MObjectInfoCtrl {
}
private BaseResponse queryMHostInfoByGroup(MObjectHostInfoReq request) {
BaseResponse response = new BaseResponse();
MObjectHostInfoModel model = new MObjectHostInfoModel();
List<String> groupList = new ArrayList<>();
List<String> ipList = new ArrayList<>();
String selectIp = "";
String selectGroup = "";
int selectGroupId = 0;
List<HostGroup> sourceGroupList = groupService.getListGroups();
for (HostGroup group : sourceGroupList) {
if (StringUtils.equals(group.getGroupName(), request.getSelectGroup())) {
selectGroupId = group.getId();
selectGroup = group.getGroupName();
}
}
for (HostGroup group : sourceGroupList) {
groupList.add(group.getGroupName());
}
if (StringUtils.isNotBlank(selectGroup)) {
for (HostInfo info : hostInfoService.getHostInfosByGroupId(selectGroupId)) {
ipList.add(info.getHostIp());
}
}
selectIp = ipList.get(0);
model.setSelectIp(selectIp);
model.setSelectGroup(selectGroup);
model.setIpList(ipList);
model.setGroupList(groupList);
response.setData(model);
return response;
}
@RequestMapping(value = "/query", method = RequestMethod.POST)
public BaseResponse queryMObject(@RequestBody MObjectInfoReq request) {
... ... @@ -362,4 +420,53 @@ public class MObjectInfoCtrl {
return true;
}
/**
* 获取所有java app服务
* @return
*/
@RequestMapping(value = "/javaapi")
@ResponseBody
public BaseResponse queryJavaApiMobject() {
List<TypeInfo> allTypeInfo = null;
BaseResponse response = new BaseResponse();
try {
TypeInfo typeInfo = typeInfoService.queryTypeInfoByName(TypeInfoCtrl.TYPE_JAVA_APP);
if (typeInfo == null) {
return response;
}
allTypeInfo = typeInfoService.queryChildTypesInfo(typeInfo.getTypeId());
if (null == allTypeInfo) {
return response;
}
String ids="";
for(TypeInfo type:allTypeInfo){
if(ids.equals(""))
ids+=type.getTypeId();
else
ids+=","+type.getTypeId();
}
MObjectInfoReq req=new MObjectInfoReq();
req.setIsType(1);
req.setTypeIds(ids);
return queryMObjectByType(req);
} catch (Exception e) {
DEBUG.error("Failed to query all typeInfo, error: {}", e);
response.setCode(400);
response.setMessage(e.getMessage());
}
return response;
}
}
... ...
... ... @@ -22,6 +22,8 @@ import java.util.List;
public class TypeInfoCtrl {
public static final Logger DEBUG = LoggerFactory.getLogger(TypeInfoCtrl.class);
public static final String TYPE_JAVA_APP = "java_app";
@Autowired
ITypeInfoService typeInfoService;
... ... @@ -72,10 +74,8 @@ public class TypeInfoCtrl {
if (null != allTypeInfo) {
for (TypeInfo info : allTypeInfo)
{
if(1==info.getTypeIsLeaf())
{
for (TypeInfo info : allTypeInfo) {
if (1 == info.getTypeIsLeaf()) {
leafTypeInfo.add(info);
}
}
... ... @@ -249,6 +249,31 @@ public class TypeInfoCtrl {
}
@RequestMapping(value = "/queryJavaApi", method = RequestMethod.GET)
public BaseResponse queryJavaApi() {
DEBUG.debug("Query all java api info...");
List<TypeInfo> allTypeInfo = null;
BaseResponse response = new BaseResponse();
try {
TypeInfo typeInfo = typeInfoService.queryTypeInfoByName(TYPE_JAVA_APP);
if (typeInfo != null) {
allTypeInfo = typeInfoService.queryChildTypesInfo(typeInfo.getTypeId());
if (null != allTypeInfo) {
response.setData(allTypeInfo);
}
}
} catch (Exception e) {
DEBUG.error("Failed to query all typeInfo, error: {}", e);
response.setCode(400);
response.setMessage(e.getMessage());
}
return response;
}
@RequestMapping(value = "/queryNode", method = RequestMethod.GET)
public BaseResponse queryNodeTypeInfo() {
... ... @@ -265,10 +290,8 @@ public class TypeInfoCtrl {
if (null != allTypeInfo) {
for (TypeInfo info : allTypeInfo)
{
if(0==info.getTypeIsLeaf())
{
for (TypeInfo info : allTypeInfo) {
if (0 == info.getTypeIsLeaf()) {
leafTypeInfo.add(info);
}
}
... ... @@ -288,5 +311,4 @@ public class TypeInfoCtrl {
}
}
... ...
package com.monitor.cmdb.service;
import com.model.JavaApiInfo;
import com.monitor.model.request.JavaApiInfoReq;
import com.monitor.model.response.BaseResponse;
import com.monitor.model.response.PageResponse;
import java.util.List;
... ... @@ -19,5 +21,5 @@ public interface IJavaApiInfoService {
public BaseResponse<Integer> delJavaApiInfo(int id);
PageResponse<JavaApiInfo> getJavaApiInfos(JavaApiInfoReq req);
}
... ...
... ... @@ -21,4 +21,6 @@ public interface ITypeInfoService {
void updateTypeInfo(TypeInfo typeInfo);
TypeInfo queryTypeInfoByName(String typeName);
}
... ...
... ... @@ -2,11 +2,17 @@ package com.monitor.cmdb.service.impl;
import com.model.JavaApiInfo;
import com.monitor.cmdb.service.IJavaApiInfoService;
import com.monitor.model.domain.PageBean;
import com.monitor.model.request.JavaApiInfoReq;
import com.monitor.model.response.BaseResponse;
import com.monitor.model.response.PageResponse;
import com.monitor.mysql.mapper.JavaApiInfoMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
... ... @@ -15,6 +21,7 @@ import java.util.List;
*/
@Service
public class JavaApiInfoService implements IJavaApiInfoService {
Logger log= LoggerFactory.getLogger(JavaApiInfoService.class);
@Autowired
private JavaApiInfoMapper javaApiInfoMapper;
@Override
... ... @@ -44,4 +51,33 @@ public class JavaApiInfoService implements IJavaApiInfoService {
return new BaseResponse<Integer>(result);
}
@Override
public PageResponse<JavaApiInfo> getJavaApiInfos(JavaApiInfoReq req) {
log.info("get api infos with param is {}", req);
// 组装分页对象
PageBean page = PageBean.initPageInfo(req.getCurrentPage(),
req.getPageSize(), req);
// 先查询符合条件的总数量
int total = javaApiInfoMapper.selectCountByCodition(page);
log.info("get api infos num is {}, with param is {}", total,
req);
// 数量为0 直接返回
if (total == 0) {
return null;
}
// 获取列表
List<JavaApiInfo> JavaApiInfo = javaApiInfoMapper.selectJavaInfosByCodition(page);
if (CollectionUtils.isEmpty(JavaApiInfo)) {
log.debug("get api infos is null with param is {}", req);
return null;
}
PageResponse<JavaApiInfo> response = new PageResponse<JavaApiInfo>();
response.setCurrentPage(req.getCurrentPage());
response.setPageSize(req.getPageSize());
response.setTotal(total);
response.setRows(JavaApiInfo);
return response;
}
}
... ...
... ... @@ -71,4 +71,9 @@ public class TypeInfoServiceImpl implements ITypeInfoService {
mTypeInfoMapper.updateTypeInfo(typeInfo);
}
@Override
public TypeInfo queryTypeInfoByName(String typeName) {
return mTypeInfoMapper.selectTypeInfoByName(typeName);
}
}
... ...
package com.monitor.common.contants;
public class InfluxDBContants {
/**
* influxdb监控数据源
*/
public static final String YOMO_MONITOR = "yoho_monitor";
public static final String YOMO_REPORT = "yoho_report";
public static final String YOHO_ORDER = "yoho_order";
public static final String YOHO_ALARM = "yoho_alarm";
/**
* influxdb 表
*/
public static final String YOMO_TB_JAVAAPI = "yoho_javaapi_statics";
}
\ No newline at end of file
... ...
package com.monitor.influxdb.mapper;
import com.alibaba.fastjson.JSONObject;
/**
* Created by fruwei on 2016/6/21.
*/
public interface IJavaApiStaticsMapper {
public void insertJavaApiStatics(String influxDBName,JSONObject statics);
}
... ...
package com.monitor.influxdb.mapper;
import com.monitor.influxdb.model.ZookeeperInfo;
/**
* Created by yoho on 2016/6/21.
*/
public interface IZookeeperMapper {
public void insert(String influxDBName,ZookeeperInfo zkInfo);
}
... ...
package com.monitor.influxdb.mapper.impl;
import com.alibaba.fastjson.JSONObject;
import com.monitor.common.contants.InfluxDBContants;
import com.monitor.influxdb.InluxDBSingle;
import com.monitor.influxdb.mapper.IJavaApiStaticsMapper;
import org.influxdb.dto.BatchPoints;
import org.influxdb.dto.Point;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by fruwei on 2016/6/21.
*/
@Component
public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
@Autowired
private InluxDBSingle inluxDBSingle;
@Override
public void insertJavaApiStatics(String influxDBName, JSONObject statics) {
BatchPoints batchPoints = BatchPoints
.database(InfluxDBContants.YOHO_ALARM).retentionPolicy("default")
.build();
Point point = Point.measurement(InfluxDBContants.YOMO_TB_JAVAAPI)
.addField("java_api_info", statics.get("javaApiInfo").toString())
.addField("mobject_info", statics.get("mobject").toString())
.addField("start", statics.getLongValue("start"))
.addField("end", statics.getLongValue("end")).build();
batchPoints.point(point);
if (influxDBName == null) {
influxDBName = inluxDBSingle.getDBNames().get(0);
}
inluxDBSingle.getInfluxDBByName(influxDBName).getInfluxDB()
.write(batchPoints);
}
}
... ...
package com.monitor.influxdb.mapper.impl;
import com.monitor.influxdb.InluxDBSingle;
import com.monitor.influxdb.mapper.IZookeeperMapper;
import com.monitor.influxdb.model.ZookeeperInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by yoho on 2016/6/21.
*/
@Component
public class ZookeeperMapper implements IZookeeperMapper{
@Autowired
private InluxDBSingle inluxDBSingle;
@Override
public void insert(String influxDBName, ZookeeperInfo zkInfo) {
}
}
... ...
package com.monitor.influxdb.model;
import lombok.Data;
/**
* Created by yoho on 2016/6/21.
*/
@Data
public class ZookeeperInfo {
private int id;
private String hostIp;
private int isLive;
}
... ...
... ... @@ -147,17 +147,32 @@ public class JavaApiClient {
//
// mObjInfoMap.add(1, mObj2);
MObjectInfo mObj2 = new MObjectInfo();
mObj2.setMoId(0);
mObj2.setMoHostIp("localhost");
mObj2.setMoTags("10080");
mObj2.setMoName("gay");
mObj2.setMoTypeId(0);
mObjInfoMap.add(0, mObj2);
int uid = 8041886;
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 1; i++) {
JavaApiInfo javaApiInfo = new JavaApiInfo();
javaApiInfo.setApiName("order.get_" + i);
javaApiInfo.setApiReqMethod(0);
javaApiInfo.setApiToggle(0);
javaApiInfo.setApiUrl("/gateway/?debug=XYZ&method=app.Shopping.listCoupon&uid=" + (uid++));
javaApiInfo.setServiceType(1);
javaApimap.put("order.get_" + i, javaApiInfo);
javaApimap.put(javaApiInfo.getApiName(), javaApiInfo);
}
JavaApiInfo javaApiInfo = new JavaApiInfo();
javaApiInfo.setApiName("frw.test");
javaApiInfo.setApiReqMethod(0);
javaApiInfo.setApiToggle(0);
javaApiInfo.setApiUrl("/gay/time/get?second=40");
javaApiInfo.setServiceType(0);
javaApimap.put(javaApiInfo.getApiName(), javaApiInfo);
}
... ...
package com.monitor.javaserver.handle.impl;
import com.alibaba.fastjson.JSONObject;
import com.monitor.influxdb.mapper.impl.JavaApiStaticsMapper;
import com.monitor.javaserver.common.JavaApiStatics;
import com.monitor.javaserver.handle.IJavaApiHadnler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by fruwei on 2016/6/20.
*/
@Component("influxDBJavaApiHandler")
public class InfluxDBJavaApiHandler implements IJavaApiHadnler{
Logger log= LoggerFactory.getLogger(InfluxDBJavaApiHandler.class);
public class InfluxDBJavaApiHandler implements IJavaApiHadnler {
Logger log = LoggerFactory.getLogger(InfluxDBJavaApiHandler.class);
@Autowired
private JavaApiStaticsMapper javaApiStaticsMapper;
@Override
public void handler(JavaApiStatics javaApiStatics) {
log.info("handle result: {}",javaApiStatics);
//TODO handle
log.info("handle result: {}", javaApiStatics);
JSONObject jsonObject = new JSONObject();
jsonObject.put("javaApiInfo", javaApiStatics.getJavaApiInfo());
jsonObject.put("mobject", javaApiStatics.getMObjectInfo());
jsonObject.put("statrt", javaApiStatics.getStartTime());
jsonObject.put("end", javaApiStatics.getEndTime());
javaApiStaticsMapper.insertJavaApiStatics(null, jsonObject);
}
... ...
... ... @@ -3,6 +3,7 @@ package com.monitor.middleware.zookeeper;
/**
* Created by yoho on 2016/6/21.
*/
@Component
public class ZookeeperMonitorTask {
}
... ...
package com.monitor.model.request;
import com.monitor.model.page.PageRequest;
import lombok.Data;
/**
* Created by fruwei on 2016/6/20.
*/
@Data
public class JavaApiInfoReq extends PageRequest {
private Integer serviceId;
private Integer serviceType;
private String apiName;
private String apiUrl;
private String apiData;
private Integer apiToggle;
private Integer apiReqMethod;
private Integer apiWarnTrigger;
}
... ...
... ... @@ -8,4 +8,8 @@ import lombok.Data;
@Data
public class MObjectHostInfoReq {
String selectIp;
String selectGroup;
int isGroup = 0;
}
... ...
... ... @@ -17,6 +17,8 @@ public class JavaApiInfo {
private Integer apiReqMethod;
private Integer apiWarnTrigger;
public Integer getServiceId() {
return serviceId;
}
... ... @@ -77,4 +79,12 @@ public class JavaApiInfo {
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
public Integer getApiWarnTrigger() {
return apiWarnTrigger;
}
public void setApiWarnTrigger(Integer apiWarnTrigger) {
this.apiWarnTrigger = apiWarnTrigger;
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@ package com.monitor.mysql.mapper;
import com.model.JavaApiInfo;
import com.monitor.model.domain.PageBean;
import java.util.List;
... ... @@ -19,4 +20,8 @@ public interface JavaApiInfoMapper {
int updateByPrimaryKey(JavaApiInfo record);
List<JavaApiInfo> selectAllApi();
int selectCountByCodition(PageBean page);
List<JavaApiInfo> selectJavaInfosByCodition(PageBean page);
}
\ No newline at end of file
... ...
... ... @@ -20,5 +20,5 @@ public interface MTypeInfoMapper {
TypeInfo getParentTypeInfo(TypeInfo childInfo);*/
TypeInfo selectTypeInfoByName(String typeName);
}
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.monitor.mysql.mapper.JavaApiInfoMapper" >
<resultMap id="BaseResultMap" type="com.model.JavaApiInfo" >
<id column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="service_type" property="serviceType" jdbcType="INTEGER" />
<result column="api_name" property="apiName" jdbcType="VARCHAR" />
<result column="api_url" property="apiUrl" jdbcType="VARCHAR" />
<result column="api_data" property="apiData" jdbcType="VARCHAR" />
<result column="api_toggle" property="apiToggle" jdbcType="INTEGER" />
<result column="api_req_method" property="apiReqMethod" jdbcType="INTEGER" />
<mapper namespace="com.monitor.mysql.mapper.JavaApiInfoMapper">
<resultMap id="BaseResultMap" type="com.model.JavaApiInfo">
<id column="service_id" property="serviceId" jdbcType="INTEGER"/>
<result column="service_type" property="serviceType" jdbcType="INTEGER"/>
<result column="api_name" property="apiName" jdbcType="VARCHAR"/>
<result column="api_url" property="apiUrl" jdbcType="VARCHAR"/>
<result column="api_data" property="apiData" jdbcType="VARCHAR"/>
<result column="api_toggle" property="apiToggle" jdbcType="INTEGER"/>
<result column="api_req_method" property="apiReqMethod" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List" >
<sql id="Base_Column_List">
service_id, service_type, api_name, api_url, api_data, api_toggle, api_req_method
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from java_api_info
where service_id = #{serviceId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from java_api_info
where service_id = #{serviceId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.model.JavaApiInfo" >
<insert id="insert" parameterType="com.model.JavaApiInfo">
insert into java_api_info (service_id, service_type, api_name,
api_url, api_data, api_toggle,
api_req_method)
... ... @@ -31,80 +31,80 @@
#{apiUrl,jdbcType=VARCHAR}, #{apiData,jdbcType=VARCHAR}, #{apiToggle,jdbcType=INTEGER},
#{apiReqMethod,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.model.JavaApiInfo" >
<insert id="insertSelective" parameterType="com.model.JavaApiInfo">
insert into java_api_info
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="serviceId != null" >
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="serviceId != null">
service_id,
</if>
<if test="serviceType != null" >
<if test="serviceType != null">
service_type,
</if>
<if test="apiName != null" >
<if test="apiName != null">
api_name,
</if>
<if test="apiUrl != null" >
<if test="apiUrl != null">
api_url,
</if>
<if test="apiData != null" >
<if test="apiData != null">
api_data,
</if>
<if test="apiToggle != null" >
<if test="apiToggle != null">
api_toggle,
</if>
<if test="apiReqMethod != null" >
<if test="apiReqMethod != null">
api_req_method,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="serviceId != null" >
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="serviceId != null">
#{serviceId,jdbcType=INTEGER},
</if>
<if test="serviceType != null" >
<if test="serviceType != null">
#{serviceType,jdbcType=INTEGER},
</if>
<if test="apiName != null" >
<if test="apiName != null">
#{apiName,jdbcType=VARCHAR},
</if>
<if test="apiUrl != null" >
<if test="apiUrl != null">
#{apiUrl,jdbcType=VARCHAR},
</if>
<if test="apiData != null" >
<if test="apiData != null">
#{apiData,jdbcType=VARCHAR},
</if>
<if test="apiToggle != null" >
<if test="apiToggle != null">
#{apiToggle,jdbcType=INTEGER},
</if>
<if test="apiReqMethod != null" >
<if test="apiReqMethod != null">
#{apiReqMethod,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.model.JavaApiInfo" >
<update id="updateByPrimaryKeySelective" parameterType="com.model.JavaApiInfo">
update java_api_info
<set >
<if test="serviceType != null" >
<set>
<if test="serviceType != null">
service_type = #{serviceType,jdbcType=INTEGER},
</if>
<if test="apiName != null" >
<if test="apiName != null">
api_name = #{apiName,jdbcType=VARCHAR},
</if>
<if test="apiUrl != null" >
<if test="apiUrl != null">
api_url = #{apiUrl,jdbcType=VARCHAR},
</if>
<if test="apiData != null" >
<if test="apiData != null">
api_data = #{apiData,jdbcType=VARCHAR},
</if>
<if test="apiToggle != null" >
<if test="apiToggle != null">
api_toggle = #{apiToggle,jdbcType=INTEGER},
</if>
<if test="apiReqMethod != null" >
<if test="apiReqMethod != null">
api_req_method = #{apiReqMethod,jdbcType=INTEGER},
</if>
</set>
where service_id = #{serviceId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.model.JavaApiInfo" >
<update id="updateByPrimaryKey" parameterType="com.model.JavaApiInfo">
update java_api_info
set service_type = #{serviceType,jdbcType=INTEGER},
api_name = #{apiName,jdbcType=VARCHAR},
... ... @@ -115,11 +115,64 @@
where service_id = #{serviceId,jdbcType=INTEGER}
</update>
<select id="selectAllApi" resultMap="BaseResultMap" >
<select id="selectAllApi" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from java_api_info
</select>
<select id="selectCountByCodition" resultType="java.lang.Integer">
select
count(1)
from java_api_info
where
1=1
<if test="params.serviceType != null">
and service_type = #{params.serviceType,jdbcType=INTEGER}
</if>
<if test="params.apiName != null">
and api_name = #{params.apiName,jdbcType=VARCHAR}
</if>
<if test="params.apiUrl != null">
and api_url = #{params.apiUrl,jdbcType=VARCHAR}
</if>
<if test="params.apiData != null">
and api_data = #{params.apiData,jdbcType=VARCHAR}
</if>
<if test="params.apiToggle != null">
and api_toggle = #{params.apiToggle,jdbcType=INTEGER}
</if>
<if test="params.apiReqMethod != null">
and api_req_method = #{params.apiReqMethod,jdbcType=INTEGER}
</if>
</select>
<select id="selectJavaInfosByCodition" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from java_api_info
where
1=1
<if test="params.serviceType != null">
and service_type = #{params.serviceType,jdbcType=INTEGER}
</if>
<if test="params.apiName != null">
and api_name = #{params.apiName,jdbcType=VARCHAR}
</if>
<if test="params.apiUrl != null">
and api_url = #{params.apiUrl,jdbcType=VARCHAR}
</if>
<if test="params.apiData != null">
and api_data = #{params.apiData,jdbcType=VARCHAR}
</if>
<if test="params.apiToggle != null">
and api_toggle = #{params.apiToggle,jdbcType=INTEGER}
</if>
<if test="params.apiReqMethod != null">
and api_req_method = #{params.apiReqMethod,jdbcType=INTEGER}
</if>
limit #{startIndex},#{pageSize}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -12,8 +12,12 @@
<id property="typeParentId" column="parent_id"></id>
</resultMap>
<sql id="Base_Column_List"> id, alias, isLeaf, parent_id </sql>
<select id="getAllTypesInfo" resultType="com.model.TypeInfo" resultMap="typeInfoMap" useCache="true">
SELECT * FROM type_info ORDER BY id asc
SELECT
<include refid="Base_Column_List"/>
FROM type_info ORDER BY id asc
</select>
<!-- <select id="getChildTypesInfo" parameterType="int" resultType="com.model.TypeInfo" resultMap="typeInfoMap">
... ... @@ -37,4 +41,11 @@
WHERE id=#{typeId}
</update>
<select id="selectTypeInfoByName" resultMap="typeInfoMap" resultType="com.model.TypeInfo">
SELECT
<include refid="Base_Column_List"/>
FROM type_info where alias =#{typeName} limit 1
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -23,6 +23,11 @@
<!-- 支持异步方法执行 -->
<task:annotation-driven />
<!-- Enables the Spring Task @Scheduled programming model -->
<task:executor id="executor" pool-size="50"/>
<task:scheduler id="scheduler" pool-size="50"/>
<task:annotation-driven executor="executor" scheduler="scheduler"/>
<mvc:annotation-driven>
<mvc:message-converters>
<ref bean="stringConverter" />
... ...
# ******************** influxdb common configs ********************
influxdb.num=2
influxdb.name=aws;qcloud
influxdb.ip=http://127.0.0.1:8086;http://10.66.4.25:8086
influxdb.ip=http://123.206.79.151:8086;http://10.66.4.25:8086
influxdb.user=root;root
influxdb.pwd=root;root
influxdb.connect.timeout=15;15
... ...