XsyAccountMapper.xml 5.1 KB

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