mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-01 18:53:35 +08:00
Add Team Interface
This commit is contained in:
@ -17,10 +17,6 @@
|
||||
<groupId>ai.chat2db</groupId>
|
||||
<artifactId>chat2db-server-tools-base</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>ai.chat2db</groupId>-->
|
||||
<!-- <artifactId>chat2db-server-domain-support</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
@ -0,0 +1,36 @@
|
||||
package ai.chat2db.server.domain.api.enums;
|
||||
|
||||
import ai.chat2db.server.tools.base.enums.BaseEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Access Object Type
|
||||
*
|
||||
* @author Jiaju Zhuang
|
||||
*/
|
||||
@Getter
|
||||
public enum AccessObjectTypeEnum implements BaseEnum<String> {
|
||||
/**
|
||||
* TEAM
|
||||
*/
|
||||
TEAM("TEAM"),
|
||||
|
||||
/**
|
||||
* USER
|
||||
*/
|
||||
USER("USER"),
|
||||
|
||||
;
|
||||
|
||||
final String description;
|
||||
|
||||
AccessObjectTypeEnum(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return this.name();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package ai.chat2db.server.domain.api.enums;
|
||||
|
||||
import ai.chat2db.server.tools.base.enums.BaseEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Environment
|
||||
*
|
||||
* @author Jiaju Zhuang
|
||||
*/
|
||||
@Getter
|
||||
public enum EnvironmentEnum implements BaseEnum<Long> {
|
||||
/**
|
||||
* RELEASE
|
||||
*/
|
||||
RELEASE(1L, "RELEASE"),
|
||||
|
||||
/**
|
||||
* TEST
|
||||
*/
|
||||
TEST(2L, "TEST"),
|
||||
|
||||
;
|
||||
final Long code;
|
||||
final String description;
|
||||
|
||||
EnvironmentEnum(Long code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package ai.chat2db.server.domain.api.enums;
|
||||
|
||||
import ai.chat2db.server.tools.base.enums.BaseEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Environment
|
||||
*
|
||||
* @author Jiaju Zhuang
|
||||
*/
|
||||
@Getter
|
||||
public enum EnvironmentStyleEnum implements BaseEnum<String> {
|
||||
/**
|
||||
* RELEASE
|
||||
*/
|
||||
RELEASE("RELEASE"),
|
||||
|
||||
/**
|
||||
* TEST
|
||||
*/
|
||||
TEST("TEST"),
|
||||
|
||||
;
|
||||
final String description;
|
||||
|
||||
EnvironmentStyleEnum(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return this.name();
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package ai.chat2db.server.domain.api.enums;
|
||||
|
||||
import ai.chat2db.server.tools.base.enums.BaseEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* role code
|
||||
*
|
||||
* @author Jiaju Zhuang
|
||||
*/
|
||||
@Getter
|
||||
public enum RoleCodeEnum implements BaseEnum<String> {
|
||||
/**
|
||||
* DESKTOP
|
||||
*/
|
||||
DESKTOP("DESKTOP"),
|
||||
|
||||
/**
|
||||
* USER
|
||||
*/
|
||||
USER("USER"),
|
||||
|
||||
/**
|
||||
* ADMIN
|
||||
*/
|
||||
ADMIN("ADMIN"),
|
||||
|
||||
;
|
||||
final String description;
|
||||
|
||||
RoleCodeEnum(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return this.name();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package ai.chat2db.server.domain.api.enums;
|
||||
|
||||
import ai.chat2db.server.tools.base.enums.BaseEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Is it a valid enumeration
|
||||
*
|
||||
* @author Jiaju Zhuang
|
||||
*/
|
||||
@Getter
|
||||
public enum ValidStatusEnum implements BaseEnum<String> {
|
||||
/**
|
||||
* VALID
|
||||
*/
|
||||
VALID("VALID"),
|
||||
|
||||
/**
|
||||
* INVALID
|
||||
*/
|
||||
INVALID("INVALID"),
|
||||
|
||||
;
|
||||
final String description;
|
||||
|
||||
ValidStatusEnum(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return this.name();
|
||||
}
|
||||
}
|
@ -99,7 +99,6 @@ public class DataSource {
|
||||
*/
|
||||
private String jdbc;
|
||||
|
||||
|
||||
/**
|
||||
* 扩展信息
|
||||
*/
|
||||
@ -110,14 +109,23 @@ public class DataSource {
|
||||
*/
|
||||
private DriverConfig driverConfig;
|
||||
|
||||
/**
|
||||
* 环境id
|
||||
*/
|
||||
private Long environmentId;
|
||||
|
||||
public LinkedHashMap<String,Object> getExtendMap() {
|
||||
/**
|
||||
* 环境
|
||||
*/
|
||||
private Environment environment;
|
||||
|
||||
public LinkedHashMap<String, Object> getExtendMap() {
|
||||
if (ObjectUtils.isEmpty(extendInfo)) {
|
||||
return new LinkedHashMap<>();
|
||||
}
|
||||
LinkedHashMap<String,Object> map = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
|
||||
for (KeyValue keyValue : extendInfo) {
|
||||
map.put(keyValue.getKey(),keyValue.getValue());
|
||||
map.put(keyValue.getKey(), keyValue.getValue());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
package ai.chat2db.server.domain.api.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import ai.chat2db.server.domain.api.enums.AccessObjectTypeEnum;
|
||||
import ai.chat2db.server.tools.base.constant.EasyToolsConstant;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* DataSource Access
|
||||
*
|
||||
* @author Jiaju Zhuang
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DataSourceAccess implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = EasyToolsConstant.SERIAL_VERSION_UID;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDateTime gmtCreate;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDateTime gmtModified;
|
||||
|
||||
/**
|
||||
* 创建人用户id
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 修改人用户id
|
||||
*/
|
||||
private Long modifiedUserId;
|
||||
|
||||
/**
|
||||
* 数据源id
|
||||
*/
|
||||
@NotNull
|
||||
private Long dataSourceId;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*
|
||||
* @see AccessObjectTypeEnum
|
||||
*/
|
||||
@NotNull
|
||||
private String accessObjectType;
|
||||
|
||||
/**
|
||||
* 授权id,根据类型区分是用户还是团队
|
||||
*/
|
||||
@NotNull
|
||||
private Long accessObjectId;
|
||||
|
||||
/**
|
||||
* 授权对象
|
||||
*/
|
||||
@NotNull
|
||||
private DataSourceAccessObject accessObject;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package ai.chat2db.server.domain.api.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import ai.chat2db.server.domain.api.enums.AccessObjectTypeEnum;
|
||||
import ai.chat2db.server.tools.base.constant.EasyToolsConstant;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* DataSource Access Object
|
||||
* It could be a user or a team
|
||||
*
|
||||
* @author Jiaju Zhuang
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DataSourceAccessObject implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = EasyToolsConstant.SERIAL_VERSION_UID;
|
||||
|
||||
/**
|
||||
* 授权id,根据类型区分是用户还是团队
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*
|
||||
* @see AccessObjectTypeEnum
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* The name of the code that belongs to the authorization type, such as user account, team code
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* Code that belongs to the authorization type, such as user name, team name
|
||||
*/
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package ai.chat2db.server.domain.api.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import ai.chat2db.server.domain.api.enums.EnvironmentStyleEnum;
|
||||
import ai.chat2db.server.tools.base.constant.EasyToolsConstant;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* Environment
|
||||
*
|
||||
* @author Jiaju Zhuang
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Environment implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = EasyToolsConstant.SERIAL_VERSION_UID;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 环境名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 环境缩写
|
||||
*/
|
||||
private String shortName;
|
||||
|
||||
/**
|
||||
* 样式类型
|
||||
*
|
||||
* @see EnvironmentStyleEnum
|
||||
*/
|
||||
private String style;
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package ai.chat2db.server.domain.api.model;
|
||||
|
||||
import ai.chat2db.server.domain.api.enums.RoleCodeEnum;
|
||||
import ai.chat2db.server.domain.api.enums.ValidStatusEnum;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -18,26 +21,44 @@ public class User {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@NotNull
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@NotNull
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@NotNull
|
||||
private String nickName;
|
||||
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@NotNull
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*
|
||||
* @see RoleCodeEnum
|
||||
*/
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @see ValidStatusEnum
|
||||
*/
|
||||
private String status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user