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.

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