项目搭建 Day09 -Https连接使用 mybatis自动填充

项目练习 / 2022-01-14

mall Day09 -Https连接使用 mybatis自动填充

mybatis-plus高级功能自动填充功能

Mybatis—plus 主键设置
导入 retrofit

<!--Retrofit是适用于Android和Java且类型安全的HTTP客户端-->
<dependency>
    <groupId>com.github.lianjiatech</groupId>
    <artifactId>retrofit-spring-boot-starter</artifactId>
    <version>2.2.17</version>
</dependency>
<dependency>
    <groupId>com.github.lianjiatech</groupId>
    <artifactId>retrofit-spring-boot-starter</artifactId>
    <version>2.2.17</version>
</dependency>
<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>logging-interceptor</artifactId>
    <version>3.14.9</version>
</dependency>
<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp</artifactId>
    <version>3.14.9</version>
</dependency>
<dependency>
    <groupId>com.squareup.okio</groupId>
    <artifactId>okio</artifactId>
    <version>1.17.5</version>
</dependency>
<dependency>
    <groupId>com.squareup.retrofit2</groupId>
    <artifactId>retrofit</artifactId>
    <version>2.9.0</version>
</dependency>
<dependency>
    <groupId>com.squareup.retrofit2</groupId>
    <artifactId>converter-jackson</artifactId>
    <version>2.9.0</version>
</dependency>
/**
 * @Description: TODO
 * @author: zwy
 * @date: 2022年01月11日 11:52
 */
@Component
@RetrofitClient(baseUrl = "${http.eqb}")
public interface EqbHttp {

    @Headers({"Content-Type:application/json"})
    @POST("v2/identity/verify/individual/base")
    JSONObject verify(@Header("X-Tsign-Open-Token") String token,//添加动态请求头
                      @Header("X-Tsign-Open-App-Id") String appid,
                      @Body Map map
    );

    @Headers({"X-Tsign-Open-App-Id:${eqb.id}"
            , "Content-Type:application/json"
    })//添加固定请求头
    @GET("v1/oauth2/access_token")
    JSONObject getToken(@Query("appId") String id 
            , @Query("secret") String secret
            , @Query("grantType") String grantType
    );

}