Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

306 linhas
14 KiB

  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.iformall.mapper.WxAuthorizerInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxAuthorizerInfo">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="type" jdbcType="INTEGER" property="type"/>
  8. <result column="authorizer_appid" jdbcType="VARCHAR" property="authorizerAppid"/>
  9. <result column="head_img" jdbcType="VARCHAR" property="headImg"/>
  10. <result column="alias" jdbcType="VARCHAR" property="alias"/>
  11. <result column="qrcode_url" jdbcType="VARCHAR" property="qrcodeUrl"/>
  12. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  13. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  14. <result column="authorization_status" jdbcType="INTEGER" property="authorizationStatus"/>
  15. <result column="auth_time" jdbcType="TIMESTAMP" property="authTime"/>
  16. <result column="base_status" jdbcType="INTEGER" property="baseStatus"/>
  17. <result column="base_time" jdbcType="TIMESTAMP" property="baseTime"/>
  18. <result column="domain_status" jdbcType="INTEGER" property="domainStatus"/>
  19. <result column="domain_time" jdbcType="TIMESTAMP" property="domainTime"/>
  20. <result column="webdomain_status" jdbcType="INTEGER" property="webdomainStatus"/>
  21. <result column="webdomain_time" jdbcType="TIMESTAMP" property="webdomainTime"/>
  22. <result column="template_status" jdbcType="INTEGER" property="templateStatus"/>
  23. <result column="template_time" jdbcType="TIMESTAMP" property="templateTime"/>
  24. <result column="current_version" jdbcType="VARCHAR" property="currentVersion"/>
  25. <result column="current_desc" jdbcType="VARCHAR" property="currentDesc"/>
  26. <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime"/>
  27. <result column="open_appid" jdbcType="VARCHAR" property="openAppid"/>
  28. <result column="bind_open_time" jdbcType="TIMESTAMP" property="bindOpenTime"/>
  29. <result column="refresh_token" jdbcType="VARCHAR" property="refreshToken"/>
  30. <result column="access_token" jdbcType="VARCHAR" property="accessToken"/>
  31. <result column="access_token_expire" jdbcType="TIMESTAMP" property="accessTokenExpire"/>
  32. </resultMap>
  33. <sql id="allColumns">
  34. `id`,`tenant_id`,`type`,`authorizer_appid`,`head_img`,`alias`,`qrcode_url`,`create_time`,`authorization_status`,`auth_time`,
  35. `base_status`, `base_time`, `domain_status`, `domain_time`, `webdomain_status`, `webdomain_time`, `template_status`, `template_time`,
  36. `current_version`,`current_desc`,`release_time`,
  37. `open_appid`,`bind_open_time`,`refresh_token`,
  38. `access_token`,`access_token_expire`
  39. </sql>
  40. <sql id="dynamicWhereConditions">
  41. where 1 = 1
  42. <if test=" null != id ">
  43. and `id` = #{id}
  44. </if>
  45. <if test=" null != tenantId ">
  46. and `tenant_id` = #{tenantId}
  47. </if>
  48. <if test=" null != type ">
  49. and `type` = #{type}
  50. </if>
  51. <if test=" null != authorizerAppid ">
  52. and `authorizer_appid` = #{authorizerAppid}
  53. </if>
  54. <if test=" null != headImg ">
  55. and `head_img` like concat('%', #{headImg},'%')
  56. </if>
  57. <if test=" null != alias ">
  58. and `alias` like concat('%', #{alias},'%')
  59. </if>
  60. <if test=" null != qrcodeUrl ">
  61. and `qrcode_url` like concat('%', #{qrcodeUrl},'%')
  62. </if>
  63. <if test=" null != createTime ">
  64. and `create_time` = #{createTime}
  65. </if>
  66. <if test=" null != updateTime ">
  67. and `update_time` = #{updateTime}
  68. </if>
  69. <if test=" null != authorizationStatus ">
  70. and `authorization_status` = #{authorizationStatus}
  71. </if>
  72. <if test=" null != authTime ">
  73. and `auth_time` = #{authTime}
  74. </if>
  75. <if test=" null != baseStatus ">
  76. and `base_status` = #{baseStatus}
  77. </if>
  78. <if test=" null != baseTime ">
  79. and `base_time` = #{baseTime}
  80. </if>
  81. <if test=" null != domainStatus ">
  82. and `domain_status` = #{domainStatus}
  83. </if>
  84. <if test=" null != domainTime ">
  85. and `domain_time` = #{domainTime}
  86. </if>
  87. <if test=" null != webdomainStatus ">
  88. and `webdomain_status` = #{webdomainStatus}
  89. </if>
  90. <if test=" null != webdomainTime ">
  91. and `webdomain_time` = #{webdomainTime}
  92. </if>
  93. <if test=" null != templateStatus ">
  94. and `template_status` = #{templateStatus}
  95. </if>
  96. <if test=" null != templateTime ">
  97. and `template_time` = #{templateTime}
  98. </if>
  99. <if test=" null != currentVersion ">
  100. and `current_version` = #{currentVersion}
  101. </if>
  102. <if test=" null != currentDesc ">
  103. and `current_desc` like concat('%', #{currentDesc},'%')
  104. </if>
  105. <if test=" null != releaseTime ">
  106. and `release_time` = #{releaseTime}
  107. </if>
  108. <if test=" null != openAppid ">
  109. and `open_appid` = #{openAppid}
  110. </if>
  111. <if test=" null != bindOpenTime ">
  112. and `bind_open_time` = #{bindOpenTime}
  113. </if>
  114. <if test=" null != ids ">
  115. and id in
  116. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  117. #{idItem}
  118. </foreach>
  119. </if>
  120. <if test=" null != sortColumns">order by ${sortColumns}</if>
  121. </sql>
  122. <select id="findList" parameterType="com.iformall.domain.po.WxAuthorizerInfo" resultMap="BaseResultMap">
  123. select
  124. <include refid="allColumns"/>
  125. from wx_authorizer_info
  126. <include refid="dynamicWhereConditions"/>
  127. </select>
  128. <update id="updateReleaseInfo" parameterType="com.iformall.domain.po.WxAuthorizerInfo">
  129. update wx_authorizer_info
  130. set `current_version` = #{currentVersion}, `current_desc` = #{currentDesc}, `release_time` = #{releaseTime}, `update_time` = #{updateTime}
  131. where `authorizer_appid` = #{authorizerAppid}
  132. </update>
  133. <update id="updateRefreshToken" parameterType="com.iformall.domain.po.WxAuthorizerInfo">
  134. update wx_authorizer_info
  135. set `refresh_token` = #{refreshToken}
  136. where `authorizer_appid` = #{authorizerAppid}
  137. </update>
  138. <update id="updateAccessToken" parameterType="com.iformall.domain.po.WxAuthorizerInfo">
  139. update wx_authorizer_info
  140. set `access_token` = #{accessToken}, `access_token_expire` = #{accessTokenExpire}
  141. where `authorizer_appid` = #{authorizerAppid}
  142. </update>
  143. <update id="removeOpenAppId" parameterType="com.iformall.domain.po.WxAuthorizerInfo">
  144. update wx_authorizer_info
  145. set `open_appid` = null, `bind_open_time` = null
  146. where `authorizer_appid` = #{authorizerAppid}
  147. </update>
  148. <select id="findMp" parameterType="com.iformall.domain.po.WxAuthorizerInfo" resultMap="BaseResultMap">
  149. select
  150. <include refid="allColumns"/>
  151. FROM wx_authorizer_info
  152. where open_appid = (select open_appid from wx_authorizer_info where authorizer_appid = #{authorizerAppid})
  153. and `type` = 3 and `tenant_id` = #{tenantId}
  154. </select>
  155. <select id="findWeChatMp" parameterType="com.iformall.domain.po.WxAuthorizerInfo" resultMap="BaseResultMap">
  156. select
  157. <include refid="allColumns"/>
  158. from wx_authorizer_info
  159. where `authorizer_appid` = #{authorizerAppid}
  160. </select>
  161. <select id="findByAppid" parameterType="string" resultMap="BaseResultMap">
  162. select
  163. <include refid="allColumns"/>
  164. from wx_authorizer_info
  165. where `authorizer_appid` = #{value}
  166. </select>
  167. <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.WxWeappInfo">
  168. <id column="id" jdbcType="BIGINT" property="id"/>
  169. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  170. <result column="type" jdbcType="INTEGER" property="type"/>
  171. <result column="authorizer_appid" jdbcType="VARCHAR" property="authorizerAppid"/>
  172. <result column="head_img" jdbcType="VARCHAR" property="headImg"/>
  173. <result column="alias" jdbcType="VARCHAR" property="alias"/>
  174. <result column="qrcode_url" jdbcType="VARCHAR" property="qrcodeUrl"/>
  175. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  176. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  177. <result column="authorization_status" jdbcType="INTEGER" property="authorizationStatus"/>
  178. <result column="auth_time" jdbcType="TIMESTAMP" property="authTime"/>
  179. <result column="base_status" jdbcType="INTEGER" property="baseStatus"/>
  180. <result column="base_time" jdbcType="TIMESTAMP" property="baseTime"/>
  181. <result column="domain_status" jdbcType="INTEGER" property="domainStatus"/>
  182. <result column="domain_time" jdbcType="TIMESTAMP" property="domainTime"/>
  183. <result column="webdomain_status" jdbcType="INTEGER" property="webdomainStatus"/>
  184. <result column="webdomain_time" jdbcType="TIMESTAMP" property="webdomainTime"/>
  185. <result column="template_status" jdbcType="INTEGER" property="templateStatus"/>
  186. <result column="template_time" jdbcType="TIMESTAMP" property="templateTime"/>
  187. <result column="current_version" jdbcType="VARCHAR" property="currentVersion"/>
  188. <result column="current_desc" jdbcType="VARCHAR" property="currentDesc"/>
  189. <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime"/>
  190. <result column="open_appid" jdbcType="VARCHAR" property="openAppid"/>
  191. <result column="bind_open_time" jdbcType="TIMESTAMP" property="bindOpenTime"/>
  192. <result column="name" jdbcType="VARCHAR" property="name"/>
  193. </resultMap>
  194. <sql id="allVColumns">
  195. ai.`id`,ai.`tenant_id`,ai.`type`,ai.`authorizer_appid`,ai.`head_img`,ai.`alias`,ai.`qrcode_url`,ai.`create_time`,ai.`update_time`,
  196. ai.`authorization_status`,ai.`auth_time`,
  197. ai.`base_status`,ai.`base_time`,
  198. ai.`domain_status`,ai.`domain_time`,
  199. ai.`webdomain_status`,ai.`webdomain_time`,
  200. ai.`template_status`,ai.`template_time`,
  201. ai.`current_version`,ai.`current_desc`,ai.`release_time`,
  202. ai.`open_appid`,ai.`bind_open_time`,
  203. a.`name`
  204. </sql>
  205. <sql id="dynamicVWhereConditions">
  206. where 1 = 1
  207. <if test=" null != id ">
  208. and ai.`id` = #{id}
  209. </if>
  210. <if test=" null != name ">
  211. and a.`name` like concat('%', #{name},'%')
  212. </if>
  213. <if test=" null != tenantId ">
  214. and ai.`tenant_id` = #{tenantId}
  215. </if>
  216. <if test=" null != type ">
  217. and ai.`type` = #{type}
  218. </if>
  219. <if test=" null != authorizerAppid ">
  220. and ai.`authorizer_appid` = #{authorizerAppid}
  221. </if>
  222. <if test=" null != authorizationStatus ">
  223. and ai.`authorization_status` = #{authorizationStatus}
  224. </if>
  225. <if test=" null != authTime ">
  226. and ai.`auth_time` = #{authTime}
  227. </if>
  228. <if test=" null != baseStatus ">
  229. and ai.`base_status` = #{baseStatus}
  230. </if>
  231. <if test=" null != baseTime ">
  232. and ai.`base_time` = #{baseTime}
  233. </if>
  234. <if test=" null != domainStatus ">
  235. and ai.`domain_status` = #{domainStatus}
  236. </if>
  237. <if test=" null != domainTime ">
  238. and ai.`domain_time` = #{domainTime}
  239. </if>
  240. <if test=" null != webdomainStatus ">
  241. and ai.`webdomain_status` = #{webdomainStatus}
  242. </if>
  243. <if test=" null != webdomainTime ">
  244. and ai.`webdomain_time` = #{webdomainTime}
  245. </if>
  246. <if test=" null != templateStatus ">
  247. and ai.`template_status` = #{templateStatus}
  248. </if>
  249. <if test=" null != templateTime ">
  250. and ai.`template_time` = #{templateTime}
  251. </if>
  252. <if test=" null != currentVersion ">
  253. and ai.`current_version` = #{currentVersion}
  254. </if>
  255. <if test=" null != openAppid ">
  256. and ai.`open_appid` = #{openAppid}
  257. </if>
  258. <if test=" null != ids ">
  259. and ai.id in
  260. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  261. #{idItem}
  262. </foreach>
  263. </if>
  264. <if test=" null != sortColumns">order by ${sortColumns}</if>
  265. </sql>
  266. <select id="findVoList" parameterType="com.iformall.domain.vo.WxWeappInfo" resultMap="VBaseResultMap">
  267. select
  268. <include refid="allVColumns"/>
  269. from wx_authorizer_info ai
  270. left join wx_appinfo a on ai.`authorizer_appid` = a.app_id
  271. <include refid="dynamicVWhereConditions"/>
  272. </select>
  273. <select id="findWeappList" resultMap="VBaseResultMap">
  274. select
  275. <include refid="allVColumns"/>
  276. from wx_authorizer_info ai
  277. left join wx_appinfo a on ai.`authorizer_appid` = a.app_id
  278. where a.type = 1 or a.type = 2
  279. </select>
  280. <select id="findWxMpList" resultMap="VBaseResultMap">
  281. select
  282. <include refid="allVColumns"/>
  283. from wx_authorizer_info ai
  284. left join wx_appinfo a on ai.`authorizer_appid` = a.app_id
  285. where a.type = 3 or a.type = 4
  286. </select>
  287. </mapper>