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.

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