This commit is contained in:
六如
2024-12-26 09:37:50 +08:00
parent 054560ae64
commit 150379c5f9
44 changed files with 26 additions and 1482 deletions

View File

@@ -11,7 +11,6 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public enum ConfigKeyEnum {
PASSWORD_SALT("admin.password-salt", ""),
JWT_TIMEOUT_DAYS("admin.jwt-timeout-days", "365"),
JWT_SECRET("admin.jwt.secret", ""),
TORNA_SERVER_ADDR("admin.torna-server-addr", ""),

View File

@@ -1,111 +0,0 @@
package com.gitee.sop.website.dao.entity;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 表名api_info
* 备注:接口信息表
*
* @author 六如
*/
@Table(name = "api_info", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class ApiInfo {
/**
* id
*/
private Long id;
/**
* 所属应用
*/
private String application;
/**
* 接口名称
*/
private String apiName;
/**
* 版本号
*/
private String apiVersion;
/**
* 接口描述
*/
private String description;
/**
* 备注
*/
private String remark;
/**
* 接口class
*/
private String interfaceClassName;
/**
* 方法名称
*/
private String methodName;
/**
* 参数信息
*/
private String paramInfo;
/**
* 接口是否需要授权访问
*/
private Integer isPermission;
/**
* 是否需要appAuthToken
*/
private Integer isNeedToken;
/**
* 是否有公共响应参数
*/
private Integer hasCommonResponse;
/**
* 注册来源1-系统注册,2-手动注册
*/
private Integer regSource;
/**
* 1启用0禁用
*/
private Integer status;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 最后更新人id
*/
private Long updateBy;
}

View File

@@ -1,60 +0,0 @@
package com.gitee.sop.website.dao.entity;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 表名isv_info
* 备注isv信息表
*
* @author 六如
*/
@Table(name = "isv_info", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class IsvInfo {
/**
* id
*/
private Long id;
/**
* appKey
*/
private String appId;
/**
* 1启用2禁用
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 最后更新人id
*/
private Long updateBy;
}

View File

@@ -1,75 +0,0 @@
package com.gitee.sop.website.dao.entity;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 表名isv_keys
* 备注ISV秘钥管理
*
* @author 六如
*/
@Table(name = "isv_keys", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class IsvKeys {
/**
* id
*/
private Long id;
/**
* isv_info.id
*/
private Long isvId;
/**
* 秘钥格式1PKCS8(JAVA适用)2PKCS1(非JAVA适用)
*/
private Integer keyFormat;
/**
* 开发者生成的公钥
*/
private String publicKeyIsv;
/**
* 开发者生成的私钥(交给开发者)
*/
private String privateKeyIsv;
/**
* 平台生成的公钥(交给开发者)
*/
private String publicKeyPlatform;
/**
* 平台生成的私钥
*/
private String privateKeyPlatform;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 最后更新人id
*/
private Long updateBy;
}

View File

@@ -1,56 +0,0 @@
package com.gitee.sop.website.dao.entity;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 表名perm_group
* 备注:分组表
*
* @author 六如
*/
@Table(name = "perm_group", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class PermGroup {
/**
* id
*/
private Long id;
/**
* 分组名称
*/
private String groupName;
/**
* 是否删除
*/
@com.gitee.fastmybatis.annotation.Column(logicDelete = true)
private Integer isDeleted;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 最后更新人id
*/
private Long updateBy;
}

View File

@@ -1,55 +0,0 @@
package com.gitee.sop.website.dao.entity;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 表名perm_group_permission
* 备注:组权限表
*
* @author 六如
*/
@Table(name = "perm_group_permission", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class PermGroupPermission {
/**
* id
*/
private Long id;
/**
* 组id
*/
private Long groupId;
/**
* api_info.id
*/
private Long apiId;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 最后更新人id
*/
private Long updateBy;
}

View File

@@ -1,46 +0,0 @@
package com.gitee.sop.website.dao.entity;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 表名perm_isv_group
* 备注isv分组
*
* @author 六如
*/
@Table(name = "perm_isv_group", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class PermIsvGroup {
private Long id;
/**
* isv_info表id
*/
private Long isvId;
/**
* 组id
*/
private Long groupId;
private LocalDateTime addTime;
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 最后更新人id
*/
private Long updateBy;
}

View File

@@ -1,80 +0,0 @@
package com.gitee.sop.website.dao.entity;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 表名sys_admin_user
* 备注:系统用户表
*
* @author 六如
*/
@Table(name = "sys_admin_user", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class SysAdminUser {
/**
* id
*/
private Long id;
/**
* 用户名
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 用户名
*/
private String nickname;
/**
* 邮箱
*/
private String email;
/**
* 头像
*/
private String avatar;
/**
* 状态1启用2禁用
*/
private Integer status;
/**
* 注册类型1-系统2-手动
*/
private String regType;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 最后更新人id
*/
private Long updateBy;
}

View File

@@ -1,73 +0,0 @@
package com.gitee.sop.website.dao.entity;
import java.time.LocalDateTime;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
/**
* 表名sys_dept
* 备注:部门表
*
* @author 六如
*/
@Table(name = "sys_dept", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class SysDept {
/**
* id
*/
private Long id;
/**
* 部门名称
*/
private String name;
/**
* 排序
*/
private Integer sort;
/**
* 状态1启用2禁用
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 父级id
*/
private Long parentId;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 修改人id
*/
private Long updateBy;
}

View File

@@ -1,159 +0,0 @@
package com.gitee.sop.website.dao.entity;
import java.time.LocalDateTime;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
/**
* 表名sys_resource
* 备注:菜单资源表
*
* @author 六如
*/
@Table(name = "sys_resource", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class SysResource {
/**
* id
*/
private Long id;
/**
* 菜单类型0代表菜单、1代表iframe、2代表外链、3代表按钮
*/
private Integer menuType;
/**
* 菜单名称
*/
private String title;
/**
* 路由名称
*/
private String name;
/**
* 路由路径
*/
private String path;
/**
* 路由路径
*/
private String component;
/**
* 排序
*/
private Integer rank;
/**
* 路由重定向
*/
private String redirect;
/**
* 菜单图标
*/
private String icon;
/**
* 右侧图标
*/
private String extraIcon;
/**
* 进场动画(页面加载动画)
*/
private String enterTransition;
/**
* 离场动画(页面加载动画)
*/
private String leaveTransition;
/**
* 菜单激活
*/
private String activePath;
/**
* 权限标识
*/
private String auths;
/**
* 链接地址(需要内嵌的`iframe`链接地址)
*/
private String frameSrc;
/**
* 加载动画(内嵌的`iframe`页面是否开启首次加载动画)
*/
private Integer frameLoading;
/**
* 缓存页面
*/
private Integer keepAlive;
/**
* 标签页(当前菜单名称或自定义信息禁止添加到标签页)
*/
private Integer hiddenTag;
/**
* 固定标签页(当前菜单名称是否固定显示在标签页且不可关闭)
*/
private Integer fixedTag;
/**
* 菜单(是否显示该菜单)
*/
private Integer showLink;
/**
* 父级菜单(是否显示父级菜单
*/
private Integer showParent;
/**
* 父级id
*/
private Long parentId;
/**
* 是否删除
*/
@com.gitee.fastmybatis.annotation.Column(logicDelete = true)
private Integer isDeleted;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 修改人id
*/
private Long updateBy;
}

View File

@@ -1,71 +0,0 @@
package com.gitee.sop.website.dao.entity;
import java.time.LocalDateTime;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
/**
* 表名sys_role
* 备注:角色表
*
* @author 六如
*/
@Table(name = "sys_role", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class SysRole {
/**
* id
*/
private Long id;
/**
* 角色名称
*/
private String name;
/**
* 角色code
*/
private String code;
/**
* 备注
*/
private String remark;
/**
* 状态1启用2禁用
*/
private Integer status;
@com.gitee.fastmybatis.annotation.Column(logicDelete = true)
private Integer isDeleted;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 修改人id
*/
private Long updateBy;
}

View File

@@ -1,58 +0,0 @@
package com.gitee.sop.website.dao.entity;
import java.time.LocalDateTime;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
/**
* 表名sys_role_resource
* 备注:角色资源关联表
*
* @author 六如
*/
@Table(name = "sys_role_resource", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class SysRoleResource {
/**
* id
*/
private Long id;
/**
* sys_role.id
*/
private Long roleId;
/**
* sys_resource.id
*/
private Long resourceId;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 修改人id
*/
private Long updateBy;
}

View File

@@ -1,98 +0,0 @@
package com.gitee.sop.website.dao.entity;
import java.time.LocalDateTime;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
/**
* 表名sys_user
* 备注:系统用户表
*
* @author 六如
*/
@Table(name = "sys_user", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class SysUser {
/**
* id
*/
private Long id;
/**
* 用户名
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 昵称
*/
private String nickname;
/**
* 邮箱
*/
private String phone;
/**
* 邮箱
*/
private String email;
/**
* 头像
*/
private String avatar;
/**
* 性别,0-未知,1-男,2-女
*/
private Integer gender;
/**
* 状态1启用2禁用
*/
private Integer status;
/**
* 注册类型1-系统2-手动
*/
private String regType;
/**
* 备注
*/
private String remark;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 修改人id
*/
private Long updateBy;
}

View File

@@ -1,58 +0,0 @@
package com.gitee.sop.website.dao.entity;
import java.time.LocalDateTime;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
/**
* 表名sys_user_dept
* 备注:用户部门关联表
*
* @author 六如
*/
@Table(name = "sys_user_dept", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class SysUserDept {
/**
* id
*/
private Long id;
/**
* sys_user.id
*/
private Long userId;
/**
* sys_dept.id
*/
private Long deptId;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 修改人id
*/
private Long updateBy;
}

View File

@@ -1,58 +0,0 @@
package com.gitee.sop.website.dao.entity;
import java.time.LocalDateTime;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;
/**
* 表名sys_user_role
* 备注:用户角色关联表
*
* @author 六如
*/
@Table(name = "sys_user_role", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
@Data
public class SysUserRole {
/**
* id
*/
private Long id;
/**
* sys_role.id
*/
private Long roleId;
/**
* sys_user.id
*/
private Long userId;
/**
* 添加时间
*/
private LocalDateTime addTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 创建人id
*/
private Long addBy;
/**
* 修改人id
*/
private Long updateBy;
}

View File

@@ -1,21 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.ApiInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface ApiInfoMapper extends BaseMapper<ApiInfo> {
default ApiInfo getByNameVersion(String apiName, String apiVersion) {
return this.query()
.eq(ApiInfo::getApiName, apiName)
.eq(ApiInfo::getApiVersion, apiVersion)
.get();
}
}

View File

@@ -9,9 +9,4 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface DocAppMapper extends BaseMapper<DocApp> {
default String getToken(Long id) {
return this.query()
.eq(DocApp::getId, id)
.getValue(DocApp::getToken);
}
}

View File

@@ -1,17 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.IsvInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface IsvInfoMapper extends BaseMapper<IsvInfo> {
default IsvInfo getByAppId(String appId) {
return this.get(IsvInfo::getAppId, appId);
}
}

View File

@@ -1,15 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.IsvKeys;
/**
* @author 六如
*/
public interface IsvKeysMapper extends BaseMapper<IsvKeys> {
default IsvKeys getByIsvInfoId(Long isvId) {
return this.get(IsvKeys::getIsvId, isvId);
}
}

View File

@@ -1,11 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.PermGroup;
/**
* @author 六如
*/
public interface PermGroupMapper extends BaseMapper<PermGroup> {
}

View File

@@ -1,11 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.PermGroupPermission;
/**
* @author 六如
*/
public interface PermGroupPermissionMapper extends BaseMapper<PermGroupPermission> {
}

View File

@@ -1,13 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.PermIsvGroup;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface PermIsvGroupMapper extends BaseMapper<PermIsvGroup> {
}

View File

@@ -1,11 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.SysAdminUser;
/**
* @author 六如
*/
public interface SysAdminUserMapper extends BaseMapper<SysAdminUser> {
}

View File

@@ -1,13 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.SysDept;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface SysDeptMapper extends BaseMapper<SysDept> {
}

View File

@@ -1,13 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.SysResource;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface SysResourceMapper extends BaseMapper<SysResource> {
}

View File

@@ -1,13 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.SysRole;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface SysRoleMapper extends BaseMapper<SysRole> {
}

View File

@@ -1,13 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.SysRoleResource;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface SysRoleResourceMapper extends BaseMapper<SysRoleResource> {
}

View File

@@ -1,13 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.SysUserDept;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface SysUserDeptMapper extends BaseMapper<SysUserDept> {
}

View File

@@ -1,13 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
}

View File

@@ -1,13 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import com.gitee.fastmybatis.core.mapper.BaseMapper;
import com.gitee.sop.website.dao.entity.SysUserRole;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 六如
*/
@Mapper
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
}

View File

@@ -1,27 +0,0 @@
package com.gitee.sop.website.dao.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author tanghc
*/
@Mapper
public interface UpgradeMapper {
void runSql(@Param("sql") String sql);
/**
* 查看MYSQL表字段信息
* @param tableName 表名
* @return 返回字段信息
*/
List<Map<String, Object>> listColumnInfo(@Param("tableName") String tableName);
List<String> listTableName();
List<Map<String, Object>> listTableIndex(@Param("tableName") String tableName);
}

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.gitee.sop.adminbackend.dao.mapper.UpgradeMapper">
<update id="runSql">
${sql}
</update>
<select id="listColumnInfo" resultType="java.util.Map">
SHOW COLUMNS FROM ${tableName}
</select>
<select id="listTableName" resultType="String">
SHOW TABLES
</select>
<select id="listTableIndex" resultType="java.util.Map">
show index from ${tableName}
</select>
</mapper>

View File

@@ -2,10 +2,8 @@ package com.gitee.sop.website.service.sys;
import com.gitee.fastmybatis.core.support.BaseLambdaService;
import com.gitee.sop.website.common.config.IConfig;
import com.gitee.sop.website.common.util.CopyUtil;
import com.gitee.sop.website.dao.entity.SysConfig;
import com.gitee.sop.website.dao.mapper.SysConfigMapper;
import com.gitee.sop.website.service.sys.dto.SystemConfigDTO;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@@ -13,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
@@ -37,41 +34,6 @@ public class SysConfigService extends BaseLambdaService<SysConfig, SysConfigMapp
}
});
public void save(Collection<SystemConfigDTO> configs) {
configs.forEach(this::setConfig);
}
public String getRawValue(String key) {
return this.query()
.eq(SysConfig::getConfigKey, key)
.getValue(SysConfig::getConfigValue);
}
public void setConfig(String key, String value) {
setConfig(key, value, "");
}
public void setConfig(String key, String value, String remark) {
SystemConfigDTO systemConfigDTO = new SystemConfigDTO();
systemConfigDTO.setConfigKey(key);
systemConfigDTO.setConfigValue(value);
systemConfigDTO.setRemark(remark);
setConfig(systemConfigDTO);
}
public void setConfig(SystemConfigDTO systemConfigDTO) {
Objects.requireNonNull(systemConfigDTO.getConfigKey(), "need key");
Objects.requireNonNull(systemConfigDTO.getConfigValue(), "need value");
SysConfig systemConfig = get(SysConfig::getConfigKey, systemConfigDTO.getConfigKey());
if (systemConfig == null) {
systemConfig = CopyUtil.copyBean(systemConfigDTO, SysConfig::new);
this.save(systemConfig);
} else {
CopyUtil.copyPropertiesIgnoreNull(systemConfigDTO, systemConfig);
this.update(systemConfig);
}
configCache.invalidate(systemConfigDTO.getConfigKey());
}
/**
* 获取配置信息