This commit is contained in:
D 2023-12-13 14:09:08 +08:00
parent 4157da1e2b
commit a2073eb2c7
7 changed files with 19 additions and 7 deletions

View File

@ -1,3 +1,8 @@
{ {
"java.configuration.updateBuildConfiguration": "interactive" "java.configuration.updateBuildConfiguration": "interactive",
"files.associations": {
"*.yml": "yaml"
},
"java.compile.nullAnalysis.mode": "disabled",
// "java.compile.nullAnalysis.mode": "automatic"
} }

View File

@ -30,7 +30,7 @@
<velocity.version>2.3</velocity.version> <velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version> <jwt.version>0.9.1</jwt.version>
<knife4j.version>4.3.0</knife4j.version> <knife4j.version>4.3.0</knife4j.version>
<mybatis-spring-boot.version>3.0.2</mybatis-spring-boot.version> <mybatis-spring-boot.version>3.0.3</mybatis-spring-boot.version>
</properties> </properties>
@ -41,7 +41,7 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId> <artifactId>spring-boot-dependencies</artifactId>
<version>3.1.5</version> <version>3.2.0</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>

View File

@ -6,6 +6,7 @@ import org.springframework.data.redis.serializer.SerializationException;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONReader; import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.JSONWriter; import com.alibaba.fastjson2.JSONWriter;
// import com.alibaba.fastjson2.filter.Filter;
/** /**
* Redis使用FastJson序列化 * Redis使用FastJson序列化
@ -16,6 +17,11 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
{ {
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
// static final Filter autoTypeFilter = JSONReader.autoTypeFilter(
// 按需加上需要支持自动类型的类名前缀范围越小越安全
// "org.springframework.security.core.authority.SimpleGrantedAuthority"
// );
private Class<T> clazz; private Class<T> clazz;
public FastJson2JsonRedisSerializer(Class<T> clazz) public FastJson2JsonRedisSerializer(Class<T> clazz)
@ -44,5 +50,6 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
String str = new String(bytes, DEFAULT_CHARSET); String str = new String(bytes, DEFAULT_CHARSET);
return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType); return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType);
// return JSON.parseObject(str, clazz, autoTypeFilter);
} }
} }

View File

@ -161,7 +161,7 @@ public class SysConfigServiceImpl implements ISysConfigService
SysConfig config = selectConfigById(configId); SysConfig config = selectConfigById(configId);
if (StringUtils.equals(UserConstants.YES, config.getConfigType())) if (StringUtils.equals(UserConstants.YES, config.getConfigType()))
{ {
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); throw new ServiceException("内置参数【%1$s】不能删除 ".formatted(config.getConfigKey()));
} }
configMapper.deleteConfigById(configId); configMapper.deleteConfigById(configId);
redisCache.deleteObject(getCacheKey(config.getConfigKey())); redisCache.deleteObject(getCacheKey(config.getConfigKey()));

View File

@ -124,7 +124,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
SysDictType dictType = selectDictTypeById(dictId); SysDictType dictType = selectDictTypeById(dictId);
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
{ {
throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName())); throw new ServiceException("%1$s已分配,不能删除".formatted(dictType.getDictName()));
} }
dictTypeMapper.deleteDictTypeById(dictId); dictTypeMapper.deleteDictTypeById(dictId);
DictUtils.removeDictCache(dictType.getDictType()); DictUtils.removeDictCache(dictType.getDictType());

View File

@ -146,7 +146,7 @@ public class SysPostServiceImpl implements ISysPostService
SysPost post = selectPostById(postId); SysPost post = selectPostById(postId);
if (countUserPostById(postId) > 0) if (countUserPostById(postId) > 0)
{ {
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName())); throw new ServiceException("%1$s已分配,不能删除".formatted(post.getPostName()));
} }
} }
return postMapper.deletePostByIds(postIds); return postMapper.deletePostByIds(postIds);

View File

@ -365,7 +365,7 @@ public class SysRoleServiceImpl implements ISysRoleService
SysRole role = selectRoleById(roleId); SysRole role = selectRoleById(roleId);
if (countUserRoleByRoleId(roleId) > 0) if (countUserRoleByRoleId(roleId) > 0)
{ {
throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); throw new ServiceException("%1$s已分配,不能删除".formatted(role.getRoleName()));
} }
} }
// 删除角色与菜单关联 // 删除角色与菜单关联