AppMapper.xml 8.0 KB

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