ServiceServiceDaoImplMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="serviceServiceDaoImpl">
  6. <!-- 保存服务信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveServiceInfo" parameterType="Map">
  8. insert into c_service(
  9. business_type_cd,method,provide_app_id,service_code,retry_count,messageQueueName,url,timeout,is_instance,name,service_id,seq
  10. ) values (
  11. #{businessTypeCd},#{method},#{provideAppId},#{serviceCode},#{retryCount},#{messageQueueName},#{url},#{timeout},#{isInstance},#{name},#{serviceId},#{seq}
  12. )
  13. </insert>
  14. <!-- 查询服务信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessServiceInfo" parameterType="Map" resultType="Map">
  16. select t.business_type_cd,t.business_type_cd businessTypeCd,t.method,t.provide_app_id,t.provide_app_id
  17. provideAppId,t.service_code,t.service_code serviceCode,t.retry_count,t.retry_count
  18. retryCount,t.messageQueueName,t.url,t.timeout,t.is_instance,t.is_instance
  19. isInstance,t.operate,t.name,t.service_id,t.service_id serviceId,t.seq
  20. from business_service t
  21. where 1 =1
  22. <if test="businessTypeCd !=null and businessTypeCd != ''">
  23. and t.business_type_cd= #{businessTypeCd}
  24. </if>
  25. <if test="method !=null and method != ''">
  26. and t.method= #{method}
  27. </if>
  28. <if test="provideAppId !=null and provideAppId != ''">
  29. and t.provide_app_id= #{provideAppId}
  30. </if>
  31. <if test="serviceCode !=null and serviceCode != ''">
  32. and t.service_code= #{serviceCode}
  33. </if>
  34. <if test="retryCount !=null and retryCount != ''">
  35. and t.retry_count= #{retryCount}
  36. </if>
  37. <if test="messageQueueName !=null and messageQueueName != ''">
  38. and t.messageQueueName= #{messageQueueName}
  39. </if>
  40. <if test="url !=null and url != ''">
  41. and t.url= #{url}
  42. </if>
  43. <if test="timeout !=null and timeout != ''">
  44. and t.timeout= #{timeout}
  45. </if>
  46. <if test="isInstance !=null and isInstance != ''">
  47. and t.is_instance= #{isInstance}
  48. </if>
  49. <if test="operate !=null and operate != ''">
  50. and t.operate= #{operate}
  51. </if>
  52. <if test="name !=null and name != ''">
  53. and t.name= #{name}
  54. </if>
  55. <if test="serviceId !=null and serviceId != ''">
  56. and t.service_id= #{serviceId}
  57. </if>
  58. <if test="seq !=null and seq != ''">
  59. and t.seq= #{seq}
  60. </if>
  61. </select>
  62. <!-- 保存服务信息至 instance表中 add by wuxw 2018-07-03 -->
  63. <insert id="saveServiceInfoInstance" parameterType="Map">
  64. insert into c_service(
  65. business_type_cd,method,provide_app_id,service_code,retry_count,status_cd,messageQueueName,url,timeout,is_instance,name,service_id,seq
  66. ) select
  67. t.business_type_cd,t.method,t.provide_app_id,t.service_code,t.retry_count,'0',t.messageQueueName,t.url,t.timeout,t.is_instance,t.name,t.service_id,t.seq
  68. from business_service t where 1=1
  69. <if test="businessTypeCd !=null and businessTypeCd != ''">
  70. and t.business_type_cd= #{businessTypeCd}
  71. </if>
  72. <if test="method !=null and method != ''">
  73. and t.method= #{method}
  74. </if>
  75. <if test="provideAppId !=null and provideAppId != ''">
  76. and t.provide_app_id= #{provideAppId}
  77. </if>
  78. <if test="serviceCode !=null and serviceCode != ''">
  79. and t.service_code= #{serviceCode}
  80. </if>
  81. <if test="retryCount !=null and retryCount != ''">
  82. and t.retry_count= #{retryCount}
  83. </if>
  84. <if test="messageQueueName !=null and messageQueueName != ''">
  85. and t.messageQueueName= #{messageQueueName}
  86. </if>
  87. <if test="url !=null and url != ''">
  88. and t.url= #{url}
  89. </if>
  90. <if test="timeout !=null and timeout != ''">
  91. and t.timeout= #{timeout}
  92. </if>
  93. <if test="isInstance !=null and isInstance != ''">
  94. and t.is_instance= #{isInstance}
  95. </if>
  96. and t.operate= 'ADD'
  97. <if test="name !=null and name != ''">
  98. and t.name= #{name}
  99. </if>
  100. <if test="serviceId !=null and serviceId != ''">
  101. and t.service_id= #{serviceId}
  102. </if>
  103. <if test="seq !=null and seq != ''">
  104. and t.seq= #{seq}
  105. </if>
  106. </insert>
  107. <!-- 查询服务信息 add by wuxw 2018-07-03 -->
  108. <select id="getServiceInfo" parameterType="Map" resultType="Map">
  109. select t.business_type_cd,t.business_type_cd businessTypeCd,t.method,t.provide_app_id,t.provide_app_id
  110. provideAppId,t.service_code,t.service_code serviceCode,t.retry_count,t.retry_count
  111. retryCount,t.status_cd,t.status_cd statusCd,t.messageQueueName,t.url,t.timeout,t.is_instance,t.is_instance
  112. isInstance,t.name,t.service_id,t.service_id serviceId,t.seq
  113. from c_service t
  114. <if test="appId != null and appId != ''">
  115. , c_route r
  116. , c_app p
  117. </if>
  118. where 1 =1
  119. <if test="appId != null and appId != ''">
  120. and t.service_id = r.service_id
  121. and r.status_cd = '0'
  122. and r.app_id = p.app_id
  123. and p.status_cd = '0'
  124. and p.app_id = #{appId}
  125. </if>
  126. <if test="businessTypeCd !=null and businessTypeCd != ''">
  127. and t.business_type_cd= #{businessTypeCd}
  128. </if>
  129. <if test="method !=null and method != ''">
  130. and t.method= #{method}
  131. </if>
  132. <if test="provideAppId !=null and provideAppId != ''">
  133. and t.provide_app_id= #{provideAppId}
  134. </if>
  135. <if test="serviceCode !=null and serviceCode != ''">
  136. and t.service_code= #{serviceCode}
  137. </if>
  138. <if test="retryCount !=null and retryCount != ''">
  139. and t.retry_count= #{retryCount}
  140. </if>
  141. <if test="statusCd !=null and statusCd != ''">
  142. and t.status_cd= #{statusCd}
  143. </if>
  144. <if test="messageQueueName !=null and messageQueueName != ''">
  145. and t.messageQueueName= #{messageQueueName}
  146. </if>
  147. <if test="url !=null and url != ''">
  148. and t.url= #{url}
  149. </if>
  150. <if test="serviceUrl !=null and serviceUrl != ''">
  151. and t.url like concat('%',#{serviceUrl},'%')
  152. </if>
  153. <if test="timeout !=null and timeout != ''">
  154. and t.timeout= #{timeout}
  155. </if>
  156. <if test="isInstance !=null and isInstance != ''">
  157. and t.is_instance= #{isInstance}
  158. </if>
  159. <if test="name !=null and name != ''">
  160. and t.name= #{name}
  161. </if>
  162. <if test="serviceName !=null and serviceName != ''">
  163. and t.name like concat('%',#{serviceName},'%')
  164. </if>
  165. <if test="serviceId !=null and serviceId != ''">
  166. and t.service_id= #{serviceId}
  167. </if>
  168. <if test="seq !=null and seq != ''">
  169. and t.seq= #{seq}
  170. </if>
  171. order by t.create_time desc
  172. <if test="page != -1 and page != null ">
  173. limit #{page}, #{row}
  174. </if>
  175. </select>
  176. <!-- 修改服务信息 add by wuxw 2018-07-03 -->
  177. <update id="updateServiceInfo" parameterType="Map">
  178. update c_service t set t.status_cd = #{statusCd}
  179. <if test="businessTypeCd !=null and businessTypeCd != ''">
  180. , t.business_type_cd= #{businessTypeCd}
  181. </if>
  182. <if test="method !=null and method != ''">
  183. , t.method= #{method}
  184. </if>
  185. <if test="provideAppId !=null and provideAppId != ''">
  186. , t.provide_app_id= #{provideAppId}
  187. </if>
  188. <if test="serviceCode !=null and serviceCode != ''">
  189. , t.service_code= #{serviceCode}
  190. </if>
  191. <if test="retryCount !=null and retryCount != ''">
  192. , t.retry_count= #{retryCount}
  193. </if>
  194. <if test="messageQueueName !=null and messageQueueName != ''">
  195. , t.messageQueueName= #{messageQueueName}
  196. </if>
  197. <if test="url !=null and url != ''">
  198. , t.url= #{url}
  199. </if>
  200. <if test="timeout !=null and timeout != ''">
  201. , t.timeout= #{timeout}
  202. </if>
  203. <if test="isInstance !=null and isInstance != ''">
  204. , t.is_instance= #{isInstance}
  205. </if>
  206. <if test="name !=null and name != ''">
  207. , t.name= #{name}
  208. </if>
  209. <if test="seq !=null and seq != ''">
  210. , t.seq= #{seq}
  211. </if>
  212. where 1=1
  213. <if test="serviceId !=null and serviceId != ''">
  214. and t.service_id= #{serviceId}
  215. </if>
  216. </update>
  217. <!-- 查询服务数量 add by wuxw 2018-07-03 -->
  218. <select id="queryServicesCount" parameterType="Map" resultType="Map">
  219. select count(1) count
  220. from c_service t
  221. <if test="appId != null and appId != ''">
  222. , c_route r
  223. , c_app p
  224. </if>
  225. where 1 =1
  226. <if test="appId != null and appId != ''">
  227. and t.service_id = r.service_id
  228. and r.status_cd = '0'
  229. and r.app_id = p.app_id
  230. and p.status_cd = '0'
  231. and p.app_id = #{appId}
  232. </if>
  233. <if test="businessTypeCd !=null and businessTypeCd != ''">
  234. and t.business_type_cd= #{businessTypeCd}
  235. </if>
  236. <if test="method !=null and method != ''">
  237. and t.method= #{method}
  238. </if>
  239. <if test="provideAppId !=null and provideAppId != ''">
  240. and t.provide_app_id= #{provideAppId}
  241. </if>
  242. <if test="serviceCode !=null and serviceCode != ''">
  243. and t.service_code= #{serviceCode}
  244. </if>
  245. <if test="retryCount !=null and retryCount != ''">
  246. and t.retry_count= #{retryCount}
  247. </if>
  248. <if test="statusCd !=null and statusCd != ''">
  249. and t.status_cd= #{statusCd}
  250. </if>
  251. <if test="messageQueueName !=null and messageQueueName != ''">
  252. and t.messageQueueName= #{messageQueueName}
  253. </if>
  254. <if test="url !=null and url != ''">
  255. and t.url= #{url}
  256. </if>
  257. <if test="serviceUrl !=null and serviceUrl != ''">
  258. and t.url like concat('%',#{serviceUrl},'%')
  259. </if>
  260. <if test="timeout !=null and timeout != ''">
  261. and t.timeout= #{timeout}
  262. </if>
  263. <if test="isInstance !=null and isInstance != ''">
  264. and t.is_instance= #{isInstance}
  265. </if>
  266. <if test="name !=null and name != ''">
  267. and t.name= #{name}
  268. </if>
  269. <if test="serviceName !=null and serviceName != ''">
  270. and t.name like concat('%',#{serviceName},'%')
  271. </if>
  272. <if test="serviceId !=null and serviceId != ''">
  273. and t.service_id= #{serviceId}
  274. </if>
  275. <if test="seq !=null and seq != ''">
  276. and t.seq= #{seq}
  277. </if>
  278. </select>
  279. <!-- 保存服务提供信息 add by wuxw 2018-07-03
  280. insert into c_service_sql(
  281. service_code,name,params,query_model,"sql",proc,java_script,template,remark
  282. ) values (
  283. #{serviceCode},#{name},#{params},#{queryModel},#{sql},#{proc},#{javaScript},#{template},#{remark}
  284. )
  285. -->
  286. <insert id="saveServiceProvideInfo" parameterType="Map">
  287. insert into c_service_sql
  288. select null,#{serviceCode},#{name},#{params},#{queryModel},#{sql},#{proc},#{javaScript},#{template},#{remark},now(),'0'
  289. </insert>
  290. <!-- 查询服务提供信息 add by wuxw 2018-07-03 -->
  291. <select id="getServiceProvideInfo" parameterType="Map" resultType="Map">
  292. select t.id,t.service_code serviceCode,t.name,t.params,t.query_model queryModel,
  293. (CASE
  294. WHEN t.`query_model` = '1'
  295. THEN 'SQL方式'
  296. WHEN t.query_model = '2'
  297. THEN '存储过程'
  298. ELSE
  299. 'java 方式'
  300. END) queryModel ,
  301. t.sql,t.proc,t.java_script javaScript,t.template,t.remark
  302. from c_service_sql t
  303. where 1 =1
  304. <if test="serviceCode !=null and serviceCode != ''">
  305. and t.service_code= #{serviceCode}
  306. </if>
  307. <if test="name !=null and name != ''">
  308. and t.name like concat('%',#{name},'%')
  309. </if>
  310. <if test="queryModel !=null and queryModel != ''">
  311. and t.query_model= #{queryModel}
  312. </if>
  313. <if test="statusCd !=null and statusCd != ''">
  314. and t.status_cd= #{statusCd}
  315. </if>
  316. order by t.create_time desc
  317. <if test="page != -1 and page != null ">
  318. limit #{page}, #{row}
  319. </if>
  320. </select>
  321. <!-- 修改服务提供信息 add by wuxw 2018-07-03 -->
  322. <update id="updateServiceProvideInfo" parameterType="Map">
  323. update c_service_sql t set t.status_cd = #{statusCd}
  324. <if test="serviceCode !=null and serviceCode != ''">
  325. , t.service_code= #{serviceCode}
  326. </if>
  327. <if test="name !=null and name != ''">
  328. , t.name= #{name}
  329. </if>
  330. <if test="params !=null and params != ''">
  331. , t.params= #{params}
  332. </if>
  333. <if test="queryModel !=null and queryModel != ''">
  334. , t.query_model= #{queryModel}
  335. </if>
  336. <if test="sql !=null and sql != ''">
  337. , t.`sql`= #{sql}
  338. </if>
  339. <if test="proc !=null and proc != ''">
  340. , t.proc= #{proc}
  341. </if>
  342. <if test="javaScript !=null and javaScript != ''">
  343. , t.java_script= #{javaScript}
  344. </if>
  345. <if test="template !=null and template != ''">
  346. , t.template= #{template}
  347. </if>
  348. <if test="remark !=null and remark != ''">
  349. , t.remark= #{remark}
  350. </if>
  351. where 1=1
  352. <if test="id !=null and id != ''">
  353. and t.id= #{id}
  354. </if>
  355. </update>
  356. <!-- 查询服务提供数量 add by wuxw 2018-07-03 -->
  357. <select id="queryServiceProvidesCount" parameterType="Map" resultType="Map">
  358. select count(1) count
  359. from c_service_sql t
  360. where 1 =1
  361. <if test="serviceCode !=null and serviceCode != ''">
  362. and t.service_code= #{serviceCode}
  363. </if>
  364. <if test="name !=null and name != ''">
  365. and t.name like concat('%',#{name},'%')
  366. </if>
  367. <if test="queryModel !=null and queryModel != ''">
  368. and t.query_model= #{queryModel}
  369. </if>
  370. <if test="statusCd !=null and statusCd != ''">
  371. and t.status_cd= #{statusCd}
  372. </if>
  373. </select>
  374. </mapper>