mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-20 02:06:38 +08:00
发布 2.2.1
This commit is contained in:
parent
96cdd2490d
commit
fab58a4f77
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ruoyi-vue-plus",
|
"name": "ruoyi-vue-plus",
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"description": "RuoYi-Vue-Plus后台管理系统",
|
"description": "RuoYi-Vue-Plus后台管理系统",
|
||||||
"author": "LionLi",
|
"author": "LionLi",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -51,10 +51,10 @@ export function delConfig(configId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理参数缓存
|
// 刷新参数缓存
|
||||||
export function clearCache() {
|
export function refreshCache() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/config/clearCache',
|
url: '/system/config/refreshCache',
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,10 @@ export function delType(dictId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理参数缓存
|
// 刷新字典缓存
|
||||||
export function clearCache() {
|
export function refreshCache() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/type/clearCache',
|
url: '/system/dict/type/refreshCache',
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,17 @@
|
|||||||
<span>更新日志</span>
|
<span>更新日志</span>
|
||||||
</div>
|
</div>
|
||||||
<el-collapse accordion>
|
<el-collapse accordion>
|
||||||
|
<el-collapse-item title="v2.2.1 - 2021-5-29">
|
||||||
|
<ol>
|
||||||
|
<li>add 增加 security 权限框架 @Async 异步注解配置</li>
|
||||||
|
<li>update 优化数据权限sql 解决MP apply注入附带 AND 语法问题</li>
|
||||||
|
<li>update 优化dataScope参数防止注入</li>
|
||||||
|
<li>update 优化参数&字典缓存操作</li>
|
||||||
|
<li>update 增加修改包名文档</li>
|
||||||
|
<li>update 文档增加演示图例</li>
|
||||||
|
<li>fix 修复部门类sql符号错误</li>
|
||||||
|
</ol>
|
||||||
|
</el-collapse-item>
|
||||||
<el-collapse-item title="v2.2.0 - 2021-5-25">
|
<el-collapse-item title="v2.2.0 - 2021-5-25">
|
||||||
<ol>
|
<ol>
|
||||||
<li>同步升级 RuoYi-Vue 3.5.0</li>
|
<li>同步升级 RuoYi-Vue 3.5.0</li>
|
||||||
@ -180,7 +191,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 版本号
|
// 版本号
|
||||||
version: "2.2.0",
|
version: "2.2.1",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -99,9 +99,9 @@
|
|||||||
plain
|
plain
|
||||||
icon="el-icon-refresh"
|
icon="el-icon-refresh"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleClearCache"
|
@click="handleRefreshCache"
|
||||||
v-hasPermi="['system:config:remove']"
|
v-hasPermi="['system:config:remove']"
|
||||||
>清理缓存</el-button>
|
>刷新缓存</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -181,7 +181,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, clearCache } from "@/api/system/config";
|
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Config",
|
name: "Config",
|
||||||
@ -355,10 +355,10 @@ export default {
|
|||||||
this.exportLoading = false;
|
this.exportLoading = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 清理缓存按钮操作 */
|
/** 刷新缓存按钮操作 */
|
||||||
handleClearCache() {
|
handleRefreshCache() {
|
||||||
clearCache().then(response => {
|
refreshCache().then(() => {
|
||||||
this.msgSuccess("清理成功");
|
this.msgSuccess("刷新成功");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,9 @@
|
|||||||
plain
|
plain
|
||||||
icon="el-icon-refresh"
|
icon="el-icon-refresh"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleClearCache"
|
@click="handleRefreshCache"
|
||||||
v-hasPermi="['system:dict:remove']"
|
v-hasPermi="['system:dict:remove']"
|
||||||
>清理缓存</el-button>
|
>刷新缓存</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -189,7 +189,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listType, getType, delType, addType, updateType, exportType, clearCache } from "@/api/system/dict/type";
|
import { listType, getType, delType, addType, updateType, exportType, refreshCache } from "@/api/system/dict/type";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Dict",
|
name: "Dict",
|
||||||
@ -359,10 +359,10 @@ export default {
|
|||||||
this.exportLoading = false;
|
this.exportLoading = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 清理缓存按钮操作 */
|
/** 刷新缓存按钮操作 */
|
||||||
handleClearCache() {
|
handleRefreshCache() {
|
||||||
clearCache().then(response => {
|
refreshCache().then(() => {
|
||||||
this.msgSuccess("清理成功");
|
this.msgSuccess("刷新成功");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,16 @@ public class DictUtils
|
|||||||
return StrUtil.strip(propertyString.toString(), null, separator);
|
return StrUtil.strip(propertyString.toString(), null, separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定字典缓存
|
||||||
|
*
|
||||||
|
* @param key 字典键
|
||||||
|
*/
|
||||||
|
public static void removeDictCache(String key)
|
||||||
|
{
|
||||||
|
SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空字典缓存
|
* 清空字典缓存
|
||||||
*/
|
*/
|
||||||
|
@ -68,6 +68,7 @@ public class DataScopeAspect
|
|||||||
@Before("dataScopePointCut()")
|
@Before("dataScopePointCut()")
|
||||||
public void doBefore(JoinPoint point) throws Throwable
|
public void doBefore(JoinPoint point) throws Throwable
|
||||||
{
|
{
|
||||||
|
clearDataScope(point);
|
||||||
handleDataScope(point);
|
handleDataScope(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,17 +145,7 @@ public class DataScopeAspect
|
|||||||
|
|
||||||
if (StrUtil.isNotBlank(sqlString.toString()))
|
if (StrUtil.isNotBlank(sqlString.toString()))
|
||||||
{
|
{
|
||||||
Object params = joinPoint.getArgs()[0];
|
putDataScope(joinPoint, sqlString.substring(4));
|
||||||
if (Validator.isNotNull(params))
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
Method getParams = params.getClass().getDeclaredMethod("getParams", null);
|
|
||||||
Map<String, Object> invoke = (Map<String, Object>) getParams.invoke(params, null);
|
|
||||||
invoke.put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,4 +164,30 @@ public class DataScopeAspect
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接权限sql前先清空params.dataScope参数防止注入
|
||||||
|
*/
|
||||||
|
private void clearDataScope(final JoinPoint joinPoint)
|
||||||
|
{
|
||||||
|
Object params = joinPoint.getArgs()[0];
|
||||||
|
if (Validator.isNotNull(params))
|
||||||
|
{
|
||||||
|
putDataScope(joinPoint, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void putDataScope(JoinPoint joinPoint, String sql) {
|
||||||
|
Object params = joinPoint.getArgs()[0];
|
||||||
|
if (Validator.isNotNull(params))
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Method getParams = params.getClass().getDeclaredMethod("getParams", null);
|
||||||
|
Map<String, Object> invoke = (Map<String, Object>) getParams.invoke(params, null);
|
||||||
|
invoke.put(DATA_SCOPE, sql);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 方法未找到 不处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
import com.ruoyi.common.core.page.BaseMapperPlus;
|
import com.ruoyi.common.core.page.BaseMapperPlus;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典表 数据层
|
* 字典表 数据层
|
||||||
*
|
*
|
||||||
@ -10,4 +13,11 @@ import com.ruoyi.common.core.page.BaseMapperPlus;
|
|||||||
*/
|
*/
|
||||||
public interface SysDictDataMapper extends BaseMapperPlus<SysDictData> {
|
public interface SysDictDataMapper extends BaseMapperPlus<SysDictData> {
|
||||||
|
|
||||||
|
default List<SysDictData> selectDictDataByType(String dictType) {
|
||||||
|
return selectList(
|
||||||
|
new LambdaQueryWrapper<SysDictData>()
|
||||||
|
.eq(SysDictData::getStatus, "0")
|
||||||
|
.eq(SysDictData::getDictType, dictType)
|
||||||
|
.orderByAsc(SysDictData::getDictSort));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,22 @@ public interface ISysConfigService extends IServicePlus<SysConfig> {
|
|||||||
* @param configIds 需要删除的参数ID
|
* @param configIds 需要删除的参数ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteConfigByIds(Long[] configIds);
|
public void deleteConfigByIds(Long[] configIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存数据
|
* 加载参数缓存数据
|
||||||
*/
|
*/
|
||||||
public void clearCache();
|
public void loadingConfigCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空参数缓存数据
|
||||||
|
*/
|
||||||
|
public void clearConfigCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置参数缓存数据
|
||||||
|
*/
|
||||||
|
public void resetConfigCache();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验参数键名是否唯一
|
* 校验参数键名是否唯一
|
||||||
|
@ -47,7 +47,7 @@ public interface ISysDictDataService extends IServicePlus<SysDictData> {
|
|||||||
* @param dictCodes 需要删除的字典数据ID
|
* @param dictCodes 需要删除的字典数据ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDictDataByIds(Long[] dictCodes);
|
public void deleteDictDataByIds(Long[] dictCodes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存字典数据信息
|
* 新增保存字典数据信息
|
||||||
|
@ -62,12 +62,22 @@ public interface ISysDictTypeService extends IServicePlus<SysDictType> {
|
|||||||
* @param dictIds 需要删除的字典ID
|
* @param dictIds 需要删除的字典ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDictTypeByIds(Long[] dictIds);
|
public void deleteDictTypeByIds(Long[] dictIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存数据
|
* 加载字典缓存数据
|
||||||
*/
|
*/
|
||||||
public void clearCache();
|
public void loadingDictCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空字典缓存数据
|
||||||
|
*/
|
||||||
|
public void clearDictCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置字典缓存数据
|
||||||
|
*/
|
||||||
|
public void resetDictCache();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存字典类型信息
|
* 新增保存字典类型信息
|
||||||
|
@ -20,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -33,6 +32,9 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
|
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysConfigMapper configMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
@ -41,10 +43,7 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
|||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
List<SysConfig> configsList = baseMapper.selectList(new LambdaQueryWrapper<>());
|
loadingConfigCache();
|
||||||
for (SysConfig config : configsList) {
|
|
||||||
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -155,30 +154,46 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteConfigByIds(Long[] configIds) {
|
public void deleteConfigByIds(Long[] configIds) {
|
||||||
for (Long configId : configIds) {
|
for (Long configId : configIds) {
|
||||||
SysConfig config = selectConfigById(configId);
|
SysConfig config = selectConfigById(configId);
|
||||||
if (StrUtil.equals(UserConstants.YES, config.getConfigType())) {
|
if (StrUtil.equals(UserConstants.YES, config.getConfigType())) {
|
||||||
throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
||||||
}
|
}
|
||||||
|
configMapper.deleteById(configId);
|
||||||
|
redisCache.deleteObject(getCacheKey(config.getConfigKey()));
|
||||||
}
|
}
|
||||||
int count = baseMapper.deleteBatchIds(Arrays.asList(configIds));
|
|
||||||
if (count > 0) {
|
|
||||||
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
|
|
||||||
redisCache.deleteObject(keys);
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存数据
|
* 加载参数缓存数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void clearCache() {
|
public void loadingConfigCache() {
|
||||||
|
List<SysConfig> configsList = selectConfigList(new SysConfig());
|
||||||
|
for (SysConfig config : configsList) {
|
||||||
|
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空参数缓存数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void clearConfigCache() {
|
||||||
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
|
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
|
||||||
redisCache.deleteObject(keys);
|
redisCache.deleteObject(keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置参数缓存数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void resetConfigCache() {
|
||||||
|
clearConfigCache();
|
||||||
|
loadingConfigCache();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验参数键名是否唯一
|
* 校验参数键名是否唯一
|
||||||
*
|
*
|
||||||
|
@ -11,7 +11,6 @@ import com.ruoyi.system.mapper.SysDictDataMapper;
|
|||||||
import com.ruoyi.system.service.ISysDictDataService;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +28,7 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
|
|||||||
.like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel())
|
.like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel())
|
||||||
.eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus())
|
.eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus())
|
||||||
.orderByAsc(SysDictData::getDictSort);
|
.orderByAsc(SysDictData::getDictSort);
|
||||||
return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw));
|
return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,25 +80,27 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteDictDataByIds(Long[] dictCodes) {
|
public void deleteDictDataByIds(Long[] dictCodes) {
|
||||||
int row = baseMapper.deleteBatchIds(Arrays.asList(dictCodes));
|
for (Long dictCode : dictCodes) {
|
||||||
if (row > 0) {
|
SysDictData data = selectDictDataById(dictCode);
|
||||||
DictUtils.clearDictCache();
|
baseMapper.deleteById(dictCode);
|
||||||
|
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
|
||||||
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
}
|
}
|
||||||
return row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存字典数据信息
|
* 新增保存字典数据信息
|
||||||
*
|
*
|
||||||
* @param dictData 字典数据信息
|
* @param data 字典数据信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertDictData(SysDictData dictData) {
|
public int insertDictData(SysDictData data) {
|
||||||
int row = baseMapper.insert(dictData);
|
int row = baseMapper.insert(data);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
DictUtils.clearDictCache();
|
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
|
||||||
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
@ -107,14 +108,15 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
|
|||||||
/**
|
/**
|
||||||
* 修改保存字典数据信息
|
* 修改保存字典数据信息
|
||||||
*
|
*
|
||||||
* @param dictData 字典数据信息
|
* @param data 字典数据信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateDictData(SysDictData dictData) {
|
public int updateDictData(SysDictData data) {
|
||||||
int row = baseMapper.updateById(dictData);
|
int row = baseMapper.updateById(data);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
DictUtils.clearDictCache();
|
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
|
||||||
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -33,6 +32,9 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService {
|
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDictTypeMapper dictTypeMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictDataMapper dictDataMapper;
|
private SysDictDataMapper dictDataMapper;
|
||||||
|
|
||||||
@ -41,15 +43,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
|||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
List<SysDictType> dictTypeList = list();
|
loadingDictCache();
|
||||||
for (SysDictType dictType : dictTypeList) {
|
|
||||||
List<SysDictData> dictDatas = dictDataMapper.selectList(
|
|
||||||
new LambdaQueryWrapper<SysDictData>()
|
|
||||||
.eq(SysDictData::getStatus, 0)
|
|
||||||
.eq(SysDictData::getDictType, dictType.getDictType())
|
|
||||||
.orderByAsc(SysDictData::getDictSort));
|
|
||||||
DictUtils.setDictCache(dictType.getDictType(), dictDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -65,7 +59,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
|||||||
.apply(Validator.isNotEmpty(params.get("endTime")),
|
.apply(Validator.isNotEmpty(params.get("endTime")),
|
||||||
"date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')",
|
"date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')",
|
||||||
params.get("endTime"));
|
params.get("endTime"));
|
||||||
return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw));
|
return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,9 +72,9 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
|||||||
public List<SysDictType> selectDictTypeList(SysDictType dictType) {
|
public List<SysDictType> selectDictTypeList(SysDictType dictType) {
|
||||||
Map<String, Object> params = dictType.getParams();
|
Map<String, Object> params = dictType.getParams();
|
||||||
return list(new LambdaQueryWrapper<SysDictType>()
|
return list(new LambdaQueryWrapper<SysDictType>()
|
||||||
.like(StrUtil.isNotBlank(dictType.getDictName()),SysDictType::getDictName, dictType.getDictName())
|
.like(StrUtil.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName())
|
||||||
.eq(StrUtil.isNotBlank(dictType.getStatus()),SysDictType::getStatus, dictType.getStatus())
|
.eq(StrUtil.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus())
|
||||||
.like(StrUtil.isNotBlank(dictType.getDictType()),SysDictType::getDictType, dictType.getDictType())
|
.like(StrUtil.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType())
|
||||||
.apply(Validator.isNotEmpty(params.get("beginTime")),
|
.apply(Validator.isNotEmpty(params.get("beginTime")),
|
||||||
"date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')",
|
"date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')",
|
||||||
params.get("beginTime"))
|
params.get("beginTime"))
|
||||||
@ -111,10 +105,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
|||||||
if (CollUtil.isNotEmpty(dictDatas)) {
|
if (CollUtil.isNotEmpty(dictDatas)) {
|
||||||
return dictDatas;
|
return dictDatas;
|
||||||
}
|
}
|
||||||
dictDatas = dictDataMapper.selectList(new LambdaQueryWrapper<SysDictData>()
|
dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||||
.eq(SysDictData::getStatus, 0)
|
|
||||||
.eq(SysDictData::getDictType, dictType)
|
|
||||||
.orderByAsc(SysDictData::getDictSort));
|
|
||||||
if (CollUtil.isNotEmpty(dictDatas)) {
|
if (CollUtil.isNotEmpty(dictDatas)) {
|
||||||
DictUtils.setDictCache(dictType, dictDatas);
|
DictUtils.setDictCache(dictType, dictDatas);
|
||||||
return dictDatas;
|
return dictDatas;
|
||||||
@ -151,40 +142,58 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteDictTypeByIds(Long[] dictIds) {
|
public void deleteDictTypeByIds(Long[] dictIds) {
|
||||||
for (Long dictId : dictIds) {
|
for (Long dictId : dictIds) {
|
||||||
SysDictType dictType = selectDictTypeById(dictId);
|
SysDictType dictType = selectDictTypeById(dictId);
|
||||||
if (dictDataMapper.selectCount(new LambdaQueryWrapper<SysDictData>()
|
if (dictDataMapper.selectCount(new LambdaQueryWrapper<SysDictData>()
|
||||||
.eq(SysDictData::getDictType, dictType.getDictType())) > 0) {
|
.eq(SysDictData::getDictType, dictType.getDictType())) > 0) {
|
||||||
throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
||||||
}
|
}
|
||||||
|
dictTypeMapper.deleteById(dictId);
|
||||||
|
DictUtils.removeDictCache(dictType.getDictType());
|
||||||
}
|
}
|
||||||
int count = baseMapper.deleteBatchIds(Arrays.asList(dictIds));
|
|
||||||
if (count > 0) {
|
|
||||||
DictUtils.clearDictCache();
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存数据
|
* 加载字典缓存数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void clearCache() {
|
public void loadingDictCache() {
|
||||||
|
List<SysDictType> dictTypeList = list();
|
||||||
|
for (SysDictType dictType : dictTypeList) {
|
||||||
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());
|
||||||
|
DictUtils.setDictCache(dictType.getDictType(), dictDatas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空字典缓存数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void clearDictCache() {
|
||||||
DictUtils.clearDictCache();
|
DictUtils.clearDictCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置字典缓存数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void resetDictCache() {
|
||||||
|
clearDictCache();
|
||||||
|
loadingDictCache();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存字典类型信息
|
* 新增保存字典类型信息
|
||||||
*
|
*
|
||||||
* @param dictType 字典类型信息
|
* @param dict 字典类型信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertDictType(SysDictType dictType) {
|
public int insertDictType(SysDictType dict) {
|
||||||
int row = baseMapper.insert(dictType);
|
int row = baseMapper.insert(dict);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
DictUtils.clearDictCache();
|
DictUtils.setDictCache(dict.getDictType(), null);
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
@ -192,19 +201,20 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
|||||||
/**
|
/**
|
||||||
* 修改保存字典类型信息
|
* 修改保存字典类型信息
|
||||||
*
|
*
|
||||||
* @param dictType 字典类型信息
|
* @param dict 字典类型信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int updateDictType(SysDictType dictType) {
|
public int updateDictType(SysDictType dict) {
|
||||||
SysDictType oldDict = getById(dictType.getDictId());
|
SysDictType oldDict = getById(dict.getDictId());
|
||||||
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
||||||
.set(SysDictData::getDictType, dictType.getDictType())
|
.set(SysDictData::getDictType, dict.getDictType())
|
||||||
.eq(SysDictData::getDictType, oldDict.getDictType()));
|
.eq(SysDictData::getDictType, oldDict.getDictType()));
|
||||||
int row = baseMapper.updateById(dictType);
|
int row = baseMapper.updateById(dict);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
DictUtils.clearDictCache();
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
|
||||||
|
DictUtils.setDictCache(dict.getDictType(), dictDatas);
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
@ -110,18 +110,19 @@ public class SysConfigController extends BaseController
|
|||||||
@DeleteMapping("/{configIds}")
|
@DeleteMapping("/{configIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||||
{
|
{
|
||||||
return toAjax(configService.deleteConfigByIds(configIds));
|
configService.deleteConfigByIds(configIds);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存
|
* 刷新参数缓存
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/clearCache")
|
@DeleteMapping("/refreshCache")
|
||||||
public AjaxResult clearCache()
|
public AjaxResult refreshCache()
|
||||||
{
|
{
|
||||||
configService.clearCache();
|
configService.resetConfigCache();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@ public class SysDictDataController extends BaseController
|
|||||||
@DeleteMapping("/{dictCodes}")
|
@DeleteMapping("/{dictCodes}")
|
||||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||||
{
|
{
|
||||||
return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
|
dictDataService.deleteDictDataByIds(dictCodes);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,18 +96,19 @@ public class SysDictTypeController extends BaseController
|
|||||||
@DeleteMapping("/{dictIds}")
|
@DeleteMapping("/{dictIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||||
{
|
{
|
||||||
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
|
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存
|
* 刷新字典缓存
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/clearCache")
|
@DeleteMapping("/refreshCache")
|
||||||
public AjaxResult clearCache()
|
public AjaxResult refreshCache()
|
||||||
{
|
{
|
||||||
dictTypeService.clearCache();
|
dictTypeService.resetDictCache();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,9 @@
|
|||||||
AND status = #{status}
|
AND status = #{status}
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
<if test="params.dataScope != null and params.dataScope != ''">
|
||||||
|
AND ( ${params.dataScope} )
|
||||||
|
</if>
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -50,8 +52,7 @@
|
|||||||
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||||
where rd.role_id = #{roleId}
|
where rd.role_id = #{roleId}
|
||||||
<if test="deptCheckStrictly">
|
<if test="deptCheckStrictly">
|
||||||
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id =
|
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
|
||||||
rd.dept_id and rd.role_id = #{roleId})
|
|
||||||
</if>
|
</if>
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
@ -58,7 +58,9 @@
|
|||||||
and date_format(r.create_time,'%y%m%d') <= date_format(#{role.params.endTime},'%y%m%d')
|
and date_format(r.create_time,'%y%m%d') <= date_format(#{role.params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${role.params.dataScope}
|
<if test="role.params.dataScope != null and role.params.dataScope != ''">
|
||||||
|
AND ( ${role.params.dataScope} )
|
||||||
|
</if>
|
||||||
order by r.role_sort
|
order by r.role_sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -81,7 +83,9 @@
|
|||||||
and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
<if test="params.dataScope != null and params.dataScope != ''">
|
||||||
|
AND ( ${params.dataScope} )
|
||||||
|
</if>
|
||||||
order by r.role_sort
|
order by r.role_sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -106,7 +106,9 @@
|
|||||||
ancestors) ))
|
ancestors) ))
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${user.params.dataScope}
|
<if test="user.params.dataScope != null and user.params.dataScope != ''">
|
||||||
|
AND ( ${user.params.dataScope} )
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||||
@ -135,7 +137,9 @@
|
|||||||
ancestors) ))
|
ancestors) ))
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
<if test="params.dataScope != null and params.dataScope != ''">
|
||||||
|
AND ( ${params.dataScope} )
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||||
|
Loading…
Reference in New Issue
Block a user