79 changed files with 628 additions and 922 deletions
@ -1,41 +1,38 @@ |
|||||
package com.bx.implatform.config; |
package com.bx.implatform.config; |
||||
|
|
||||
import io.swagger.annotations.ApiOperation; |
|
||||
|
import io.swagger.v3.oas.models.OpenAPI; |
||||
|
import io.swagger.v3.oas.models.info.Contact; |
||||
|
import io.swagger.v3.oas.models.info.Info; |
||||
|
import io.swagger.v3.oas.models.info.License; |
||||
|
import org.springdoc.core.models.GroupedOpenApi; |
||||
import org.springframework.context.annotation.Bean; |
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
import org.springframework.context.annotation.Configuration; |
||||
import springfox.documentation.builders.ApiInfoBuilder; |
|
||||
import springfox.documentation.builders.PathSelectors; |
|
||||
import springfox.documentation.builders.RequestHandlerSelectors; |
|
||||
import springfox.documentation.service.ApiInfo; |
|
||||
import springfox.documentation.spi.DocumentationType; |
|
||||
import springfox.documentation.spring.web.plugins.Docket; |
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
|
||||
|
|
||||
@Configuration |
@Configuration |
||||
@EnableSwagger2 |
|
||||
public class SwaggerConfig { |
public class SwaggerConfig { |
||||
|
|
||||
@Bean |
@Bean |
||||
public Docket createRestApi() { |
public GroupedOpenApi userApi() { |
||||
|
String[] paths = {"/**"}; |
||||
return new Docket(DocumentationType.SWAGGER_2) |
String[] packagedToMatch = {"com.bx"}; |
||||
.apiInfo(apiInfo()) |
return GroupedOpenApi.builder().group("BoxIM") |
||||
.select() |
.pathsToMatch(paths) |
||||
//这里采用包含注解的方式来确定要显示的接口
|
.packagesToScan(packagedToMatch).build(); |
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
|
||||
//这里采用包扫描的方式来确定要显示的接口
|
|
||||
.paths(PathSelectors.any()) |
|
||||
.build(); |
|
||||
|
|
||||
} |
} |
||||
|
|
||||
private ApiInfo apiInfo() { |
@Bean |
||||
return new ApiInfoBuilder() |
public OpenAPI customOpenAPI() { |
||||
.title("IM Platform doc") |
Contact contact = new Contact(); |
||||
.description("盒子IM API文档") |
contact.setName("Blue"); |
||||
.termsOfServiceUrl("http://8.134.92.70/") |
return new OpenAPI().info(new Info() |
||||
.version("1.0") |
.title("Box-IM") |
||||
.build(); |
.description("盒子IM") |
||||
|
.contact(contact) |
||||
|
.version("3.0") |
||||
|
.termsOfService("https://www.boxim.online") |
||||
|
.license(new License().name("MIT") |
||||
|
.url("https://www.boxim.online"))); |
||||
} |
} |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,36 +1,35 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotEmpty; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
|
import jakarta.validation.constraints.Size; |
||||
import lombok.Data; |
import lombok.Data; |
||||
import org.hibernate.validator.constraints.Length; |
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
import javax.validation.constraints.Size; |
|
||||
import java.util.List; |
import java.util.List; |
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("群聊消息DTO") |
@Schema(description = "群聊消息DTO") |
||||
public class GroupMessageDTO { |
public class GroupMessageDTO { |
||||
|
|
||||
@NotNull(message = "群聊id不可为空") |
@NotNull(message = "群聊id不可为空") |
||||
@ApiModelProperty(value = "群聊id") |
@Schema(description = "群聊id") |
||||
private Long groupId; |
private Long groupId; |
||||
|
|
||||
@Length(max = 1024, message = "发送内容长度不得大于1024") |
@Length(max = 1024, message = "发送内容长度不得大于1024") |
||||
@NotEmpty(message = "发送内容不可为空") |
@NotEmpty(message = "发送内容不可为空") |
||||
@ApiModelProperty(value = "发送内容") |
@Schema(description = "发送内容") |
||||
private String content; |
private String content; |
||||
|
|
||||
@NotNull(message = "消息类型不可为空") |
@NotNull(message = "消息类型不可为空") |
||||
@ApiModelProperty(value = "消息类型") |
@Schema(description = "消息类型") |
||||
private Integer type; |
private Integer type; |
||||
|
|
||||
@ApiModelProperty(value = "是否回执消息") |
@Schema(description = "是否回执消息") |
||||
private Boolean receipt = false; |
private Boolean receipt = false; |
||||
|
|
||||
@Size(max = 20, message = "一次最多只能@20个小伙伴哦") |
@Size(max = 20, message = "一次最多只能@20个小伙伴哦") |
||||
@ApiModelProperty(value = "被@用户列表") |
@Schema(description = "被@用户列表") |
||||
private List<Long> atUserIds; |
private List<Long> atUserIds; |
||||
} |
} |
||||
|
|||||
@ -1,30 +1,28 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.Max; |
||||
|
import jakarta.validation.constraints.Min; |
||||
|
import jakarta.validation.constraints.NotEmpty; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.Max; |
|
||||
import javax.validation.constraints.Min; |
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("用户登录DTO") |
@Schema(description = "用户登录DTO") |
||||
public class LoginDTO { |
public class LoginDTO { |
||||
|
|
||||
@Max(value = 2, message = "登录终端类型取值范围:0,2") |
@Max(value = 2, message = "登录终端类型取值范围:0,2") |
||||
@Min(value = 0, message = "登录终端类型取值范围:0,2") |
@Min(value = 0, message = "登录终端类型取值范围:0,2") |
||||
@NotNull(message = "登录终端类型不可为空") |
@NotNull(message = "登录终端类型不可为空") |
||||
@ApiModelProperty(value = "登录终端 0:web 1:app 2:pc") |
@Schema(description = "登录终端 0:web 1:app 2:pc") |
||||
private Integer terminal; |
private Integer terminal; |
||||
|
|
||||
@NotEmpty(message = "用户名不可为空") |
@NotEmpty(message = "用户名不可为空") |
||||
@ApiModelProperty(value = "用户名") |
@Schema(description = "用户名") |
||||
private String userName; |
private String userName; |
||||
|
|
||||
@NotEmpty(message = "用户密码不可为空") |
@NotEmpty(message = "用户密码不可为空") |
||||
@ApiModelProperty(value = "用户密码") |
@Schema(description = "用户密码") |
||||
private String password; |
private String password; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,21 +1,19 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotEmpty; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("修改密码DTO") |
@Schema(description = "修改密码DTO") |
||||
public class ModifyPwdDTO { |
public class ModifyPwdDTO { |
||||
|
|
||||
@NotEmpty(message = "旧用户密码不可为空") |
@NotEmpty(message = "旧用户密码不可为空") |
||||
@ApiModelProperty(value = "旧用户密码") |
@Schema(description = "旧用户密码") |
||||
private String oldPassword; |
private String oldPassword; |
||||
|
|
||||
@NotEmpty(message = "新用户密码不可为空") |
@NotEmpty(message = "新用户密码不可为空") |
||||
@ApiModelProperty(value = "新用户密码") |
@Schema(description = "新用户密码") |
||||
private String newPassword; |
private String newPassword; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,29 +1,27 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotEmpty; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
import org.hibernate.validator.constraints.Length; |
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("私聊消息DTO") |
@Schema(description = "私聊消息DTO") |
||||
public class PrivateMessageDTO { |
public class PrivateMessageDTO { |
||||
|
|
||||
@NotNull(message = "接收用户id不可为空") |
@NotNull(message = "接收用户id不可为空") |
||||
@ApiModelProperty(value = "接收用户id") |
@Schema(description = "接收用户id") |
||||
private Long recvId; |
private Long recvId; |
||||
|
|
||||
|
|
||||
@Length(max = 1024, message = "内容长度不得大于1024") |
@Length(max = 1024, message = "内容长度不得大于1024") |
||||
@NotEmpty(message = "发送内容不可为空") |
@NotEmpty(message = "发送内容不可为空") |
||||
@ApiModelProperty(value = "发送内容") |
@Schema(description = "发送内容") |
||||
private String content; |
private String content; |
||||
|
|
||||
@NotNull(message = "消息类型不可为空") |
@NotNull(message = "消息类型不可为空") |
||||
@ApiModelProperty(value = "消息类型") |
@Schema(description = "消息类型") |
||||
private Integer type; |
private Integer type; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,31 +1,29 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotEmpty; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
/** |
/** |
||||
* @author: Blue |
* @author: Blue |
||||
* @date: 2024-06-01 |
* @date: 2024-06-01 |
||||
* @version: 1.0 |
* @version: 1.0 |
||||
*/ |
*/ |
||||
@Data |
@Data |
||||
@ApiModel("回复用户连接请求DTO") |
@Schema(description = "回复用户连接请求DTO") |
||||
public class WebrtcGroupAnswerDTO { |
public class WebrtcGroupAnswerDTO { |
||||
|
|
||||
@NotNull(message = "群聊id不可为空") |
@NotNull(message = "群聊id不可为空") |
||||
@ApiModelProperty(value = "群聊id") |
@Schema(description = "群聊id") |
||||
private Long groupId; |
private Long groupId; |
||||
|
|
||||
@NotNull(message = "用户id不可为空") |
@NotNull(message = "用户id不可为空") |
||||
@ApiModelProperty(value = "用户id,代表回复谁的连接请求") |
@Schema(description = "用户id,代表回复谁的连接请求") |
||||
private Long userId; |
private Long userId; |
||||
|
|
||||
@NotEmpty(message = "anwer不可为空") |
@NotEmpty(message = "anwer不可为空") |
||||
@ApiModelProperty(value = "用户本地anwer信息") |
@Schema(description = "用户本地anwer信息") |
||||
private String answer; |
private String answer; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,32 +1,29 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotEmpty; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
/** |
||||
* @author: Blue |
* @author: Blue |
||||
* @date: 2024-06-01 |
* @date: 2024-06-01 |
||||
* @version: 1.0 |
* @version: 1.0 |
||||
*/ |
*/ |
||||
@Data |
@Data |
||||
@ApiModel("发起群视频通话DTO") |
@Schema(description = "发起群视频通话DTO") |
||||
public class WebrtcGroupCandidateDTO { |
public class WebrtcGroupCandidateDTO { |
||||
|
|
||||
@NotNull(message = "群聊id不可为空") |
@NotNull(message = "群聊id不可为空") |
||||
@ApiModelProperty(value = "群聊id") |
@Schema(description = "群聊id") |
||||
private Long groupId; |
private Long groupId; |
||||
|
|
||||
@NotNull(message = "用户id不可为空") |
@NotNull(message = "用户id不可为空") |
||||
@ApiModelProperty(value = "用户id") |
@Schema(description = "用户id") |
||||
private Long userId; |
private Long userId; |
||||
|
|
||||
@NotEmpty(message = "candidate信息不可为空") |
@NotEmpty(message = "candidate信息不可为空") |
||||
@ApiModelProperty(value = "candidate信息") |
@Schema(description = "candidate信息") |
||||
private String candidate; |
private String candidate; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,29 +1,26 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
/** |
/** |
||||
* @author: Blue |
* @author: Blue |
||||
* @date: 2024-06-01 |
* @date: 2024-06-01 |
||||
* @version: 1.0 |
* @version: 1.0 |
||||
*/ |
*/ |
||||
@Data |
@Data |
||||
@ApiModel("用户设备操作DTO") |
@Schema(description = "用户设备操作DTO") |
||||
public class WebrtcGroupDeviceDTO { |
public class WebrtcGroupDeviceDTO { |
||||
|
|
||||
@NotNull(message = "群聊id不可为空") |
@NotNull(message = "群聊id不可为空") |
||||
@ApiModelProperty(value = "群聊id") |
@Schema(description = "群聊id") |
||||
private Long groupId; |
private Long groupId; |
||||
|
|
||||
@ApiModelProperty(value = "是否开启摄像头") |
@Schema(description = "是否开启摄像头") |
||||
private Boolean isCamera; |
private Boolean isCamera; |
||||
|
|
||||
@ApiModelProperty(value = "是否开启麦克风") |
@Schema(description = "是否开启麦克风") |
||||
private Boolean isMicroPhone; |
private Boolean isMicroPhone; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,25 +1,23 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
/** |
/** |
||||
* @author: Blue |
* @author: Blue |
||||
* @date: 2024-06-01 |
* @date: 2024-06-01 |
||||
* @version: 1.0 |
* @version: 1.0 |
||||
*/ |
*/ |
||||
@Data |
@Data |
||||
@ApiModel("用户通话失败DTO") |
@Schema(description = "用户通话失败DTO") |
||||
public class WebrtcGroupFailedDTO { |
public class WebrtcGroupFailedDTO { |
||||
|
|
||||
@NotNull(message = "群聊id不可为空") |
@NotNull(message = "群聊id不可为空") |
||||
@ApiModelProperty(value = "群聊id") |
@Schema(description = "群聊id") |
||||
private Long groupId; |
private Long groupId; |
||||
|
|
||||
@ApiModelProperty(value = "失败原因") |
@Schema(description = "失败原因") |
||||
private String reason; |
private String reason; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,23 +1,20 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
/** |
/** |
||||
* @author: Blue |
* @author: Blue |
||||
* @date: 2024-06-01 |
* @date: 2024-06-01 |
||||
* @version: 1.0 |
* @version: 1.0 |
||||
*/ |
*/ |
||||
@Data |
@Data |
||||
@ApiModel("进入群视频通话DTO") |
@Schema(description = "进入群视频通话DTO") |
||||
public class WebrtcGroupJoinDTO { |
public class WebrtcGroupJoinDTO { |
||||
|
|
||||
@NotNull(message = "群聊id不可为空") |
@NotNull(message = "群聊id不可为空") |
||||
@ApiModelProperty(value = "群聊id") |
@Schema(description = "群聊id") |
||||
private Long groupId; |
private Long groupId; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,31 +1,29 @@ |
|||||
package com.bx.implatform.dto; |
package com.bx.implatform.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotEmpty; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
/** |
/** |
||||
* @author: Blue |
* @author: Blue |
||||
* @date: 2024-06-01 |
* @date: 2024-06-01 |
||||
* @version: 1.0 |
* @version: 1.0 |
||||
*/ |
*/ |
||||
@Data |
@Data |
||||
@ApiModel("回复用户连接请求DTO") |
@Schema(description = "回复用户连接请求DTO") |
||||
public class WebrtcGroupOfferDTO { |
public class WebrtcGroupOfferDTO { |
||||
|
|
||||
@NotNull(message = "群聊id不可为空") |
@NotNull(message = "群聊id不可为空") |
||||
@ApiModelProperty(value = "群聊id") |
@Schema(description = "群聊id") |
||||
private Long groupId; |
private Long groupId; |
||||
|
|
||||
@NotNull(message = "用户id不可为空") |
@NotNull(message = "用户id不可为空") |
||||
@ApiModelProperty(value = "用户id,代表回复谁的连接请求") |
@Schema(description = "用户id,代表回复谁的连接请求") |
||||
private Long userId; |
private Long userId; |
||||
|
|
||||
@NotEmpty(message = "offer不可为空") |
@NotEmpty(message = "offer不可为空") |
||||
@ApiModelProperty(value = "用户offer信息") |
@Schema(description = "用户offer信息") |
||||
private String offer; |
private String offer; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,102 +1,102 @@ |
|||||
package com.bx.implatform.generator; |
package com.bx.implatform.generator; |
||||
|
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
//import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool; |
//import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator; |
//import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig; |
//import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*; |
//import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
//import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DateType; |
//import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
//import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine; |
//import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
|
||||
|
//
|
||||
import java.util.ArrayList; |
//import java.util.ArrayList;
|
||||
import java.util.List; |
//import java.util.List;
|
||||
|
|
||||
|
|
||||
public class CodeGenerator { |
public class CodeGenerator { |
||||
public static void main(String[] args) { |
// public static void main(String[] args) {
|
||||
// 代码生成器
|
// // 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator(); |
// AutoGenerator mpg = new AutoGenerator();
|
||||
|
//
|
||||
// 全局配置
|
// // 全局配置
|
||||
GlobalConfig gc = new GlobalConfig(); |
// GlobalConfig gc = new GlobalConfig();
|
||||
//生成的代码输出路径,自己根据需要修改
|
// //生成的代码输出路径,自己根据需要修改
|
||||
String projectPath = "d:\\work\\project\\code"; |
// String projectPath = "d:\\work\\project\\code";
|
||||
gc.setOutputDir(projectPath + "/src/main/java"); |
// gc.setOutputDir(projectPath + "/src/main/java");
|
||||
gc.setAuthor("blue"); |
// gc.setAuthor("blue");
|
||||
gc.setOpen(false); |
// gc.setOpen(false);
|
||||
gc.setFileOverride(true); |
// gc.setFileOverride(true);
|
||||
gc.setActiveRecord(true); |
// gc.setActiveRecord(true);
|
||||
gc.setBaseColumnList(true); |
// gc.setBaseColumnList(true);
|
||||
gc.setBaseResultMap(true); |
// gc.setBaseResultMap(true);
|
||||
gc.setIdType(IdType.AUTO); |
// gc.setIdType(IdType.AUTO);
|
||||
gc.setDateType(DateType.ONLY_DATE); |
// gc.setDateType(DateType.ONLY_DATE);
|
||||
mpg.setGlobalConfig(gc); |
// mpg.setGlobalConfig(gc);
|
||||
|
//
|
||||
// 数据源配置
|
// // 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig(); |
// DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://localhost:3306/box-im?useUnicode=true&characterEncoding=utf-8"); |
// dsc.setUrl("jdbc:mysql://localhost:3306/box-im?useUnicode=true&characterEncoding=utf-8");
|
||||
dsc.setDriverName("com.mysql.jdbc.Driver"); |
// dsc.setDriverName("com.mysql.jdbc.Driver");
|
||||
dsc.setUsername("root"); |
// dsc.setUsername("root");
|
||||
dsc.setPassword("root"); |
// dsc.setPassword("root");
|
||||
mpg.setDataSource(dsc); |
// mpg.setDataSource(dsc);
|
||||
|
//
|
||||
// 包配置
|
// // 包配置
|
||||
PackageConfig pc = new PackageConfig(); |
// PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(""); |
// pc.setModuleName("");
|
||||
pc.setParent("com.bx"); |
// pc.setParent("com.bx");
|
||||
mpg.setPackageInfo(pc); |
// mpg.setPackageInfo(pc);
|
||||
|
//
|
||||
// 如果模板引擎是 velocity
|
// // 如果模板引擎是 velocity
|
||||
String templatePath = "/templates/mapper.xml.vm"; |
// String templatePath = "/templates/mapper.xml.vm";
|
||||
|
//
|
||||
// 自定义输出配置
|
// // 自定义输出配置
|
||||
List<FileOutConfig> focList = new ArrayList<>(); |
// List<FileOutConfig> focList = new ArrayList<>();
|
||||
// 自定义配置会被优先输出
|
// // 自定义配置会被优先输出
|
||||
focList.add(new FileOutConfig(templatePath) { |
// focList.add(new FileOutConfig(templatePath) {
|
||||
@Override |
// @Override
|
||||
public String outputFile(TableInfo tableInfo) { |
// public String outputFile(TableInfo tableInfo) {
|
||||
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
|
// // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
|
||||
return projectPath + "/src/main/resources/mapper/" |
// return projectPath + "/src/main/resources/mapper/"
|
||||
+ tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; |
// + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
|
||||
} |
// }
|
||||
}); |
// });
|
||||
|
//
|
||||
// 自定义配置
|
// // 自定义配置
|
||||
InjectionConfig cfg = new InjectionConfig() { |
// InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override |
// @Override
|
||||
public void initMap() { |
// public void initMap() {
|
||||
// to do nothing
|
// // to do nothing
|
||||
} |
// }
|
||||
}; |
// };
|
||||
cfg.setFileOutConfigList(focList); |
// cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg); |
// mpg.setCfg(cfg);
|
||||
|
//
|
||||
// 配置模板
|
// // 配置模板
|
||||
TemplateConfig templateConfig = new TemplateConfig(); |
// TemplateConfig templateConfig = new TemplateConfig();
|
||||
templateConfig.setXml(null); |
// templateConfig.setXml(null);
|
||||
mpg.setTemplate(templateConfig); |
// mpg.setTemplate(templateConfig);
|
||||
|
//
|
||||
// 策略配置
|
// // 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig(); |
// StrategyConfig strategy = new StrategyConfig();
|
||||
// 下划线转驼峰
|
// // 下划线转驼峰
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel); |
// strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel); |
// strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setEntityTableFieldAnnotationEnable(true); |
// strategy.setEntityTableFieldAnnotationEnable(true);
|
||||
strategy.setVersionFieldName("version"); |
// strategy.setVersionFieldName("version");
|
||||
//逻辑删除的字段
|
// //逻辑删除的字段
|
||||
strategy.setLogicDeleteFieldName("deleted"); |
// strategy.setLogicDeleteFieldName("deleted");
|
||||
strategy.setEntityLombokModel(true); |
// strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true); |
// strategy.setRestControllerStyle(true);
|
||||
|
//
|
||||
|
//
|
||||
//多张表的时候直接在代码中写表名
|
// //多张表的时候直接在代码中写表名
|
||||
strategy.setInclude("friends"); |
// strategy.setInclude("friends");
|
||||
strategy.setTablePrefix(""); |
// strategy.setTablePrefix("");
|
||||
mpg.setStrategy(strategy); |
// mpg.setStrategy(strategy);
|
||||
|
//
|
||||
mpg.setTemplateEngine(new VelocityTemplateEngine()); |
// mpg.setTemplateEngine(new VelocityTemplateEngine());
|
||||
mpg.execute(); |
// mpg.execute();
|
||||
} |
// }
|
||||
} |
} |
||||
|
|||||
@ -1,24 +1,22 @@ |
|||||
package com.bx.implatform.vo; |
package com.bx.implatform.vo; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("好友信息VO") |
@Schema(description = "好友信息VO") |
||||
public class FriendVO { |
public class FriendVO { |
||||
|
|
||||
@NotNull(message = "好友id不可为空") |
@NotNull(message = "好友id不可为空") |
||||
@ApiModelProperty(value = "好友id") |
@Schema(description = "好友id") |
||||
private Long id; |
private Long id; |
||||
|
|
||||
@NotNull(message = "好友昵称不可为空") |
@NotNull(message = "好友昵称不可为空") |
||||
@ApiModelProperty(value = "好友昵称") |
@Schema(description = "好友昵称") |
||||
private String nickName; |
private String nickName; |
||||
|
|
||||
|
|
||||
@ApiModelProperty(value = "好友头像") |
@Schema(description = "好友头像") |
||||
private String headImage; |
private String headImage; |
||||
} |
} |
||||
|
|||||
@ -1,22 +1,21 @@ |
|||||
package com.bx.implatform.vo; |
package com.bx.implatform.vo; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotEmpty; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
import java.util.List; |
import java.util.List; |
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("邀请好友进群请求VO") |
@Schema(description = "邀请好友进群请求VO") |
||||
public class GroupInviteVO { |
public class GroupInviteVO { |
||||
|
|
||||
@NotNull(message = "群id不可为空") |
@NotNull(message = "群id不可为空") |
||||
@ApiModelProperty(value = "群id") |
@Schema(description = "群id") |
||||
private Long groupId; |
private Long groupId; |
||||
|
|
||||
@NotEmpty(message = "群id不可为空") |
@NotEmpty(message = "群id不可为空") |
||||
@ApiModelProperty(value = "好友id列表不可为空") |
@Schema(description = "好友id列表不可为空") |
||||
private List<Long> friendIds; |
private List<Long> friendIds; |
||||
} |
} |
||||
|
|||||
@ -1,29 +1,28 @@ |
|||||
package com.bx.implatform.vo; |
package com.bx.implatform.vo; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
|
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("群成员信息VO") |
@Schema(description = "群成员信息VO") |
||||
public class GroupMemberVO { |
public class GroupMemberVO { |
||||
|
|
||||
@ApiModelProperty("用户id") |
@Schema(description = "用户id") |
||||
private Long userId; |
private Long userId; |
||||
|
|
||||
@ApiModelProperty("群内显示名称") |
@Schema(description = "群内显示名称") |
||||
private String aliasName; |
private String aliasName; |
||||
|
|
||||
@ApiModelProperty("头像") |
@Schema(description = "头像") |
||||
private String headImage; |
private String headImage; |
||||
|
|
||||
@ApiModelProperty("是否已退出") |
@Schema(description = "是否已退出") |
||||
private Boolean quit; |
private Boolean quit; |
||||
|
|
||||
@ApiModelProperty(value = "是否在线") |
@Schema(description = "是否在线") |
||||
private Boolean online; |
private Boolean online; |
||||
|
|
||||
@ApiModelProperty("备注") |
@Schema(description = "备注") |
||||
private String remark; |
private String remark; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,23 +1,22 @@ |
|||||
package com.bx.implatform.vo; |
package com.bx.implatform.vo; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
|
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("用户登录VO") |
@Schema(description = "用户登录VO") |
||||
public class LoginVO { |
public class LoginVO { |
||||
|
|
||||
@ApiModelProperty(value = "每次请求都必须在header中携带accessToken") |
@Schema(description = "每次请求都必须在header中携带accessToken") |
||||
private String accessToken; |
private String accessToken; |
||||
|
|
||||
@ApiModelProperty(value = "accessToken过期时间(秒)") |
@Schema(description = "accessToken过期时间(秒)") |
||||
private Integer accessTokenExpiresIn; |
private Integer accessTokenExpiresIn; |
||||
|
|
||||
@ApiModelProperty(value = "accessToken过期后,通过refreshToken换取新的token") |
@Schema(description = "accessToken过期后,通过refreshToken换取新的token") |
||||
private String refreshToken; |
private String refreshToken; |
||||
|
|
||||
@ApiModelProperty(value = "refreshToken过期时间(秒)") |
@Schema(description = "refreshToken过期时间(秒)") |
||||
private Integer refreshTokenExpiresIn; |
private Integer refreshTokenExpiresIn; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,16 +1,15 @@ |
|||||
package com.bx.implatform.vo; |
package com.bx.implatform.vo; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
|
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("图片上传VO") |
@Schema(description = "图片上传VO") |
||||
public class UploadImageVO { |
public class UploadImageVO { |
||||
|
|
||||
@ApiModelProperty(value = "原图") |
@Schema(description = "原图") |
||||
private String originUrl; |
private String originUrl; |
||||
|
|
||||
@ApiModelProperty(value = "缩略图") |
@Schema(description = "缩略图") |
||||
private String thumbUrl; |
private String thumbUrl; |
||||
} |
} |
||||
|
|||||
@ -1,48 +1,46 @@ |
|||||
package com.bx.implatform.vo; |
package com.bx.implatform.vo; |
||||
|
|
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import io.swagger.annotations.ApiModelProperty; |
import jakarta.validation.constraints.NotEmpty; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
import lombok.Data; |
import lombok.Data; |
||||
import org.hibernate.validator.constraints.Length; |
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
@Data |
@Data |
||||
@ApiModel("用户信息VO") |
@Schema(description = "用户信息VO") |
||||
public class UserVO { |
public class UserVO { |
||||
|
|
||||
@NotNull(message = "用户id不能为空") |
@NotNull(message = "用户id不能为空") |
||||
@ApiModelProperty(value = "id") |
@Schema(description = "id") |
||||
private Long id; |
private Long id; |
||||
|
|
||||
@NotEmpty(message = "用户名不能为空") |
@NotEmpty(message = "用户名不能为空") |
||||
@Length(max = 64, message = "用户名不能大于64字符") |
@Length(max = 64, message = "用户名不能大于64字符") |
||||
@ApiModelProperty(value = "用户名") |
@Schema(description = "用户名") |
||||
private String userName; |
private String userName; |
||||
|
|
||||
@NotEmpty(message = "用户昵称不能为空") |
@NotEmpty(message = "用户昵称不能为空") |
||||
@Length(max = 64, message = "昵称不能大于64字符") |
@Length(max = 64, message = "昵称不能大于64字符") |
||||
@ApiModelProperty(value = "用户昵称") |
@Schema(description = "用户昵称") |
||||
private String nickName; |
private String nickName; |
||||
|
|
||||
@ApiModelProperty(value = "性别") |
@Schema(description = "性别") |
||||
private Integer sex; |
private Integer sex; |
||||
|
|
||||
@ApiModelProperty(value = "用户类型 1:普通用户 2:审核账户") |
@Schema(description = "用户类型 1:普通用户 2:审核账户") |
||||
private Integer type; |
private Integer type; |
||||
|
|
||||
@Length(max = 1024, message = "个性签名不能大于1024个字符") |
@Length(max = 1024, message = "个性签名不能大于1024个字符") |
||||
@ApiModelProperty(value = "个性签名") |
@Schema(description = "个性签名") |
||||
private String signature; |
private String signature; |
||||
|
|
||||
@ApiModelProperty(value = "头像") |
@Schema(description = "头像") |
||||
private String headImage; |
private String headImage; |
||||
|
|
||||
@ApiModelProperty(value = "头像缩略图") |
@Schema(description = "头像缩略图") |
||||
private String headImageThumb; |
private String headImageThumb; |
||||
|
|
||||
@ApiModelProperty(value = "是否在线") |
@Schema(description = "是否在线") |
||||
private Boolean online; |
private Boolean online; |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,33 +0,0 @@ |
|||||
package com.bx.imserver.config; |
|
||||
|
|
||||
import com.alibaba.fastjson.support.spring.FastJsonRedisSerializer; |
|
||||
import org.springframework.context.annotation.Bean; |
|
||||
import org.springframework.context.annotation.Configuration; |
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory; |
|
||||
import org.springframework.data.redis.core.RedisTemplate; |
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer; |
|
||||
|
|
||||
@Configuration |
|
||||
public class RedisConfig { |
|
||||
|
|
||||
@Bean |
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { |
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>(); |
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory); |
|
||||
// 设置值(value)的序列化采用FastJsonRedisSerializer
|
|
||||
redisTemplate.setValueSerializer(fastJsonRedisSerializer()); |
|
||||
redisTemplate.setHashValueSerializer(fastJsonRedisSerializer()); |
|
||||
// 设置键(key)的序列化采用StringRedisSerializer。
|
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer()); |
|
||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer()); |
|
||||
redisTemplate.afterPropertiesSet(); |
|
||||
return redisTemplate; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public FastJsonRedisSerializer fastJsonRedisSerializer() { |
|
||||
return new FastJsonRedisSerializer<>(Object.class); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
||||
Loading…
Reference in new issue