RiskManageMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. au.platform_id,
  52. au.channel_id,
  53. au.user_id,
  54. au.nick_name,
  55. au.registry_time,
  56. au.last_login_time,
  57. au.user_status,
  58. pd.deblocking_time,
  59. pd.deblocking_reason,
  60. au.channel_type,
  61. au.channel_origin,
  62. pd.operator,
  63. pd.operator_name
  64. FROM
  65. yt_platform_deblocking pd
  66. JOIN yt_app_user au ON pd.user_id = au.user_id
  67. WHERE
  68. pd.channel_id = #{channelId}
  69. <if test="appId != null and appId != ''">
  70. and au.app_id = #{appId}
  71. </if>
  72. <if test="deblockingReason != null and deblockingReason != ''">
  73. and pd.deblocking_reason like concat('%',#{deblockingReason},'%')
  74. </if>
  75. <if test="channelType != null">
  76. and au.channel_type = #{channelType}
  77. </if>
  78. <if test="channelOrigin != null">
  79. and au.channel_origin = #{channelOrigin}
  80. </if>
  81. <if test="deblockingTimeBegin != null">
  82. and DATE_FORMAT(pd.deblocking_time,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{deblockingTimeBegin}, '%Y-%m-%d')
  83. </if>
  84. <if test="deblockingTimeEnd != null">
  85. and DATE_FORMAT(pd.deblocking_time,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{deblockingTimeEnd}, '%Y-%m-%d')
  86. </if>
  87. <if test="loginTimeBegin != null">
  88. and DATE_FORMAT(au.last_login_time,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{loginTimeBegin}, '%Y-%m-%d')
  89. </if>
  90. <if test="loginTimeEnd != null">
  91. and DATE_FORMAT(au.last_login_time,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{loginTimeEnd}, '%Y-%m-%d')
  92. </if>
  93. </select>
  94. <select id="getBannedList" resultType="com.ytpm.risk.view.RiskBannedListView">
  95. SELECT
  96. au.platform_id,
  97. au.channel_id,
  98. au.user_id,
  99. au.nick_name,
  100. au.registry_time,
  101. au.last_login_time,
  102. au.user_status,
  103. pb.banned_time,
  104. pb.banned_reason,
  105. au.channel_type,
  106. au.channel_origin,
  107. pb.banned_type,
  108. pb.banned_limit,
  109. pb.operator,
  110. pb.operator_name
  111. FROM
  112. yt_platform_banned pb
  113. JOIN yt_app_user au ON pb.user_id = au.user_id
  114. WHERE
  115. pb.channel_id = #{channelId}
  116. <if test="appId != null and appId != ''">
  117. and au.app_id = #{appId}
  118. </if>
  119. <if test="bannedReason != null and bannedReason != ''">
  120. and pb.banned_reason like concat('%',#{bannedReason},'%')
  121. </if>
  122. <if test="channelType != null">
  123. and au.channel_type = #{channelType}
  124. </if>
  125. <if test="channelOrigin != null">
  126. and au.channel_origin = #{channelOrigin}
  127. </if>
  128. <if test="bannedTimeBegin != null">
  129. and DATE_FORMAT(pb.banned_time,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{bannedTimeBegin}, '%Y-%m-%d')
  130. </if>
  131. <if test="bannedTimeEnd != null">
  132. and DATE_FORMAT(pb.banned_time,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{bannedTimeEnd}, '%Y-%m-%d')
  133. </if>
  134. </select>
  135. <select id="getLastBanned" 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 user_id = #{userId}
  140. order by banned_time desc
  141. limit 1
  142. </select>
  143. </mapper>