RiskManageMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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.ytpm.dao.RiskManageMapper">
  4. <insert id="addDeblockingRecord">
  5. insert into yt_platform_deblocking
  6. (
  7. deblocking_id,
  8. banned_id,
  9. user_id,
  10. app_id,
  11. channel_id,
  12. deblocking_time,
  13. deblocking_reason,
  14. operator,
  15. operator_name
  16. )
  17. values
  18. (
  19. #{deblockingId},
  20. #{bannedId},
  21. #{userId},
  22. #{appId},
  23. #{channelId},
  24. #{deblockingTime},
  25. #{deblockingReason},
  26. #{operator},
  27. #{operatorName}
  28. )
  29. </insert>
  30. <insert id="relativeApps" parameterType="com.ytpm.risk.param.RiskRelativeAppParam">
  31. insert into yt_cofig_app
  32. (
  33. template_id,
  34. app_id,
  35. app_name,
  36. operator,
  37. operator_name,
  38. operator_time
  39. )
  40. values
  41. <foreach collection="appList" separator="," index="index" item="item">
  42. (
  43. #{templateId},
  44. #{item.appId},
  45. #{item.appName},
  46. #{operator},
  47. #{operatorName},
  48. now()
  49. )
  50. </foreach>
  51. </insert>
  52. <delete id="deleteRelatives">
  53. delete from yt_cofig_app where template_id = #{templateId}
  54. </delete>
  55. <select id="getDeblockingList" resultType="com.ytpm.risk.view.RiskDeblockingListView">
  56. SELECT
  57. pd.deblocking_id,
  58. pd.banned_id,
  59. pd.user_id,
  60. pd.channel_id,
  61. pd.deblocking_time,
  62. pd.deblocking_reason,
  63. pd.operator,
  64. pd.operator_name,
  65. a.app_id,
  66. a.app_name
  67. FROM
  68. yt_platform_deblocking pd
  69. JOIN yt_app a ON pd.app_id = a.app_id
  70. WHERE
  71. pd.channel_id = #{channelId}
  72. <if test="appId != null and appId != ''">
  73. and a.app_id = #{appId}
  74. </if>
  75. <if test="deblockingReason != null and deblockingReason != ''">
  76. and pd.deblocking_reason like concat('%',#{deblockingReason},'%')
  77. </if>
  78. <if test="deblockingTimeBegin != null">
  79. and DATE_FORMAT(pd.deblocking_time,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{deblockingTimeBegin}, '%Y-%m-%d')
  80. </if>
  81. <if test="deblockingTimeEnd != null">
  82. and DATE_FORMAT(pd.deblocking_time,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{deblockingTimeEnd}, '%Y-%m-%d')
  83. </if>
  84. ORDER BY pd.deblocking_time DESC
  85. </select>
  86. <select id="getBannedList" resultType="com.ytpm.risk.view.RiskBannedListView">
  87. SELECT
  88. pb.banned_id,
  89. # au.platform_id,
  90. # au.channel_id,
  91. # au.user_id,
  92. # au.nick_name,
  93. # au.registry_time,
  94. # au.last_login_ip,
  95. # au.last_login_time,
  96. # au.user_status,
  97. pb.banned_time,
  98. pb.banned_reason,
  99. # au.channel_type,
  100. # au.channel_origin,
  101. pb.banned_type,
  102. pb.banned_limit,
  103. pb.operator,
  104. pb.operator_name,
  105. pb.user_id,
  106. a.app_id,
  107. a.app_name
  108. FROM
  109. yt_platform_banned pb
  110. JOIN yt_app a ON pb.app_id = a.app_id
  111. WHERE
  112. pb.channel_id = #{channelId}
  113. <if test="appId != null and appId != ''">
  114. and a.app_id = #{appId}
  115. </if>
  116. <if test="bannedReason != null and bannedReason != ''">
  117. and pb.banned_reason like concat('%',#{bannedReason},'%')
  118. </if>
  119. <if test="bannedTimeBegin != null">
  120. and DATE_FORMAT(pb.banned_time,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{bannedTimeBegin}, '%Y-%m-%d')
  121. </if>
  122. <if test="bannedTimeEnd != null">
  123. and DATE_FORMAT(pb.banned_time,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{bannedTimeEnd}, '%Y-%m-%d')
  124. </if>
  125. ORDER BY pb.banned_time DESC
  126. </select>
  127. <select id="getLastBanned" resultType="com.ytpm.agent.model.YtPlatformBanned">
  128. select
  129. banned_id, user_id, channel_id, banned_time, banned_reason, banned_type, banned_limit, operator, operator_name
  130. from yt_platform_banned
  131. where user_id = #{userId}
  132. order by banned_time desc
  133. limit 1
  134. </select>
  135. <select id="queryBannedRecord" resultType="com.ytpm.agent.model.YtPlatformBanned">
  136. select
  137. banned_id, user_id, channel_id, banned_time, banned_reason, banned_type, banned_limit, operator, operator_name
  138. from yt_platform_banned
  139. <where>
  140. <if test="startTime != null">
  141. AND banned_time >= #{startTime}
  142. </if>
  143. <if test="endTime != null">
  144. AND banned_time &lt;= #{endTime}
  145. </if>
  146. </where>
  147. </select>
  148. </mapper>