This commit is contained in:
shikong 2024-04-17 18:31:22 +08:00
parent 0440865e90
commit 1d716448e7
4 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,13 @@
package cn.skcks.wx.official.api.controller;
import cn.skcks.wx.official.service.WxMpGenericService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.models.security.SecurityScheme;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
@ -9,6 +16,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "微信公众号接口", description = "微信公众号接口")
@RestController
@RequestMapping("/mp")
@RequiredArgsConstructor
@ -16,6 +24,10 @@ public class MpController {
private final WxMpGenericService wechatMpAuthService;
@SneakyThrows
@Operation(summary = "微信公众号对外服务接口")
@Parameters({
@Parameter(name = "appId", description = "微信公众号appId", required = true, in = ParameterIn.PATH)
})
@RequestMapping("/{appId}")
public void test(HttpServletRequest request, HttpServletResponse response, @PathVariable String appId){
wechatMpAuthService.auth(appId, request, response);

View File

@ -69,6 +69,12 @@
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
<version>2.2.15</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View File

@ -3,10 +3,11 @@ package cn.skcks.wx.official.orm.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigInteger;
import com.mybatisflex.core.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@ -21,6 +22,7 @@ import java.io.Serial;
@Accessors(chain = true)
@Data(staticConstructor = "create")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "设备通道信息")
@Table(value = "wx_official_account", dataSource = "mysql")
public class WxOfficialAccount extends Model<WxOfficialAccount> {
@ -31,36 +33,43 @@ public class WxOfficialAccount extends Model<WxOfficialAccount> {
* 主键id
*/
@Id(keyType = KeyType.Auto)
@Schema(description = "主键id")
private BigInteger id;
/**
* 微信公众号appid
*/
@Schema(description = "微信公众号appid")
private String appId;
/**
* 公众号账号
*/
@Schema(description = "公众号账号")
private String account;
/**
* 第三方用户唯一凭证密钥
*/
@Schema(description = "第三方用户唯一凭证密钥")
private String secret;
/**
* 令牌
*/
@Schema(description = "令牌")
private String token;
/**
* 消息加解密密钥
*/
@Schema(description = "消息加解密密钥")
private String aesKey;
/**
* 是否启用
*/
@Schema(description = "是否启用")
private Boolean enabled;
}

View File

@ -1,6 +1,7 @@
package cn.skcks.wx.official.orm;
import com.mybatisflex.codegen.Generator;
import com.mybatisflex.codegen.config.EntityConfig;
import com.mybatisflex.codegen.config.GlobalConfig;
import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.datasource.FlexDataSource;
@ -53,6 +54,7 @@ public class OrmGenerator {
globalConfig.setEntityDataSource(dataSourceName);
globalConfig.setEntityGenerateEnable(true);
globalConfig.setEntityWithSwagger(true);
globalConfig.setEntityWithLombok(true);
globalConfig.setEntityGenerateEnable(true);
globalConfig.setWithActiveRecord(true);
@ -66,6 +68,7 @@ public class OrmGenerator {
// 不生成的表
globalConfig.setUnGenerateTable("DATABASECHANGELOG", "DATABASECHANGELOGLOCK");
globalConfig.getEntityConfig().setSwaggerVersion(EntityConfig.SwaggerVersion.DOC);
Generator generator = new Generator(dataSource, globalConfig);
generator.generate();
}