AppMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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.middle.dao.AppMapper">
  4. <insert id="insertOne">
  5. insert into yt_platform_user_app
  6. (
  7. app_id,
  8. app_name,
  9. user_id,
  10. app_type,
  11. detail_url,
  12. package_name,
  13. domain,
  14. issued_time,
  15. wx_app_id,
  16. wx_secret,
  17. sale_price,
  18. create_user_id,
  19. create_time,
  20. available
  21. )
  22. values
  23. (
  24. #{appId},
  25. #{appName},
  26. #{userId},
  27. #{appType},
  28. #{detailUrl},
  29. #{packageName},
  30. #{domain},
  31. #{issuedTime},
  32. #{wxAppId},
  33. #{wxSecret},
  34. #{salePrice},
  35. #{createUserId},
  36. #{createTime},
  37. #{available}
  38. )
  39. </insert>
  40. <insert id="addGrantRecord">
  41. insert into yt_app_grant_record
  42. (
  43. record_id,
  44. app_id,
  45. user_id,
  46. sale_price,
  47. grant_type,
  48. ratio,
  49. data_charge,
  50. grant_time,
  51. operator_id,
  52. operator_time
  53. )
  54. values
  55. (
  56. #{recordId},
  57. #{appId},
  58. #{userId},
  59. #{salePrice},
  60. #{grantType},
  61. #{ratio},
  62. #{dataCharge},
  63. #{grantTime},
  64. #{operatorId},
  65. #{operateTime}
  66. );
  67. </insert>
  68. <update id="updateById">
  69. update yt_platform_user_app
  70. <set>
  71. <if test="appName != null">
  72. app_name = #{appName},
  73. </if>
  74. <if test="userId != null">
  75. user_id = #{userId},
  76. </if>
  77. <if test="appType != null">
  78. app_type = #{appType},
  79. </if>
  80. <if test="detailUrl != null">
  81. detail_url = #{detailUrl},
  82. </if>
  83. <if test="packageName != null">
  84. package_name = #{packageName},
  85. </if>
  86. <if test="domain != null">
  87. domain = #{domain},
  88. </if>
  89. <if test="issuedTime != null">
  90. issued_time = #{issuedTime},
  91. </if>
  92. <if test="wxAppId != null">
  93. wx_app_id = #{wxAppId},
  94. </if>
  95. <if test="wxSecret != null">
  96. wx_secret = #{wxSecret},
  97. </if>
  98. <if test="updateUserId != null">
  99. update_user_id = #{updateUserId},
  100. </if>
  101. <if test="updateTime != null">
  102. update_time = #{updateTime},
  103. </if>
  104. <if test="salePrice != null">
  105. sale_price = #{salePrice},
  106. </if>
  107. <if test="chargeStatus != null">
  108. charge_status = #{chargeStatus},
  109. </if>
  110. <if test="grantType != null">
  111. grant_type = #{grantType},
  112. </if>
  113. <if test="available != null">
  114. available = #{available}
  115. </if>
  116. </set>
  117. where app_id = #{appId}
  118. </update>
  119. <delete id="delApp">
  120. update yt_platform_user_app set available = 0, update_time = now(), update_user_id = #{userId} where app_id = #{appId}
  121. </delete>
  122. <select id="getAppList" resultType="com.ytpm.middle.view.AppListVO">
  123. select
  124. pua.app_id,
  125. pua.app_name,
  126. pua.user_id,
  127. pua.app_type,
  128. pua.detail_url,
  129. pua.package_name,
  130. pua.domain,
  131. pua.sale_price,
  132. pua.grant_type,
  133. pua.issued_time,
  134. pua.wx_app_id,
  135. pua.wx_secret,
  136. me.enterprise_name,
  137. me.legal,
  138. me.concat_phone,
  139. me.credit_code,
  140. me.taku_public_key
  141. from yt_platform_user_app pua
  142. left join yt_middle_enterprise me on pua.user_id = me.user_id
  143. <where>
  144. pua.available = 1
  145. <if test="appType != null">
  146. and pua.app_type = #{appType}
  147. </if>
  148. <if test="appName != null and appName!=''">
  149. and pua.app_name like concat('%', #{appName} ,'%')
  150. </if>
  151. </where>
  152. order by
  153. pua.issued_time
  154. </select>
  155. <select id="getByPackName" resultType="com.ytpm.agent.model.YtPlatformUserApp">
  156. select
  157. app_id, app_name, user_id,sale_price,grant_type, app_type, detail_url, package_name, domain, issued_time, wx_app_id, wx_secret
  158. from yt_platform_user_app
  159. where package_name = #{packageName}
  160. </select>
  161. <select id="getByPrimary" resultType="com.ytpm.agent.model.YtPlatformUserApp">
  162. select
  163. app_id, app_name, user_id,sale_price,grant_type, app_type, detail_url, package_name, domain, issued_time, wx_app_id,wx_secret
  164. from yt_platform_user_app
  165. where app_id = #{appId}
  166. </select>
  167. <select id="getIssuedAppList" resultType="com.ytpm.middle.view.DropDownVO">
  168. select
  169. app_id optionVal,
  170. app_name optionName
  171. from yt_platform_user_app
  172. where available = 1
  173. </select>
  174. <select id="getApkList" resultType="com.ytpm.middle.view.DropDownVO">
  175. select
  176. app_id optionVal,
  177. app_name optionName
  178. from yt_app
  179. where superior_id = #{appId}
  180. </select>
  181. <select id="getAppListByUserIds" resultType="com.ytpm.agent.model.YtPlatformUserApp">
  182. select
  183. app_id, app_name, user_id, app_type, detail_url, package_name, domain, issued_time, wx_app_id, wx_secret, sale_price, grant_type, charge_status, create_time, create_user_id, update_time, update_user_id, available
  184. from yt_platform_user_app
  185. where user_id in
  186. <foreach collection="userIds.split(',')" separator="," item="item" open="(" close=")">
  187. #{item}
  188. </foreach>
  189. </select>
  190. </mapper>