RiskManageMapper.xml 5.2 KB

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