Authored by FengRuwei

java服务 增删改

  1 +package com.monitor.cmdb.ctrl;
  2 +
  3 +import com.model.HostInfo;
  4 +import com.model.JavaApiInfo;
  5 +import com.monitor.cmdb.service.IJavaApiInfoService;
  6 +import com.monitor.cmdb.service.impl.JavaApiInfoService;
  7 +import com.monitor.model.request.JavaApiInfoReq;
  8 +import com.monitor.model.response.BaseResponse;
  9 +import com.monitor.model.response.PageResponse;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.util.CollectionUtils;
  14 +import org.springframework.web.bind.annotation.*;
  15 +
  16 +import java.util.List;
  17 +
  18 +/**
  19 + * Created by fruwei on 2016/6/20.
  20 + */
  21 +@RestController
  22 +@RequestMapping(value = "/javaApi")
  23 +public class JavaApiInfoCtrl {
  24 +
  25 + Logger log = LoggerFactory.getLogger(JavaApiInfoCtrl.class);
  26 +
  27 + @Autowired
  28 + private IJavaApiInfoService javaApiInfoService;
  29 +
  30 +
  31 + @RequestMapping("/query")
  32 + @ResponseBody
  33 + public BaseResponse<PageResponse<JavaApiInfo>> getJavaApiInfos(@RequestBody JavaApiInfoReq req) throws Exception {
  34 +
  35 + log.info("getJavaApiInfos with param is {}", req);
  36 + // 查询列表
  37 +
  38 + PageResponse<JavaApiInfo> responseBO = javaApiInfoService.getJavaApiInfos(req);
  39 + if (responseBO == null || CollectionUtils.isEmpty(responseBO.getRows())) {
  40 + return new BaseResponse<PageResponse<JavaApiInfo>>();
  41 + }
  42 + PageResponse<JavaApiInfo> response = new PageResponse<JavaApiInfo>();
  43 + response.setCurrentPage(responseBO.getCurrentPage());
  44 + response.setRows(responseBO.getRows());
  45 + response.setPageSize(responseBO.getPageSize());
  46 + response.setTotal(responseBO.getTotal());
  47 + log.info("getJavaApiInfos success and total={}", response.getTotal());
  48 +
  49 + return new BaseResponse<PageResponse<JavaApiInfo>>(response);
  50 + }
  51 +
  52 + @RequestMapping("/save")
  53 + @ResponseBody
  54 + public BaseResponse<Integer> saveJavaApiInfo(@RequestBody JavaApiInfo req) throws Exception {
  55 + log.info("saveMechineInfo with param is {}", req);
  56 + return javaApiInfoService.saveJavaApiInfo(req);
  57 + }
  58 +
  59 +
  60 + @RequestMapping("/del")
  61 + @ResponseBody
  62 + public BaseResponse<Integer> delJavaApiInfo(@RequestParam(value = "id", required = true) Integer id) throws Exception {
  63 + log.info("delMechineInfo with param is {}", id);
  64 + return javaApiInfoService.delJavaApiInfo(id);
  65 + }
  66 +
  67 +
  68 +}
1 package com.monitor.cmdb.service; 1 package com.monitor.cmdb.service;
2 2
3 import com.model.JavaApiInfo; 3 import com.model.JavaApiInfo;
  4 +import com.monitor.model.request.JavaApiInfoReq;
4 import com.monitor.model.response.BaseResponse; 5 import com.monitor.model.response.BaseResponse;
  6 +import com.monitor.model.response.PageResponse;
5 7
6 import java.util.List; 8 import java.util.List;
7 9
@@ -19,5 +21,5 @@ public interface IJavaApiInfoService { @@ -19,5 +21,5 @@ public interface IJavaApiInfoService {
19 21
20 public BaseResponse<Integer> delJavaApiInfo(int id); 22 public BaseResponse<Integer> delJavaApiInfo(int id);
21 23
22 - 24 + PageResponse<JavaApiInfo> getJavaApiInfos(JavaApiInfoReq req);
23 } 25 }
@@ -2,11 +2,17 @@ package com.monitor.cmdb.service.impl; @@ -2,11 +2,17 @@ package com.monitor.cmdb.service.impl;
2 2
3 import com.model.JavaApiInfo; 3 import com.model.JavaApiInfo;
4 import com.monitor.cmdb.service.IJavaApiInfoService; 4 import com.monitor.cmdb.service.IJavaApiInfoService;
  5 +import com.monitor.model.domain.PageBean;
  6 +import com.monitor.model.request.JavaApiInfoReq;
5 import com.monitor.model.response.BaseResponse; 7 import com.monitor.model.response.BaseResponse;
  8 +import com.monitor.model.response.PageResponse;
6 import com.monitor.mysql.mapper.JavaApiInfoMapper; 9 import com.monitor.mysql.mapper.JavaApiInfoMapper;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
7 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Component; 13 import org.springframework.stereotype.Component;
9 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
  15 +import org.springframework.util.CollectionUtils;
10 16
11 import java.util.List; 17 import java.util.List;
12 18
@@ -15,6 +21,7 @@ import java.util.List; @@ -15,6 +21,7 @@ import java.util.List;
15 */ 21 */
16 @Service 22 @Service
17 public class JavaApiInfoService implements IJavaApiInfoService { 23 public class JavaApiInfoService implements IJavaApiInfoService {
  24 + Logger log= LoggerFactory.getLogger(JavaApiInfoService.class);
18 @Autowired 25 @Autowired
19 private JavaApiInfoMapper javaApiInfoMapper; 26 private JavaApiInfoMapper javaApiInfoMapper;
20 @Override 27 @Override
@@ -44,4 +51,33 @@ public class JavaApiInfoService implements IJavaApiInfoService { @@ -44,4 +51,33 @@ public class JavaApiInfoService implements IJavaApiInfoService {
44 return new BaseResponse<Integer>(result); 51 return new BaseResponse<Integer>(result);
45 } 52 }
46 53
  54 + @Override
  55 + public PageResponse<JavaApiInfo> getJavaApiInfos(JavaApiInfoReq req) {
  56 +
  57 + log.info("get api infos with param is {}", req);
  58 + // 组装分页对象
  59 + PageBean page = PageBean.initPageInfo(req.getCurrentPage(),
  60 + req.getPageSize(), req);
  61 + // 先查询符合条件的总数量
  62 + int total = javaApiInfoMapper.selectCountByCodition(page);
  63 + log.info("get api infos num is {}, with param is {}", total,
  64 + req);
  65 + // 数量为0 直接返回
  66 + if (total == 0) {
  67 + return null;
  68 + }
  69 + // 获取列表
  70 + List<JavaApiInfo> JavaApiInfo = javaApiInfoMapper.selectJavaInfosByCodition(page);
  71 + if (CollectionUtils.isEmpty(JavaApiInfo)) {
  72 + log.debug("get api infos is null with param is {}", req);
  73 + return null;
  74 + }
  75 + PageResponse<JavaApiInfo> response = new PageResponse<JavaApiInfo>();
  76 + response.setCurrentPage(req.getCurrentPage());
  77 + response.setPageSize(req.getPageSize());
  78 + response.setTotal(total);
  79 + response.setRows(JavaApiInfo);
  80 + return response;
  81 + }
  82 +
47 } 83 }
@@ -19,7 +19,7 @@ public class ScheduledPlan { @@ -19,7 +19,7 @@ public class ScheduledPlan {
19 JavaApiClient javaApiClient; 19 JavaApiClient javaApiClient;
20 20
21 21
22 - @Scheduled(fixedRate=10000) 22 + @Scheduled(fixedRate=60000*3)
23 public void run() { 23 public void run() {
24 log.info("task start..."); 24 log.info("task start...");
25 25
@@ -147,17 +147,32 @@ public class JavaApiClient { @@ -147,17 +147,32 @@ public class JavaApiClient {
147 // 147 //
148 // mObjInfoMap.add(1, mObj2); 148 // mObjInfoMap.add(1, mObj2);
149 149
  150 + MObjectInfo mObj2 = new MObjectInfo();
  151 + mObj2.setMoId(0);
  152 + mObj2.setMoHostIp("localhost");
  153 + mObj2.setMoTags("10080");
  154 + mObj2.setMoName("gay");
  155 + mObj2.setMoTypeId(0);
  156 +
  157 + mObjInfoMap.add(0, mObj2);
  158 +
150 int uid = 8041886; 159 int uid = 8041886;
151 - for (int i = 0; i < 10; i++) { 160 + for (int i = 0; i < 1; i++) {
152 JavaApiInfo javaApiInfo = new JavaApiInfo(); 161 JavaApiInfo javaApiInfo = new JavaApiInfo();
153 javaApiInfo.setApiName("order.get_" + i); 162 javaApiInfo.setApiName("order.get_" + i);
154 javaApiInfo.setApiReqMethod(0); 163 javaApiInfo.setApiReqMethod(0);
155 javaApiInfo.setApiToggle(0); 164 javaApiInfo.setApiToggle(0);
156 javaApiInfo.setApiUrl("/gateway/?debug=XYZ&method=app.Shopping.listCoupon&uid=" + (uid++)); 165 javaApiInfo.setApiUrl("/gateway/?debug=XYZ&method=app.Shopping.listCoupon&uid=" + (uid++));
157 javaApiInfo.setServiceType(1); 166 javaApiInfo.setServiceType(1);
158 - javaApimap.put("order.get_" + i, javaApiInfo); 167 + javaApimap.put(javaApiInfo.getApiName(), javaApiInfo);
159 } 168 }
160 - 169 + JavaApiInfo javaApiInfo = new JavaApiInfo();
  170 + javaApiInfo.setApiName("frw.test");
  171 + javaApiInfo.setApiReqMethod(0);
  172 + javaApiInfo.setApiToggle(0);
  173 + javaApiInfo.setApiUrl("/gay/time/get?second=40");
  174 + javaApiInfo.setServiceType(0);
  175 + javaApimap.put(javaApiInfo.getApiName(), javaApiInfo);
161 176
162 } 177 }
163 178
  1 +package com.monitor.model.request;
  2 +
  3 +import com.monitor.model.page.PageRequest;
  4 +import lombok.Data;
  5 +
  6 +/**
  7 + * Created by fruwei on 2016/6/20.
  8 + */
  9 +@Data
  10 +public class JavaApiInfoReq extends PageRequest {
  11 +
  12 + private Integer serviceId;
  13 +
  14 + private Integer serviceType;
  15 +
  16 + private String apiName;
  17 +
  18 + private String apiUrl;
  19 +
  20 + private String apiData;
  21 +
  22 + private Integer apiToggle;
  23 +
  24 + private Integer apiReqMethod;
  25 +
  26 + private Integer apiWarnTrigger;
  27 +
  28 +}
@@ -17,6 +17,8 @@ public class JavaApiInfo { @@ -17,6 +17,8 @@ public class JavaApiInfo {
17 17
18 private Integer apiReqMethod; 18 private Integer apiReqMethod;
19 19
  20 + private Integer apiWarnTrigger;
  21 +
20 public Integer getServiceId() { 22 public Integer getServiceId() {
21 return serviceId; 23 return serviceId;
22 } 24 }
@@ -77,4 +79,12 @@ public class JavaApiInfo { @@ -77,4 +79,12 @@ public class JavaApiInfo {
77 public String toString() { 79 public String toString() {
78 return ReflectionToStringBuilder.toString(this); 80 return ReflectionToStringBuilder.toString(this);
79 } 81 }
  82 +
  83 + public Integer getApiWarnTrigger() {
  84 + return apiWarnTrigger;
  85 + }
  86 +
  87 + public void setApiWarnTrigger(Integer apiWarnTrigger) {
  88 + this.apiWarnTrigger = apiWarnTrigger;
  89 + }
80 } 90 }
@@ -2,6 +2,7 @@ package com.monitor.mysql.mapper; @@ -2,6 +2,7 @@ package com.monitor.mysql.mapper;
2 2
3 3
4 import com.model.JavaApiInfo; 4 import com.model.JavaApiInfo;
  5 +import com.monitor.model.domain.PageBean;
5 6
6 import java.util.List; 7 import java.util.List;
7 8
@@ -19,4 +20,8 @@ public interface JavaApiInfoMapper { @@ -19,4 +20,8 @@ public interface JavaApiInfoMapper {
19 int updateByPrimaryKey(JavaApiInfo record); 20 int updateByPrimaryKey(JavaApiInfo record);
20 21
21 List<JavaApiInfo> selectAllApi(); 22 List<JavaApiInfo> selectAllApi();
  23 +
  24 + int selectCountByCodition(PageBean page);
  25 +
  26 + List<JavaApiInfo> selectJavaInfosByCodition(PageBean page);
22 } 27 }
1 <?xml version="1.0" encoding="UTF-8" ?> 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 -<mapper namespace="com.monitor.mysql.mapper.JavaApiInfoMapper" >  
4 - <resultMap id="BaseResultMap" type="com.model.JavaApiInfo" >  
5 - <id column="service_id" property="serviceId" jdbcType="INTEGER" />  
6 - <result column="service_type" property="serviceType" jdbcType="INTEGER" />  
7 - <result column="api_name" property="apiName" jdbcType="VARCHAR" />  
8 - <result column="api_url" property="apiUrl" jdbcType="VARCHAR" />  
9 - <result column="api_data" property="apiData" jdbcType="VARCHAR" />  
10 - <result column="api_toggle" property="apiToggle" jdbcType="INTEGER" />  
11 - <result column="api_req_method" property="apiReqMethod" jdbcType="INTEGER" />  
12 - </resultMap>  
13 - <sql id="Base_Column_List" > 3 +<mapper namespace="com.monitor.mysql.mapper.JavaApiInfoMapper">
  4 + <resultMap id="BaseResultMap" type="com.model.JavaApiInfo">
  5 + <id column="service_id" property="serviceId" jdbcType="INTEGER"/>
  6 + <result column="service_type" property="serviceType" jdbcType="INTEGER"/>
  7 + <result column="api_name" property="apiName" jdbcType="VARCHAR"/>
  8 + <result column="api_url" property="apiUrl" jdbcType="VARCHAR"/>
  9 + <result column="api_data" property="apiData" jdbcType="VARCHAR"/>
  10 + <result column="api_toggle" property="apiToggle" jdbcType="INTEGER"/>
  11 + <result column="api_req_method" property="apiReqMethod" jdbcType="INTEGER"/>
  12 + </resultMap>
  13 + <sql id="Base_Column_List">
14 service_id, service_type, api_name, api_url, api_data, api_toggle, api_req_method 14 service_id, service_type, api_name, api_url, api_data, api_toggle, api_req_method
15 </sql> 15 </sql>
16 - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >  
17 - select  
18 - <include refid="Base_Column_List" />  
19 - from java_api_info  
20 - where service_id = #{serviceId,jdbcType=INTEGER}  
21 - </select>  
22 - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > 16 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  17 + select
  18 + <include refid="Base_Column_List"/>
  19 + from java_api_info
  20 + where service_id = #{serviceId,jdbcType=INTEGER}
  21 + </select>
  22 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
23 delete from java_api_info 23 delete from java_api_info
24 where service_id = #{serviceId,jdbcType=INTEGER} 24 where service_id = #{serviceId,jdbcType=INTEGER}
25 </delete> 25 </delete>
26 - <insert id="insert" parameterType="com.model.JavaApiInfo" > 26 + <insert id="insert" parameterType="com.model.JavaApiInfo">
27 insert into java_api_info (service_id, service_type, api_name, 27 insert into java_api_info (service_id, service_type, api_name,
28 api_url, api_data, api_toggle, 28 api_url, api_data, api_toggle,
29 api_req_method) 29 api_req_method)
@@ -31,80 +31,80 @@ @@ -31,80 +31,80 @@
31 #{apiUrl,jdbcType=VARCHAR}, #{apiData,jdbcType=VARCHAR}, #{apiToggle,jdbcType=INTEGER}, 31 #{apiUrl,jdbcType=VARCHAR}, #{apiData,jdbcType=VARCHAR}, #{apiToggle,jdbcType=INTEGER},
32 #{apiReqMethod,jdbcType=INTEGER}) 32 #{apiReqMethod,jdbcType=INTEGER})
33 </insert> 33 </insert>
34 - <insert id="insertSelective" parameterType="com.model.JavaApiInfo" >  
35 - insert into java_api_info  
36 - <trim prefix="(" suffix=")" suffixOverrides="," >  
37 - <if test="serviceId != null" >  
38 - service_id,  
39 - </if>  
40 - <if test="serviceType != null" >  
41 - service_type,  
42 - </if>  
43 - <if test="apiName != null" >  
44 - api_name,  
45 - </if>  
46 - <if test="apiUrl != null" >  
47 - api_url,  
48 - </if>  
49 - <if test="apiData != null" >  
50 - api_data,  
51 - </if>  
52 - <if test="apiToggle != null" >  
53 - api_toggle,  
54 - </if>  
55 - <if test="apiReqMethod != null" >  
56 - api_req_method,  
57 - </if>  
58 - </trim>  
59 - <trim prefix="values (" suffix=")" suffixOverrides="," >  
60 - <if test="serviceId != null" >  
61 - #{serviceId,jdbcType=INTEGER},  
62 - </if>  
63 - <if test="serviceType != null" >  
64 - #{serviceType,jdbcType=INTEGER},  
65 - </if>  
66 - <if test="apiName != null" >  
67 - #{apiName,jdbcType=VARCHAR},  
68 - </if>  
69 - <if test="apiUrl != null" >  
70 - #{apiUrl,jdbcType=VARCHAR},  
71 - </if>  
72 - <if test="apiData != null" >  
73 - #{apiData,jdbcType=VARCHAR},  
74 - </if>  
75 - <if test="apiToggle != null" >  
76 - #{apiToggle,jdbcType=INTEGER},  
77 - </if>  
78 - <if test="apiReqMethod != null" >  
79 - #{apiReqMethod,jdbcType=INTEGER},  
80 - </if>  
81 - </trim>  
82 - </insert>  
83 - <update id="updateByPrimaryKeySelective" parameterType="com.model.JavaApiInfo" >  
84 - update java_api_info  
85 - <set >  
86 - <if test="serviceType != null" >  
87 - service_type = #{serviceType,jdbcType=INTEGER},  
88 - </if>  
89 - <if test="apiName != null" >  
90 - api_name = #{apiName,jdbcType=VARCHAR},  
91 - </if>  
92 - <if test="apiUrl != null" >  
93 - api_url = #{apiUrl,jdbcType=VARCHAR},  
94 - </if>  
95 - <if test="apiData != null" >  
96 - api_data = #{apiData,jdbcType=VARCHAR},  
97 - </if>  
98 - <if test="apiToggle != null" >  
99 - api_toggle = #{apiToggle,jdbcType=INTEGER},  
100 - </if>  
101 - <if test="apiReqMethod != null" >  
102 - api_req_method = #{apiReqMethod,jdbcType=INTEGER},  
103 - </if>  
104 - </set>  
105 - where service_id = #{serviceId,jdbcType=INTEGER}  
106 - </update>  
107 - <update id="updateByPrimaryKey" parameterType="com.model.JavaApiInfo" > 34 + <insert id="insertSelective" parameterType="com.model.JavaApiInfo">
  35 + insert into java_api_info
  36 + <trim prefix="(" suffix=")" suffixOverrides=",">
  37 + <if test="serviceId != null">
  38 + service_id,
  39 + </if>
  40 + <if test="serviceType != null">
  41 + service_type,
  42 + </if>
  43 + <if test="apiName != null">
  44 + api_name,
  45 + </if>
  46 + <if test="apiUrl != null">
  47 + api_url,
  48 + </if>
  49 + <if test="apiData != null">
  50 + api_data,
  51 + </if>
  52 + <if test="apiToggle != null">
  53 + api_toggle,
  54 + </if>
  55 + <if test="apiReqMethod != null">
  56 + api_req_method,
  57 + </if>
  58 + </trim>
  59 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  60 + <if test="serviceId != null">
  61 + #{serviceId,jdbcType=INTEGER},
  62 + </if>
  63 + <if test="serviceType != null">
  64 + #{serviceType,jdbcType=INTEGER},
  65 + </if>
  66 + <if test="apiName != null">
  67 + #{apiName,jdbcType=VARCHAR},
  68 + </if>
  69 + <if test="apiUrl != null">
  70 + #{apiUrl,jdbcType=VARCHAR},
  71 + </if>
  72 + <if test="apiData != null">
  73 + #{apiData,jdbcType=VARCHAR},
  74 + </if>
  75 + <if test="apiToggle != null">
  76 + #{apiToggle,jdbcType=INTEGER},
  77 + </if>
  78 + <if test="apiReqMethod != null">
  79 + #{apiReqMethod,jdbcType=INTEGER},
  80 + </if>
  81 + </trim>
  82 + </insert>
  83 + <update id="updateByPrimaryKeySelective" parameterType="com.model.JavaApiInfo">
  84 + update java_api_info
  85 + <set>
  86 + <if test="serviceType != null">
  87 + service_type = #{serviceType,jdbcType=INTEGER},
  88 + </if>
  89 + <if test="apiName != null">
  90 + api_name = #{apiName,jdbcType=VARCHAR},
  91 + </if>
  92 + <if test="apiUrl != null">
  93 + api_url = #{apiUrl,jdbcType=VARCHAR},
  94 + </if>
  95 + <if test="apiData != null">
  96 + api_data = #{apiData,jdbcType=VARCHAR},
  97 + </if>
  98 + <if test="apiToggle != null">
  99 + api_toggle = #{apiToggle,jdbcType=INTEGER},
  100 + </if>
  101 + <if test="apiReqMethod != null">
  102 + api_req_method = #{apiReqMethod,jdbcType=INTEGER},
  103 + </if>
  104 + </set>
  105 + where service_id = #{serviceId,jdbcType=INTEGER}
  106 + </update>
  107 + <update id="updateByPrimaryKey" parameterType="com.model.JavaApiInfo">
108 update java_api_info 108 update java_api_info
109 set service_type = #{serviceType,jdbcType=INTEGER}, 109 set service_type = #{serviceType,jdbcType=INTEGER},
110 api_name = #{apiName,jdbcType=VARCHAR}, 110 api_name = #{apiName,jdbcType=VARCHAR},
@@ -115,11 +115,64 @@ @@ -115,11 +115,64 @@
115 where service_id = #{serviceId,jdbcType=INTEGER} 115 where service_id = #{serviceId,jdbcType=INTEGER}
116 </update> 116 </update>
117 117
118 - <select id="selectAllApi" resultMap="BaseResultMap" >  
119 - select  
120 - <include refid="Base_Column_List" />  
121 - from java_api_info  
122 - </select> 118 + <select id="selectAllApi" resultMap="BaseResultMap">
  119 + select
  120 + <include refid="Base_Column_List"/>
  121 + from java_api_info
  122 + </select>
  123 +
  124 +
  125 + <select id="selectCountByCodition" resultType="java.lang.Integer">
  126 + select
  127 + count(1)
  128 + from java_api_info
  129 + where
  130 + 1=1
  131 + <if test="params.serviceType != null">
  132 + and service_type = #{params.serviceType,jdbcType=INTEGER}
  133 + </if>
  134 + <if test="params.apiName != null">
  135 + and api_name = #{params.apiName,jdbcType=VARCHAR}
  136 + </if>
  137 + <if test="params.apiUrl != null">
  138 + and api_url = #{params.apiUrl,jdbcType=VARCHAR}
  139 + </if>
  140 + <if test="params.apiData != null">
  141 + and api_data = #{params.apiData,jdbcType=VARCHAR}
  142 + </if>
  143 + <if test="params.apiToggle != null">
  144 + and api_toggle = #{params.apiToggle,jdbcType=INTEGER}
  145 + </if>
  146 + <if test="params.apiReqMethod != null">
  147 + and api_req_method = #{params.apiReqMethod,jdbcType=INTEGER}
  148 + </if>
  149 + </select>
123 150
  151 + <select id="selectJavaInfosByCodition" resultMap="BaseResultMap">
  152 + select
  153 + <include refid="Base_Column_List"/>
  154 + from java_api_info
  155 + where
  156 + 1=1
  157 + <if test="params.serviceType != null">
  158 + and service_type = #{params.serviceType,jdbcType=INTEGER}
  159 + </if>
  160 + <if test="params.apiName != null">
  161 + and api_name = #{params.apiName,jdbcType=VARCHAR}
  162 + </if>
  163 + <if test="params.apiUrl != null">
  164 + and api_url = #{params.apiUrl,jdbcType=VARCHAR}
  165 + </if>
  166 + <if test="params.apiData != null">
  167 + and api_data = #{params.apiData,jdbcType=VARCHAR}
  168 + </if>
  169 + <if test="params.apiToggle != null">
  170 + and api_toggle = #{params.apiToggle,jdbcType=INTEGER}
  171 + </if>
  172 + <if test="params.apiReqMethod != null">
  173 + and api_req_method = #{params.apiReqMethod,jdbcType=INTEGER}
  174 + </if>
  175 + limit #{startIndex},#{pageSize}
  176 + </select>
124 177
125 </mapper> 178 </mapper>