XsyAccountMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.xiaoshouyi.mapper.XsyAccountMapper">
  6. <select id="selectList" resultType="com.fs.xiaoshouyi.domain.XsyAccount">
  7. select
  8. id,
  9. account_name as accountName,
  10. client_id as clientId,
  11. client_secret as clientSecret,
  12. redirect_uri as redirectUri,
  13. instance_uri as instanceUri,
  14. access_token as accessToken,
  15. refresh_token as refreshToken,
  16. expires_at as expiresAt,
  17. refresh_token_expires_at as refreshTokenExpiresAt,
  18. status,
  19. create_time as createTime,
  20. update_time as updateTime
  21. from xsy_account
  22. <where>
  23. <if test="clientId != null and clientId != ''">
  24. and client_id like concat('%', #{clientId}, '%')
  25. </if>
  26. <if test="status != null">
  27. and status = #{status}
  28. </if>
  29. <if test="accountName != null and accountName != ''">
  30. and account_name like concat('%', #{accountName}, '%')
  31. </if>
  32. </where>
  33. order by id desc
  34. </select>
  35. <!-- 查询单个 -->
  36. <select id="selectById" resultType="com.fs.xiaoshouyi.domain.XsyAccount">
  37. select
  38. id,
  39. account_name as accountName,
  40. client_id as clientId,
  41. client_secret as clientSecret,
  42. redirect_uri as redirectUri,
  43. instance_uri as instanceUri,
  44. access_token as accessToken,
  45. refresh_token as refreshToken,
  46. expires_at as expiresAt,
  47. refresh_token_expires_at as refreshTokenExpiresAt,
  48. status,
  49. create_time as createTime,
  50. update_time as updateTime
  51. from xsy_account
  52. where id = #{id}
  53. </select>
  54. <select id="selectListByIds" resultType="com.fs.xiaoshouyi.domain.XsyAccount">
  55. select
  56. id,
  57. account_name as accountName,
  58. client_id as clientId,
  59. client_secret as clientSecret,
  60. redirect_uri as redirectUri,
  61. instance_uri as instanceUri,
  62. access_token as accessToken,
  63. refresh_token as refreshToken,
  64. expires_at as expiresAt,
  65. refresh_token_expires_at as refreshTokenExpiresAt,
  66. status,
  67. create_time as createTime,
  68. update_time as updateTime
  69. from xsy_account
  70. where id in
  71. <foreach collection="ids" item="id" open="(" separator="," close=")">
  72. #{id}
  73. </foreach>
  74. </select>
  75. <!-- 新增 -->
  76. <insert id="insert" parameterType="com.fs.xiaoshouyi.domain.XsyAccount">
  77. insert into xsy_account (
  78. id,
  79. account_name,
  80. client_id,
  81. client_secret,
  82. redirect_uri,
  83. status,
  84. create_time,
  85. send_user_id
  86. ) values (
  87. #{id},
  88. #{accountName},
  89. #{clientId},
  90. #{clientSecret},
  91. #{redirectUri},
  92. #{status},
  93. now(),
  94. #{sendUserId}
  95. )
  96. </insert>
  97. <!-- 修改 -->
  98. <update id="update" parameterType="com.fs.xiaoshouyi.domain.XsyAccount">
  99. update xsy_account
  100. <set>
  101. <if test="accountName != null">account_name = #{accountName},</if>
  102. <if test="clientId != null">client_id = #{clientId},</if>
  103. <if test="clientSecret != null">client_secret = #{clientSecret},</if>
  104. <if test="redirectUri != null">redirect_uri = #{redirectUri},</if>
  105. <if test="instanceUri != null">instance_uri = #{instanceUri},</if>
  106. <if test="accessToken != null">access_token = #{accessToken},</if>
  107. <if test="refreshToken != null">refresh_token = #{refreshToken},</if>
  108. <if test="expiresAt != null">expires_at = #{expiresAt},</if>
  109. <if test="refreshTokenExpiresAt != null">refresh_token_expires_at = #{refreshTokenExpiresAt},</if>
  110. <if test="status != null">status = #{status},</if>
  111. update_time = now()
  112. </set>
  113. where id = #{id}
  114. </update>
  115. <!-- 删除 -->
  116. <delete id="deleteById">
  117. delete from xsy_account where id = #{id}
  118. </delete>
  119. <update id="updateTokenInfo" parameterType="com.fs.xiaoshouyi.domain.XsyAccount">
  120. update xsy_account
  121. <set>
  122. <if test="instanceUri != null">instance_uri = #{instanceUri},</if>
  123. <if test="accessToken != null">access_token = #{accessToken},</if>
  124. <if test="refreshToken != null">refresh_token = #{refreshToken},</if>
  125. <if test="expiresAt != null">expires_at = #{expiresAt},</if>
  126. <if test="refreshTokenExpiresAt != null">refresh_token_expires_at = #{refreshTokenExpiresAt},</if>
  127. update_time = now()
  128. </set>
  129. where id = #{id}
  130. </update>
  131. </mapper>