You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

312 lines
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="updateAuthBackInfo" parameterType="com.iformall.domain.po.WxAuthorizerInfo">
  144. update wx_authorizer_info
  145. set `auth_back_num` = `auth_back_num` + 1, `auth_back_time` = #{authBackTime}
  146. where `authorizer_appid` = #{authorizerAppid}
  147. </update>
  148. <update id="removeOpenAppId" parameterType="com.iformall.domain.po.WxAuthorizerInfo">
  149. update wx_authorizer_info
  150. set `open_appid` = null, `bind_open_time` = null
  151. where `authorizer_appid` = #{authorizerAppid}
  152. </update>
  153. <select id="findMp" parameterType="com.iformall.domain.po.WxAuthorizerInfo" resultMap="BaseResultMap">
  154. select
  155. <include refid="allColumns"/>
  156. FROM wx_authorizer_info
  157. where open_appid = (select open_appid from wx_authorizer_info where authorizer_appid = #{authorizerAppid})
  158. and `type` = 3 and `tenant_id` = #{tenantId}
  159. </select>
  160. <select id="findWeChatMp" parameterType="com.iformall.domain.po.WxAuthorizerInfo" resultMap="BaseResultMap">
  161. select
  162. <include refid="allColumns"/>
  163. from wx_authorizer_info
  164. where `authorizer_appid` = #{authorizerAppid}
  165. </select>
  166. <select id="findByAppid" parameterType="string" resultMap="BaseResultMap">
  167. select
  168. <include refid="allColumns"/>
  169. from wx_authorizer_info
  170. where `authorizer_appid` = #{value}
  171. </select>
  172. <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.WxWeappInfo">
  173. <id column="id" jdbcType="BIGINT" property="id"/>
  174. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  175. <result column="type" jdbcType="INTEGER" property="type"/>
  176. <result column="authorizer_appid" jdbcType="VARCHAR" property="authorizerAppid"/>
  177. <result column="head_img" jdbcType="VARCHAR" property="headImg"/>
  178. <result column="alias" jdbcType="VARCHAR" property="alias"/>
  179. <result column="qrcode_url" jdbcType="VARCHAR" property="qrcodeUrl"/>
  180. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  181. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  182. <result column="authorization_status" jdbcType="INTEGER" property="authorizationStatus"/>
  183. <result column="auth_time" jdbcType="TIMESTAMP" property="authTime"/>
  184. <result column="base_status" jdbcType="INTEGER" property="baseStatus"/>
  185. <result column="base_time" jdbcType="TIMESTAMP" property="baseTime"/>
  186. <result column="domain_status" jdbcType="INTEGER" property="domainStatus"/>
  187. <result column="domain_time" jdbcType="TIMESTAMP" property="domainTime"/>
  188. <result column="webdomain_status" jdbcType="INTEGER" property="webdomainStatus"/>
  189. <result column="webdomain_time" jdbcType="TIMESTAMP" property="webdomainTime"/>
  190. <result column="template_status" jdbcType="INTEGER" property="templateStatus"/>
  191. <result column="template_time" jdbcType="TIMESTAMP" property="templateTime"/>
  192. <result column="current_version" jdbcType="VARCHAR" property="currentVersion"/>
  193. <result column="current_desc" jdbcType="VARCHAR" property="currentDesc"/>
  194. <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime"/>
  195. <result column="open_appid" jdbcType="VARCHAR" property="openAppid"/>
  196. <result column="bind_open_time" jdbcType="TIMESTAMP" property="bindOpenTime"/>
  197. <result column="name" jdbcType="VARCHAR" property="name"/>
  198. </resultMap>
  199. <sql id="allVColumns">
  200. ai.`id`,ai.`tenant_id` as `tenant_id`,ai.`type` as `type`,ai.`authorizer_appid`,ai.`head_img`,ai.`alias`,ai.`qrcode_url`,ai.`create_time`,ai.`update_time`,
  201. ai.`authorization_status`,ai.`auth_time`,
  202. ai.`base_status`,ai.`base_time`,
  203. ai.`domain_status`,ai.`domain_time`,
  204. ai.`webdomain_status`,ai.`webdomain_time`,
  205. ai.`template_status`,ai.`template_time`,
  206. ai.`current_version` as `current_version`,ai.`current_desc`,ai.`release_time`,
  207. ai.`open_appid`,ai.`bind_open_time`,
  208. a.`name` as `name`
  209. </sql>
  210. <sql id="dynamicVWhereConditions">
  211. where 1 = 1
  212. <if test=" null != id ">
  213. and ai.`id` = #{id}
  214. </if>
  215. <if test=" null != name ">
  216. and a.`name` like concat('%', #{name},'%')
  217. </if>
  218. <if test=" null != tenantId ">
  219. and ai.`tenant_id` = #{tenantId}
  220. </if>
  221. <if test=" null != type ">
  222. and ai.`type` = #{type}
  223. </if>
  224. <if test=" null != authorizerAppid ">
  225. and ai.`authorizer_appid` = #{authorizerAppid}
  226. </if>
  227. <if test=" null != authorizationStatus ">
  228. and ai.`authorization_status` = #{authorizationStatus}
  229. </if>
  230. <if test=" null != authTime ">
  231. and ai.`auth_time` = #{authTime}
  232. </if>
  233. <if test=" null != baseStatus ">
  234. and ai.`base_status` = #{baseStatus}
  235. </if>
  236. <if test=" null != baseTime ">
  237. and ai.`base_time` = #{baseTime}
  238. </if>
  239. <if test=" null != domainStatus ">
  240. and ai.`domain_status` = #{domainStatus}
  241. </if>
  242. <if test=" null != domainTime ">
  243. and ai.`domain_time` = #{domainTime}
  244. </if>
  245. <if test=" null != webdomainStatus ">
  246. and ai.`webdomain_status` = #{webdomainStatus}
  247. </if>
  248. <if test=" null != webdomainTime ">
  249. and ai.`webdomain_time` = #{webdomainTime}
  250. </if>
  251. <if test=" null != templateStatus ">
  252. and ai.`template_status` = #{templateStatus}
  253. </if>
  254. <if test=" null != templateTime ">
  255. and ai.`template_time` = #{templateTime}
  256. </if>
  257. <if test=" null != currentVersion ">
  258. and ai.`current_version` = #{currentVersion}
  259. </if>
  260. <if test=" null != openAppid ">
  261. and ai.`open_appid` = #{openAppid}
  262. </if>
  263. <if test=" null != ids ">
  264. and ai.id in
  265. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  266. #{idItem}
  267. </foreach>
  268. </if>
  269. <if test=" null != sortColumns">order by ${sortColumns}</if>
  270. </sql>
  271. <select id="findVoList" parameterType="com.iformall.domain.vo.WxWeappInfo" resultMap="VBaseResultMap">
  272. select
  273. <include refid="allVColumns"/>
  274. from wx_authorizer_info ai
  275. left join wx_appinfo a on ai.`authorizer_appid` = a.app_id
  276. <include refid="dynamicVWhereConditions"/>
  277. </select>
  278. <select id="findWeappList" resultMap="VBaseResultMap">
  279. select
  280. <include refid="allVColumns"/>
  281. from wx_authorizer_info ai
  282. left join wx_appinfo a on ai.`authorizer_appid` = a.app_id
  283. where a.type = 1 or a.type = 2
  284. </select>
  285. <select id="findWxMpList" resultMap="VBaseResultMap">
  286. select
  287. <include refid="allVColumns"/>
  288. from wx_authorizer_info ai
  289. left join wx_appinfo a on ai.`authorizer_appid` = a.app_id
  290. where a.type = 3 or a.type = 4
  291. </select>
  292. </mapper>