AppMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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.AppMapper">
  4. <insert id="insertOne">
  5. insert into yt_app
  6. (
  7. app_id,
  8. app_key,
  9. app_name,
  10. user_id,
  11. app_type,
  12. apk_url,
  13. qr_code,
  14. version_code,
  15. update_tips,
  16. store_on_sale,
  17. store_type,
  18. package_name,
  19. domain,
  20. category,
  21. sub_category,
  22. coppa,
  23. screen_orientation,
  24. ccpa,
  25. store_url,
  26. ditch_id,
  27. ditch_name,
  28. superior_id,
  29. revenue_display_rate,
  30. enabled
  31. )
  32. values
  33. (
  34. #{appId},
  35. #{appKey},
  36. #{appName},
  37. #{userId},
  38. #{appType},
  39. #{apkUrl},
  40. #{qrCode},
  41. #{versionCode},
  42. #{updateTips},
  43. #{storeOnSale},
  44. #{storeType},
  45. #{packageName},
  46. #{domain},
  47. #{category},
  48. #{subCategory},
  49. #{coppa},
  50. #{screenOrientation},
  51. #{ccpa},
  52. #{storeUrl},
  53. #{ditchId},
  54. #{ditchName},
  55. #{superiorId},
  56. #{revenueDisplayRate},
  57. #{enabled}
  58. )
  59. </insert>
  60. <update id="updateOne">
  61. update yt_app
  62. <set>
  63. <if test="appKey != null">
  64. app_key = #{appKey},
  65. </if>
  66. <if test="appName != null">
  67. app_name = #{appName},
  68. </if>
  69. <if test="appType != null">
  70. app_type = #{appType},
  71. </if>
  72. <if test="versionCode != null">
  73. version_code = #{versionCode},
  74. </if>
  75. <if test="updateTips != null">
  76. update_tips = #{updateTips},
  77. </if>
  78. <if test="enabled != null">
  79. enabled = #{enabled},
  80. </if>
  81. <if test="storeOnSale != null">
  82. store_on_sale = #{storeOnSale},
  83. </if>
  84. <if test="storeType != null">
  85. store_type = #{storeType},
  86. </if>
  87. <if test="storeUrl != null">
  88. store_url = #{storeUrl},
  89. </if>
  90. <if test="packageName != null">
  91. package_name = #{packageName},
  92. </if>
  93. <if test="domain != null">
  94. domain = #{domain},
  95. </if>
  96. <if test="category != null">
  97. category = #{category},
  98. </if>
  99. <if test="subCategory != null">
  100. sub_category = #{subCategory},
  101. </if>
  102. <if test="coppa != null">
  103. coppa = #{coppa},
  104. </if>
  105. <if test="screenOrientation != null">
  106. screen_orientation = #{screenOrientation},
  107. </if>
  108. <if test="ccpa != null">
  109. ccpa = #{ccpa},
  110. </if>
  111. <if test=" apkUrl != null">
  112. apk_url = #{apkUrl},
  113. </if>
  114. <if test="qrCode != null">
  115. qr_code = #{qrCode},
  116. </if>
  117. <if test="ditchId != null">
  118. ditch_id = #{ditchId},
  119. </if>
  120. <if test="ditchName != null">
  121. ditch_name = #{ditchName},
  122. </if>
  123. <if test="revenueDisplayRate != null">
  124. revenue_display_rate = #{revenueDisplayRate},
  125. </if>
  126. <if test="superiorId != null">
  127. superior_id = #{superiorId}
  128. </if>
  129. </set>
  130. where app_id = #{appId}
  131. </update>
  132. <update id="deleteApp">
  133. update yt_app set enabled = 0 where app_id = #{appId}
  134. </update>
  135. <update id="deleteAppIds">
  136. update yt_app set enabled = 0
  137. where app_id in <foreach collection="ids" item="id" open="(" separator="," close=")" >#{id}</foreach>
  138. </update>
  139. <delete id="deleteRisks">
  140. delete from yt_risk_config where config_id in (
  141. select yt_risk_template_config.config_id
  142. from yt_risk_template_config
  143. left join yt_risk_template on yt_risk_template_config.template_id = yt_risk_template.template_id
  144. where yt_risk_template.app_id in <foreach collection="ids" item="appId" open="(" separator="," close=")">#{appId}</foreach>
  145. );
  146. delete from yt_risk_template_config where template_id in (
  147. select yt_risk_template.template_id
  148. from yt_risk_template
  149. where yt_risk_template.app_id in <foreach collection="ids" item="appId" open="(" separator="," close=")">#{appId}</foreach>
  150. );
  151. delete from yt_cofig_app
  152. where app_id in <foreach collection="ids" item="appId" open="(" separator="," close=")">#{appId}</foreach>;
  153. delete from yt_risk_template
  154. where app_id in <foreach collection="ids" item="appId" open="(" separator="," close=")">#{appId}</foreach>;
  155. </delete>
  156. <select id="selectPrimary" resultType="com.ytpm.agent.model.YtApp">
  157. select
  158. app_id,ditch_id, ditch_name, app_key, app_name,user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled,superior_id
  159. from yt_app
  160. where app_id = #{appId}
  161. </select>
  162. <select id="queryAll" resultType="com.ytpm.agent.model.YtApp">
  163. select
  164. app_id, ditch_id, ditch_name, app_key, app_name, user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled, store_on_sale, store_type, store_url, package_name, domain, category, sub_category, coppa, screen_orientation, ccpa, superior_id
  165. from yt_app
  166. where user_id = #{userId}
  167. </select>
  168. <select id="selectByDitchId" resultType="com.ytpm.agent.model.YtApp">
  169. select
  170. app_id, ditch_id, ditch_name, app_key, app_name,user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled,ditch_name,ditch_id
  171. from yt_app
  172. where ditch_id = #{ditchId} and enabled = 1
  173. </select>
  174. <select id="getAppList" resultType="com.ytpm.middle.view.AppListVO">
  175. select
  176. pua.app_id,
  177. pua.app_name,
  178. pua.user_id,
  179. pua.app_type,
  180. pua.detail_url,
  181. pua.package_name,
  182. pua.domain,
  183. pua.issued_time,
  184. pua.wx_app_id,
  185. pua.wx_secret,
  186. me.enterprise_name,
  187. me.legal,
  188. me.concat_phone,
  189. me.credit_code
  190. from yt_platform_user_app pua
  191. left join yt_middle_enterprise me on pua.user_id = me.user_id
  192. <where>
  193. pua.available = 1
  194. <if test="appType != null">
  195. and pua.app_type = #{appType}
  196. </if>
  197. <if test="appName != null and appName!=''">
  198. and pua.app_name like concat('%', #{appName} ,'%')
  199. </if>
  200. </where>
  201. order by
  202. pua.issued_time
  203. </select>
  204. <select id="getByDitchIdAndSuperiorId" resultType="com.ytpm.agent.model.YtApp">
  205. select
  206. app_id, app_key, app_name, user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled, store_on_sale, store_type, store_url, package_name, domain, category, sub_category, coppa, screen_orientation, ccpa, feign_path, ditch_id, ditch_name, superior_id
  207. from yt_app
  208. where superior_id = #{superiorId} and ditch_id = #{ditchId} and enabled = 1
  209. </select>
  210. <select id="getBySuperiorId" resultType="com.ytpm.agent.model.YtApp">
  211. select
  212. app_id, app_key, app_name, user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled, store_on_sale, store_type, store_url, package_name, domain, category, sub_category, coppa, screen_orientation, ccpa, feign_path, ditch_id, ditch_name, superior_id
  213. from yt_app
  214. where superior_id = #{superiorId} and enabled = 1
  215. </select>
  216. <select id="getByAppName" resultType="com.ytpm.agent.model.YtApp">
  217. select
  218. app_id, app_key, app_name, user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled, store_on_sale, store_type, store_url, package_name, domain, category, sub_category, coppa, screen_orientation, ccpa, feign_path, ditch_id, ditch_name, superior_id
  219. from yt_app
  220. where app_name = #{appName} and enabled = 1
  221. </select>
  222. </mapper>