BdApiMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.baidu.mapper.BdApiMapper">
  6. <resultMap type="BdApi" id="BdApiResult">
  7. <result property="id" column="id" />
  8. <result property="appId" column="app_id" />
  9. <result property="appSecretKey" column="app_secret_key" />
  10. <result property="apppName" column="appp_name" />
  11. <result property="openId" column="open_id" />
  12. <result property="authCode" column="auth_code" />
  13. <result property="accessToken" column="access_token" />
  14. <result property="refreshToken" column="refresh_token" />
  15. <result property="expiresIn" column="expires_in" />
  16. <result property="refreshExpiresIn" column="refresh_expires_in" />
  17. <result property="createTime" column="create_time" />
  18. <result property="createBy" column="create_by" />
  19. <result property="updateBy" column="update_by" />
  20. <result property="updateTime" column="update_time" />
  21. <result property="remark" column="remark" />
  22. </resultMap>
  23. <sql id="selectBdApiVo">
  24. select * from bd_api
  25. </sql>
  26. <select id="selectBdApiList" parameterType="BdApi" resultMap="BdApiResult">
  27. <include refid="selectBdApiVo"/>
  28. <where>
  29. <if test="appId != null and appId != ''"> and app_id = #{appId}</if>
  30. <if test="appSecretKey != null and appSecretKey != ''"> and app_secret_key = #{appSecretKey}</if>
  31. <if test="apppName != null and apppName != ''"> and appp_name like concat('%', #{apppName}, '%')</if>
  32. <if test="openId != null and openId != ''"> and open_id = #{openId}</if>
  33. <if test="authCode != null and authCode != ''"> and auth_code = #{authCode}</if>
  34. <if test="accessToken != null and accessToken != ''"> and access_token = #{accessToken}</if>
  35. <if test="refreshToken != null and refreshToken != ''"> and refresh_token = #{refreshToken}</if>
  36. <if test="expiresIn != null "> and expires_in = #{expiresIn}</if>
  37. <if test="refreshExpiresIn != null "> and refresh_expires_in = #{refreshExpiresIn}</if>
  38. </where>
  39. </select>
  40. <select id="selectBdApiById" parameterType="Long" resultMap="BdApiResult">
  41. <include refid="selectBdApiVo"/>
  42. where id = #{id}
  43. </select>
  44. <insert id="insertBdApi" parameterType="BdApi" useGeneratedKeys="true" keyProperty="id">
  45. insert into bd_api
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="appId != null">app_id,</if>
  48. <if test="appSecretKey != null">app_secret_key,</if>
  49. <if test="apppName != null">appp_name,</if>
  50. <if test="openId != null">open_id,</if>
  51. <if test="authCode != null">auth_code,</if>
  52. <if test="accessToken != null">access_token,</if>
  53. <if test="refreshToken != null">refresh_token,</if>
  54. <if test="expiresIn != null">expires_in,</if>
  55. <if test="refreshExpiresIn != null">refresh_expires_in,</if>
  56. <if test="createTime != null">create_time,</if>
  57. <if test="createBy != null">create_by,</if>
  58. <if test="updateBy != null">update_by,</if>
  59. <if test="updateTime != null">update_time,</if>
  60. <if test="remark != null">remark,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="appId != null">#{appId},</if>
  64. <if test="appSecretKey != null">#{appSecretKey},</if>
  65. <if test="apppName != null">#{apppName},</if>
  66. <if test="openId != null">#{openId},</if>
  67. <if test="authCode != null">#{authCode},</if>
  68. <if test="accessToken != null">#{accessToken},</if>
  69. <if test="refreshToken != null">#{refreshToken},</if>
  70. <if test="expiresIn != null">#{expiresIn},</if>
  71. <if test="refreshExpiresIn != null">#{refreshExpiresIn},</if>
  72. <if test="createTime != null">#{createTime},</if>
  73. <if test="createBy != null">#{createBy},</if>
  74. <if test="updateBy != null">#{updateBy},</if>
  75. <if test="updateTime != null">#{updateTime},</if>
  76. <if test="remark != null">#{remark},</if>
  77. </trim>
  78. </insert>
  79. <update id="updateBdApi" parameterType="BdApi">
  80. update bd_api
  81. <trim prefix="SET" suffixOverrides=",">
  82. <if test="appId != null">app_id = #{appId},</if>
  83. <if test="appSecretKey != null">app_secret_key = #{appSecretKey},</if>
  84. <if test="apppName != null">appp_name = #{apppName},</if>
  85. <if test="openId != null">open_id = #{openId},</if>
  86. <if test="authCode != null">auth_code = #{authCode},</if>
  87. <if test="accessToken != null">access_token = #{accessToken},</if>
  88. <if test="refreshToken != null">refresh_token = #{refreshToken},</if>
  89. <if test="expiresIn != null">expires_in = #{expiresIn},</if>
  90. <if test="refreshExpiresIn != null">refresh_expires_in = #{refreshExpiresIn},</if>
  91. <if test="createTime != null">create_time = #{createTime},</if>
  92. <if test="createBy != null">create_by = #{createBy},</if>
  93. <if test="updateBy != null">update_by = #{updateBy},</if>
  94. <if test="updateTime != null">update_time = #{updateTime},</if>
  95. <if test="remark != null">remark = #{remark},</if>
  96. </trim>
  97. where id = #{id}
  98. </update>
  99. <delete id="deleteBdApiById" parameterType="Long">
  100. delete from bd_api where id = #{id}
  101. </delete>
  102. <delete id="deleteBdApiByIds" parameterType="String">
  103. delete from bd_api where id in
  104. <foreach item="id" collection="array" open="(" separator="," close=")">
  105. #{id}
  106. </foreach>
  107. </delete>
  108. </mapper>