InterfaceLogMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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">
  3. <mapper namespace="com.tofly.dc.mapper.InterfaceLogMapper">
  4. <resultMap id="interfaceLogMap" type="com.tofly.dc.entity.InterfaceLog">
  5. <id property="id" column="ID"/>
  6. <result property="interfaceId" column="INTERFACE_ID"/>
  7. <result property="accessTime" column="ACCESS_TIME"/>
  8. <result property="accessUserId" column="ACCESS_USER_ID"/>
  9. <result property="operationLength" column="OPERATION_LENGTH"/>
  10. <result property="state" column="STATE"/>
  11. <result property="errorCode" column="ERROR_CODE"/>
  12. <result property="errorNote" column="ERROR_NOTE"/>
  13. <association property="accessUserName" column="ACCESS_USER_ID" select="getRealName"/>
  14. <association property="stateName" column="STATE" select="getstateName"/>
  15. </resultMap>
  16. <select id="getstateName" resultType="string">
  17. SELECT CNAME
  18. FROM TF_YWPN_SYSCHILDCODE_D
  19. WHERE PCID = 50500
  20. AND CCODE = #{state}
  21. </select>
  22. <select id="getRealName" resultType="string" databaseId="oracle">
  23. select REAL_NAME createUserName
  24. from TF_SMPN_USER_X
  25. where id = #{createUser}
  26. </select>
  27. <resultMap id="interfaceLogVoMap" type="com.tofly.dc.entity.vo.InterfaceLogVo">
  28. <id property="id" column="ID"/>
  29. <result property="interfaceId" column="INTERFACE_ID"/>
  30. <result property="accessTime" column="ACCESS_TIME"/>
  31. <result property="accessUserId" column="ACCESS_USER_ID"/>
  32. <result property="operationLength" column="OPERATION_LENGTH"/>
  33. <result property="state" column="STATE"/>
  34. <result property="code" column="CODE"/>
  35. <result property="name" column="NAME"/>
  36. <result property="note" column="NOTE"/>
  37. <result property="ownershipSystem" column="OWNERSHIP_SYSTEM"/>
  38. <result property="ownershipBusiness" column="OWNERSHIP_BUSINESS"/>
  39. <result property="url" column="URL"/>
  40. <result property="runningStatus" column="RUNNING_STATUS"/>
  41. <result property="del" column="DEL"/>
  42. <result property="createTime" column="CREATE_TIME"/>
  43. <result property="createUser" column="CREATE_USER"/>
  44. <result property="type" column="TYPE"/>
  45. <result property="contentType" column="CONTENT_TYPE"/>
  46. <result property="errorCode" column="ERROR_CODE"/>
  47. <result property="errorNote" column="ERROR_NOTE"/>
  48. <association property="accessUserName" column="ACCESS_USER_ID" select="getRealName"/>
  49. <association property="stateName" column="STATE" select="getstateName"/>
  50. <association property="ownershipSystemName" column="OWNERSHIP_SYSTEM"
  51. select="com.tofly.dc.mapper.InterfaceManageMapper.getOwnershipSystemName"/>
  52. <association property="ownershipBusinessName" column="OWNERSHIP_BUSINESS"
  53. select="com.tofly.dc.mapper.InterfaceManageMapper.getOwnershipBusinessName"/>
  54. <association property="runningStatusName" column="RUNNING_STATUS"
  55. select="com.tofly.dc.mapper.InterfaceManageMapper.getRunningStatusName"/>
  56. <association property="delName" column="DEL" select="com.tofly.dc.mapper.InterfaceManageMapper.getDelName"/>
  57. <association property="createUserName" column="CREATE_USER"
  58. select="getRealName"/>
  59. <association property="typeName" column="TYPE" select="com.tofly.dc.mapper.InterfaceManageMapper.getTypeName"/>
  60. <association property="contentTypeName" column="CONTENT_TYPE"
  61. select="com.tofly.dc.mapper.InterfaceManageMapper.getContentTypeName"/>
  62. </resultMap>
  63. <select id="getInterfaceLogVoList" resultMap="interfaceLogVoMap">
  64. select
  65. t1.*,t2.CODE,t2.NAME,t2.NOTE,t2.OWNERSHIP_SYSTEM,t2.OWNERSHIP_BUSINESS,t2.URL,t2.RUNNING_STATUS,t2.DEL,t2.CREATE_TIME,t2.CREATE_USER,t2.TYPE,t2.CONTENT_TYPE
  66. FROM TF_INTERFACE_LOG t1 left join TF_INTERFACE_MANAGE t2
  67. on t1.INTERFACE_ID = t2.ID
  68. WHERE '1' = '1'
  69. <if test="log.accessUserId !=null">
  70. and t1.ACCESS_USER_ID =#{log.accessUserId}
  71. </if>
  72. <if test="log.state !=null and log.state.trim() != ''">
  73. and t1.STATE =#{log.state}
  74. </if>
  75. <if test="log.ownershipSystem !=null and log.ownershipSystem.trim() != ''">
  76. and t2.OWNERSHIP_SYSTEM =#{log.ownershipSystem}
  77. </if>
  78. <if test="log.ownershipBusiness !=null and log.ownershipBusiness.trim() != ''">
  79. and t2.OWNERSHIP_BUSINESS =#{log.ownershipBusiness}
  80. </if>
  81. <if test="log.runningStatus !=null and log.runningStatus.trim() != ''">
  82. and t2.RUNNING_STATUS =#{log.runningStatus}
  83. </if>
  84. <if test="log.del !=null and log.del.trim() != ''">
  85. and t2.DEL =#{log.del}
  86. </if>
  87. <if test="log.type !=null and log.type.trim() != ''">
  88. and t2.TYPE =#{log.type}
  89. </if>
  90. <if test="log.contentType !=null and log.contentType.trim() != ''">
  91. and t2.CONTENT_TYPE =#{log.contentType}
  92. </if>
  93. ORDER BY t1.ACCESS_TIME desc
  94. </select>
  95. <resultMap id="sysMonitoringVoMap" type="com.tofly.dc.entity.vo.SysMonitoringVo">
  96. <result property="ownershipSystem" column="OWNERSHIP_SYSTEM"/>
  97. <result property="totalNum" column="totalNum"/>
  98. <result property="totalTime" column="totalTime"/>
  99. <result property="errorNum" column="errorNum"/>
  100. <result property="successfulNum" column="successfulNum"/>
  101. <association property="ownershipSystemName" column="OWNERSHIP_SYSTEM"
  102. select="com.tofly.dc.mapper.InterfaceManageMapper.getOwnershipSystemName"/>
  103. </resultMap>
  104. <select id="getSysMonitoringVoList" resultMap="sysMonitoringVoMap">
  105. SELECT OWNERSHIP_SYSTEM, totalNum, totalTime, errorNum, (totalNum - errorNum) successfulNum
  106. FROM (
  107. SELECT T2.OWNERSHIP_SYSTEM,
  108. count(1) totalNum,
  109. sum(T1.OPERATION_LENGTH) totalTime,
  110. count(T1.ERROR_CODE) errorNum
  111. FROM TF_INTERFACE_LOG t1
  112. LEFT JOIN TF_INTERFACE_MANAGE t2
  113. on t1.INTERFACE_ID = t2.ID
  114. where 1=1
  115. <if test="dto.sysId !=null and dto.sysId.trim() != ''">
  116. and t2.OWNERSHIP_SYSTEM =#{dto.sysId}
  117. </if>
  118. <if test="dto.startTime != null and dto.startTime.trim() != ''">
  119. and to_char(t1.ACCESS_TIME,'yyyy-MM-dd hh:mm:ss') >= #{dto.startTime}
  120. </if>
  121. <if test="dto.endTime != null and dto.endTime.trim() != ''">
  122. <![CDATA[ and to_char(t1.ACCESS_TIME,'yyyy-MM-dd hh:mm:ss') <= #{dto.endTime}]]>
  123. </if>
  124. GROUP BY t2.OWNERSHIP_SYSTEM
  125. )
  126. </select>
  127. <resultMap id="businessMonitoringVoMap" type="com.tofly.dc.entity.vo.BusinessMonitoringVo">
  128. <result property="ownershipSystem" column="OWNERSHIP_SYSTEM"/>
  129. <result property="ownershipBusiness" column="OWNERSHIP_BUSINESS"/>
  130. <result property="totalNum" column="totalNum"/>
  131. <result property="totalTime" column="totalTime"/>
  132. <result property="errorNum" column="errorNum"/>
  133. <result property="successfulNum" column="successfulNum"/>
  134. <association property="ownershipSystemName" column="OWNERSHIP_SYSTEM"
  135. select="com.tofly.dc.mapper.InterfaceManageMapper.getOwnershipSystemName"/>
  136. <association property="ownershipBusinessName" column="OWNERSHIP_BUSINESS"
  137. select="com.tofly.dc.mapper.InterfaceManageMapper.getOwnershipBusinessName"/>
  138. </resultMap>
  139. <select id="getBusinessMonitoringVoList" resultMap="businessMonitoringVoMap">
  140. SELECT OWNERSHIP_SYSTEM,OWNERSHIP_BUSINESS, totalNum, totalTime, errorNum, (totalNum - errorNum) successfulNum
  141. FROM (
  142. SELECT T2.OWNERSHIP_SYSTEM,t2.OWNERSHIP_BUSINESS,
  143. count(1) totalNum,
  144. sum(T1.OPERATION_LENGTH) totalTime,
  145. count(T1.ERROR_CODE) errorNum
  146. FROM TF_INTERFACE_LOG t1
  147. LEFT JOIN TF_INTERFACE_MANAGE t2
  148. on t1.INTERFACE_ID = t2.ID
  149. where 1=1
  150. <if test="dto.sysId !=null and dto.sysId.trim() != ''">
  151. and t2.OWNERSHIP_SYSTEM =#{dto.sysId}
  152. </if>
  153. <if test="dto.businessId !=null and dto.businessId.trim() != ''">
  154. and t2.OWNERSHIP_BUSINESS =#{dto.businessId}
  155. </if>
  156. <if test="dto.startTime != null and dto.startTime.trim() != ''">
  157. and to_char(t1.ACCESS_TIME,'yyyy-MM-dd hh:mm:ss') >= #{dto.startTime}
  158. </if>
  159. <if test="dto.endTime != null and dto.endTime.trim() != ''">
  160. <![CDATA[ and to_char(t1.ACCESS_TIME,'yyyy-MM-dd hh:mm:ss') <= #{dto.endTime}]]>
  161. </if>
  162. GROUP BY t2.OWNERSHIP_SYSTEM,t2.OWNERSHIP_BUSINESS
  163. )
  164. </select>
  165. <resultMap id="interfaceMonitoringVoMap" type="com.tofly.dc.entity.vo.InterfaceMonitoringVo">
  166. <result property="name" column="name"/>
  167. <result property="url" column="url"/>
  168. <result property="type" column="type"/>
  169. <result property="ownershipSystem" column="OWNERSHIP_SYSTEM"/>
  170. <result property="ownershipBusiness" column="OWNERSHIP_BUSINESS"/>
  171. <result property="totalNum" column="totalNum"/>
  172. <result property="totalTime" column="totalTime"/>
  173. <result property="errorNum" column="errorNum"/>
  174. <result property="successfulNum" column="successfulNum"/>
  175. <association property="ownershipSystemName" column="OWNERSHIP_SYSTEM"
  176. select="com.tofly.dc.mapper.InterfaceManageMapper.getOwnershipSystemName"/>
  177. <association property="ownershipBusinessName" column="OWNERSHIP_BUSINESS"
  178. select="com.tofly.dc.mapper.InterfaceManageMapper.getOwnershipBusinessName"/>
  179. <association property="typeName" column="TYPE" select="com.tofly.dc.mapper.InterfaceManageMapper.getTypeName"/>
  180. </resultMap>
  181. <select id="getInterfaceMonitoringVoList" resultMap="interfaceMonitoringVoMap">
  182. SELECT a.* ,(a.totalNum-a.errorNum) as successfulNum
  183. FROM (
  184. SELECT t1.INTERFACE_ID,
  185. t2.NAME name,
  186. t2.URL url,
  187. t2.type type,
  188. t2.OWNERSHIP_SYSTEM,
  189. t2.OWNERSHIP_BUSINESS,
  190. count(1) totalNum,
  191. sum(T1.OPERATION_LENGTH) totalTime,
  192. count(T1.ERROR_CODE) errorNum
  193. FROM TF_INTERFACE_LOG t1
  194. LEFT JOIN TF_INTERFACE_MANAGE t2
  195. on t1.INTERFACE_ID = t2.ID
  196. where 1=1
  197. <if test="dto.sysId !=null and dto.sysId.trim() != ''">
  198. and t2.OWNERSHIP_SYSTEM =#{dto.sysId}
  199. </if>
  200. <if test="dto.businessId !=null and dto.businessId.trim() != ''">
  201. and t2.OWNERSHIP_BUSINESS =#{dto.businessId}
  202. </if>
  203. <if test="dto.typeId !=null and dto.typeId.trim() != ''">
  204. and t2.TYPE =#{dto.typeId}
  205. </if>
  206. <if test="dto.startTime != null and dto.startTime.trim() != ''">
  207. and to_char(t1.ACCESS_TIME,'yyyy-MM-dd hh:mm:ss') >= #{dto.startTime}
  208. </if>
  209. <if test="dto.endTime != null and dto.endTime.trim() != ''">
  210. <![CDATA[ and to_char(t1.ACCESS_TIME,'yyyy-MM-dd hh:mm:ss') <= #{dto.endTime}]]>
  211. </if>
  212. GROUP BY t1.INTERFACE_ID, t2.NAME, t2.URL, t2.type,t2.OWNERSHIP_SYSTEM,t2.OWNERSHIP_BUSINESS
  213. ) a
  214. </select>
  215. </mapper>