DataSourceConfigMapper.xml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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="com.ufo.project.datasource.mapper.DataSourceConfigMapper">
  6. <resultMap type="DataSourceConfig" id="DataSourceConfigResult">
  7. <result property="id" column="id" />
  8. <result property="sourceName" column="source_name" />
  9. <result property="sourceAlias" column="source_alias" />
  10. <result property="sourceKey" column="source_key" />
  11. <result property="sourceType" column="source_type" />
  12. <result property="protocol" column="protocol" />
  13. <result property="supplierId" column="supplier_id" />
  14. <result property="protocolExtendedConfig" column="protocol_extended_config" />
  15. <result property="isSecure" column="is_secure" />
  16. <result property="secureConfig" column="secure_config" />
  17. <result property="maxConcurrency" column="max_concurrency" />
  18. <result property="receptionTime" column="reception_time" />
  19. <result property="dataActivePollInterval" column="data_active_poll_interval" />
  20. <result property="dataInactivityPollInterval" column="data_inactivity_poll_interval" />
  21. <result property="isDel" column="is_del" />
  22. <result property="createBy" column="create_by" />
  23. <result property="createTime" column="create_time" />
  24. <result property="updateBy" column="update_by" />
  25. <result property="updateTime" column="update_time" />
  26. <result property="grabDays" column="grab_days" />
  27. <result property="topicName" column="topic_name" />
  28. </resultMap>
  29. <sql id="selectDataSourceConfigVo">
  30. select id, source_name, source_alias, source_key, source_type, protocol, supplier_id, protocol_extended_config, is_secure, secure_config, max_concurrency, reception_time, data_active_poll_interval, data_inactivity_poll_interval, is_del, create_by, create_time, update_by, update_time, grab_days, topic_name from data_source_config
  31. </sql>
  32. <select id="selectDataSourceConfigList" parameterType="DataSourceConfig" resultMap="DataSourceConfigResult">
  33. <include refid="selectDataSourceConfigVo"/>
  34. <where>
  35. <if test="sourceName != null and sourceName != ''"> and source_name like concat('%', #{sourceName}, '%')</if>
  36. <if test="sourceAlias != null and sourceAlias != ''"> and source_alias = #{sourceAlias}</if>
  37. <if test="sourceKey != null and sourceKey != ''"> and source_key = #{sourceKey}</if>
  38. <if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType}</if>
  39. <if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
  40. <if test="supplierId != null "> and supplier_id = #{supplierId}</if>
  41. <if test="protocolExtendedConfig != null and protocolExtendedConfig != ''"> and protocol_extended_config = #{protocolExtendedConfig}</if>
  42. <if test="isSecure != null and isSecure != ''"> and is_secure = #{isSecure}</if>
  43. <if test="secureConfig != null and secureConfig != ''"> and secure_config = #{secureConfig}</if>
  44. <if test="maxConcurrency != null "> and max_concurrency = #{maxConcurrency}</if>
  45. <if test="receptionTime != null and receptionTime != ''"> and reception_time = #{receptionTime}</if>
  46. <if test="dataActivePollInterval != null "> and data_active_poll_interval = #{dataActivePollInterval}</if>
  47. <if test="dataInactivityPollInterval != null "> and data_inactivity_poll_interval = #{dataInactivityPollInterval}</if>
  48. <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
  49. <if test="grabDays != null "> and grab_days = #{grabDays}</if>
  50. <if test="topicName != null and topicName != ''"> and topic_name like concat('%', #{topicName}, '%')</if>
  51. </where>
  52. </select>
  53. <select id="selectDataSourceConfigById" parameterType="Long" resultMap="DataSourceConfigResult">
  54. <include refid="selectDataSourceConfigVo"/>
  55. where id = #{id}
  56. </select>
  57. <insert id="insertDataSourceConfig" parameterType="DataSourceConfig" useGeneratedKeys="true" keyProperty="id">
  58. insert into data_source_config
  59. <trim prefix="(" suffix=")" suffixOverrides=",">
  60. <if test="sourceName != null and sourceName != ''">source_name,</if>
  61. <if test="sourceAlias != null and sourceAlias != ''">source_alias,</if>
  62. <if test="sourceKey != null and sourceKey != ''">source_key,</if>
  63. <if test="sourceType != null and sourceType != ''">source_type,</if>
  64. <if test="protocol != null and protocol != ''">protocol,</if>
  65. <if test="supplierId != null">supplier_id,</if>
  66. <if test="protocolExtendedConfig != null">protocol_extended_config,</if>
  67. <if test="isSecure != null and isSecure != ''">is_secure,</if>
  68. <if test="secureConfig != null">secure_config,</if>
  69. <if test="maxConcurrency != null">max_concurrency,</if>
  70. <if test="receptionTime != null">reception_time,</if>
  71. <if test="dataActivePollInterval != null">data_active_poll_interval,</if>
  72. <if test="dataInactivityPollInterval != null">data_inactivity_poll_interval,</if>
  73. <if test="isDel != null and isDel != ''">is_del,</if>
  74. <if test="createBy != null and createBy != ''">create_by,</if>
  75. <if test="createTime != null">create_time,</if>
  76. <if test="updateBy != null and updateBy != ''">update_by,</if>
  77. <if test="updateTime != null">update_time,</if>
  78. <if test="grabDays != null">grab_days,</if>
  79. <if test="topicName != null">topic_name,</if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test="sourceName != null and sourceName != ''">#{sourceName},</if>
  83. <if test="sourceAlias != null and sourceAlias != ''">#{sourceAlias},</if>
  84. <if test="sourceKey != null and sourceKey != ''">#{sourceKey},</if>
  85. <if test="sourceType != null and sourceType != ''">#{sourceType},</if>
  86. <if test="protocol != null and protocol != ''">#{protocol},</if>
  87. <if test="supplierId != null">#{supplierId},</if>
  88. <if test="protocolExtendedConfig != null">#{protocolExtendedConfig},</if>
  89. <if test="isSecure != null and isSecure != ''">#{isSecure},</if>
  90. <if test="secureConfig != null">#{secureConfig},</if>
  91. <if test="maxConcurrency != null">#{maxConcurrency},</if>
  92. <if test="receptionTime != null">#{receptionTime},</if>
  93. <if test="dataActivePollInterval != null">#{dataActivePollInterval},</if>
  94. <if test="dataInactivityPollInterval != null">#{dataInactivityPollInterval},</if>
  95. <if test="isDel != null and isDel != ''">#{isDel},</if>
  96. <if test="createBy != null and createBy != ''">#{createBy},</if>
  97. <if test="createTime != null">#{createTime},</if>
  98. <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
  99. <if test="updateTime != null">#{updateTime},</if>
  100. <if test="grabDays != null">#{grabDays},</if>
  101. <if test="topicName != null">#{topicName},</if>
  102. </trim>
  103. </insert>
  104. <update id="updateDataSourceConfig" parameterType="DataSourceConfig">
  105. update data_source_config
  106. <trim prefix="SET" suffixOverrides=",">
  107. <if test="sourceName != null and sourceName != ''">source_name = #{sourceName},</if>
  108. <if test="sourceAlias != null and sourceAlias != ''">source_alias = #{sourceAlias},</if>
  109. <if test="sourceKey != null and sourceKey != ''">source_key = #{sourceKey},</if>
  110. <if test="sourceType != null and sourceType != ''">source_type = #{sourceType},</if>
  111. <if test="protocol != null and protocol != ''">protocol = #{protocol},</if>
  112. <if test="supplierId != null">supplier_id = #{supplierId},</if>
  113. <if test="protocolExtendedConfig != null">protocol_extended_config = #{protocolExtendedConfig},</if>
  114. <if test="isSecure != null and isSecure != ''">is_secure = #{isSecure},</if>
  115. <if test="secureConfig != null">secure_config = #{secureConfig},</if>
  116. <if test="maxConcurrency != null">max_concurrency = #{maxConcurrency},</if>
  117. <if test="receptionTime != null">reception_time = #{receptionTime},</if>
  118. <if test="dataActivePollInterval != null">data_active_poll_interval = #{dataActivePollInterval},</if>
  119. <if test="dataInactivityPollInterval != null">data_inactivity_poll_interval = #{dataInactivityPollInterval},</if>
  120. <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
  121. <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
  122. <if test="createTime != null">create_time = #{createTime},</if>
  123. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  124. <if test="updateTime != null">update_time = #{updateTime},</if>
  125. <if test="grabDays != null">grab_days = #{grabDays},</if>
  126. <if test="topicName != null">topic_name = #{topicName},</if>
  127. </trim>
  128. where id = #{id}
  129. </update>
  130. <delete id="deleteDataSourceConfigById" parameterType="Long">
  131. delete from data_source_config where id = #{id}
  132. </delete>
  133. <delete id="deleteDataSourceConfigByIds" parameterType="String">
  134. delete from data_source_config where id in
  135. <foreach item="id" collection="array" open="(" separator="," close=")">
  136. #{id}
  137. </foreach>
  138. </delete>
  139. </mapper>