Merge remote-tracking branch 'origin/master'

# Conflicts:
#	README.md
#	ruoyi-ui/README.md
This commit is contained in:
wh 2020-07-09 12:16:46 +08:00
commit eb48abafef
84 changed files with 920 additions and 649 deletions

161
README.md
View File

@ -1,80 +1,81 @@
## 平台简介 ## 平台简介
* 前端采用Vue、Element UI、Vue-Element-Admin。 * 前端采用Vue、Element UI。
* 后端采用Spring Boot、Spring Security、Redis & Jwt。 * 后端采用Spring Boot、Spring Security、Redis & Jwt。
* 权限认证使用Jwt支持多终端认证系统。 * 权限认证使用Jwt支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。 * 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。 * 高效率开发,使用代码生成器可以一键生成前后端代码。
* 感谢[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin)[eladmin-web](https://gitee.com/elunez/eladmin-web?_from=gitee_search)。 * 提供了一个Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) * 感谢[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin)[eladmin-web](https://gitee.com/elunez/eladmin-web?_from=gitee_search)。
* 阿里云优惠券:[点我进入](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)   * 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 阿里云优惠券:[点我进入](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)  
## 内置功能
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
3. 岗位管理:配置系统用户所属担任职务。 2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 3. 岗位管理:配置系统用户所属担任职务。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
7. 参数管理:对系统动态配置常用参数。 6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
8. 通知公告:系统通知公告信息发布维护。 7. 参数管理:对系统动态配置常用参数。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 8. 通知公告:系统通知公告信息发布维护。
10. 登录日志:系统登录日志记录查询包含登录异常。 9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
11. 在线用户:当前系统中活跃用户状态监控。 10. 登录日志:系统登录日志记录查询包含登录异常。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 11. 在线用户:当前系统中活跃用户状态监控。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。 12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
14. 系统接口根据业务代码自动生成相关的api接口文档。 13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。 14. 系统接口根据业务代码自动生成相关的api接口文档。
16. 在线构建器拖动表单元素生成相应的HTML代码。 15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
17. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。 16. 在线构建器拖动表单元素生成相应的HTML代码。
17. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 在线体验
## 在线体验
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 - admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://vue.ruoyi.vip
文档地址http://doc.ruoyi.vip 演示地址http://vue.ruoyi.vip
文档地址http://doc.ruoyi.vip
## 演示图
## 演示图
<table>
<tr> <table>
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td> <td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
</tr> <td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
<tr> </tr>
<td><img src="https://oscimg.oschina.net/oscnet/707825ad3f29de74a8d6d02fbd73ad631ea.jpg"/></td> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/46be40cc6f01aa300eed53a19b5012bf484.jpg"/></td> <td><img src="https://oscimg.oschina.net/oscnet/707825ad3f29de74a8d6d02fbd73ad631ea.jpg"/></td>
</tr> <td><img src="https://oscimg.oschina.net/oscnet/46be40cc6f01aa300eed53a19b5012bf484.jpg"/></td>
<tr> </tr>
<td><img src="https://oscimg.oschina.net/oscnet/4284796d4cea240d181b8f2201813dda710.jpg"/></td> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/3ecfac87a049f7fe36abbcaafb2c40d36cf.jpg"/></td> <td><img src="https://oscimg.oschina.net/oscnet/4284796d4cea240d181b8f2201813dda710.jpg"/></td>
</tr> <td><img src="https://oscimg.oschina.net/oscnet/3ecfac87a049f7fe36abbcaafb2c40d36cf.jpg"/></td>
<tr> </tr>
<td><img src="https://oscimg.oschina.net/oscnet/71c2d48905221a09a728df4aff4160b8607.jpg"/></td> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/c14c1ee9a64a6a9c2c22f67d43198767dbe.jpg"/></td> <td><img src="https://oscimg.oschina.net/oscnet/71c2d48905221a09a728df4aff4160b8607.jpg"/></td>
</tr> <td><img src="https://oscimg.oschina.net/oscnet/c14c1ee9a64a6a9c2c22f67d43198767dbe.jpg"/></td>
<tr> </tr>
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td> <td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
</tr> <td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
<tr> </tr>
<td><img src="https://oscimg.oschina.net/oscnet/fdea1d8bb8625c27bf964176a2c8ebc6945.jpg"/></td> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/509d2708cfd762b6e6339364cac1cc1970c.jpg"/></td> <td><img src="https://oscimg.oschina.net/oscnet/fdea1d8bb8625c27bf964176a2c8ebc6945.jpg"/></td>
</tr> <td><img src="https://oscimg.oschina.net/oscnet/509d2708cfd762b6e6339364cac1cc1970c.jpg"/></td>
<tr> </tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-f1fd681cc9d295db74e85ad6d2fe4389454.png"/></td> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-f1fd681cc9d295db74e85ad6d2fe4389454.png"/></td>
</tr> <td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
<tr> </tr>
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-6d73c2140ce694e3de4c05035fdc1868d4c.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
</tr> <td><img src="https://oscimg.oschina.net/oscnet/up-6d73c2140ce694e3de4c05035fdc1868d4c.png"/></td>
</table> </tr>
</table>
## 若依前后端分离交流群
## 若依前后端分离交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) 点击按钮入群。
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) 点击按钮入群。

View File

@ -1,11 +1,11 @@
{ {
"name": "ruoyi", "name": "ruoyi",
"version": "2.2.0", "version": "2.3.0",
"description": "若依管理系统", "description": "若依管理系统",
"author": "若依", "author": "若依",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "vue-cli-service serve", "dev": "vue-cli-service serve --open",
"build:prod": "vue-cli-service build", "build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging", "build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",

View File

@ -0,0 +1,2 @@
User-agent: *
Disallow: /

View File

@ -51,6 +51,14 @@ export function delConfig(configId) {
}) })
} }
// 清理参数缓存
export function clearCache() {
return request({
url: '/system/config/clearCache',
method: 'delete'
})
}
// 导出参数 // 导出参数
export function exportConfig(query) { export function exportConfig(query) {
return request({ return request({

View File

@ -20,7 +20,7 @@ export function getData(dictCode) {
// 根据字典类型查询字典数据信息 // 根据字典类型查询字典数据信息
export function getDicts(dictType) { export function getDicts(dictType) {
return request({ return request({
url: '/system/dict/data/dictType/' + dictType, url: '/system/dict/data/type/' + dictType,
method: 'get' method: 'get'
}) })
} }

View File

@ -43,6 +43,14 @@ export function delType(dictId) {
}) })
} }
// 清理参数缓存
export function clearCache() {
return request({
url: '/system/dict/type/clearCache',
method: 'delete'
})
}
// 导出字典类型 // 导出字典类型
export function exportType(query) { export function exportType(query) {
return request({ return request({

View File

@ -6,7 +6,7 @@
/* theme color */ /* theme color */
$--color-primary: #1890ff; $--color-primary: #1890ff;
$--color-success: #13ce66; $--color-success: #13ce66;
$--color-warning: #FFBA00; $--color-warning: #ffba00;
$--color-danger: #ff4949; $--color-danger: #ff4949;
// $--color-info: #1E1E1E; // $--color-info: #1E1E1E;

View File

@ -57,12 +57,16 @@
margin-top: 6vh !important; margin-top: 6vh !important;
} }
.el-table .el-table__header-wrapper th { .el-table {
word-break: break-word; .el-table__header-wrapper, .el-table__fixed-header-wrapper {
background-color: #f8f8f9; th {
color: #515a6e; word-break: break-word;
height: 40px; background-color: #f8f8f9;
font-size: 13px; color: #515a6e;
height: 40px;
font-size: 13px;
}
}
} }
/** 表单布局 **/ /** 表单布局 **/

View File

@ -70,7 +70,12 @@ export default {
this.show = false this.show = false
}, },
change(val) { change(val) {
this.$router.push(val.path) if(this.ishttp(val.path)) {
// http(s)://
window.open(val.path, "_blank");
} else {
this.$router.push(val.path)
}
this.search = '' this.search = ''
this.options = [] this.options = []
this.$nextTick(() => { this.$nextTick(() => {
@ -104,7 +109,7 @@ export default {
if (router.hidden) { continue } if (router.hidden) { continue }
const data = { const data = {
path: path.resolve(basePath, router.path), path: !this.ishttp(router.path) ? path.resolve(basePath, router.path) : router.path,
title: [...prefixTitle] title: [...prefixTitle]
} }
@ -134,6 +139,9 @@ export default {
} else { } else {
this.options = [] this.options = []
} }
},
ishttp(url) {
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
} }
} }
} }

View File

@ -25,10 +25,9 @@ export default {
}, },
methods: { methods: {
filterIcons() { filterIcons() {
this.iconList = icons
if (this.name) { if (this.name) {
this.iconList = this.iconList.filter(item => item.includes(this.name)) this.iconList = this.iconList.filter(item => item.includes(this.name))
} else {
this.iconList = icons
} }
}, },
selectedIcon(name) { selectedIcon(name) {

View File

@ -1,7 +1,7 @@
<template> <template>
<div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" /> <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
<svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners"> <svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
<use :href="iconName" /> <use :xlink:href="iconName" />
</svg> </svg>
</template> </template>

View File

@ -1,7 +1,5 @@
<template> <template>
<!-- eslint-disable vue/require-component-is --> <component :is="type" v-bind="linkProps(to)">
<component v-bind="linkProps(to)">
<slot /> <slot />
</component> </component>
</template> </template>
@ -16,19 +14,28 @@ export default {
required: true required: true
} }
}, },
computed: {
isExternal() {
return isExternal(this.to)
},
type() {
if (this.isExternal) {
return 'a'
}
return 'router-link'
}
},
methods: { methods: {
linkProps(url) { linkProps(to) {
if (isExternal(url)) { if (this.isExternal) {
return { return {
is: 'a', href: to,
href: url,
target: '_blank', target: '_blank',
rel: 'noopener' rel: 'noopener'
} }
} }
return { return {
is: 'router-link', to: to
to: url
} }
} }
} }

View File

@ -13,8 +13,8 @@
mode="vertical" mode="vertical"
> >
<sidebar-item <sidebar-item
v-for="route in permission_routes" v-for="(route, index) in permission_routes"
:key="route.path" :key="route.path + index"
:item="route" :item="route"
:base-path="route.path" :base-path="route.path"
/> />

View File

@ -19,12 +19,21 @@ export default {
return this.$refs.scrollContainer.$refs.wrap return this.$refs.scrollContainer.$refs.wrap
} }
}, },
mounted() {
this.scrollWrapper.addEventListener('scroll', this.emitScroll, true)
},
beforeDestroy() {
this.scrollWrapper.removeEventListener('scroll', this.emitScroll)
},
methods: { methods: {
handleScroll(e) { handleScroll(e) {
const eventDelta = e.wheelDelta || -e.deltaY * 40 const eventDelta = e.wheelDelta || -e.deltaY * 40
const $scrollWrapper = this.scrollWrapper const $scrollWrapper = this.scrollWrapper
$scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4 $scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4
}, },
emitScroll() {
this.$emit('scroll')
},
moveToTarget(currentTag) { moveToTarget(currentTag) {
const $container = this.$refs.scrollContainer.$el const $container = this.$refs.scrollContainer.$el
const $containerWidth = $container.offsetWidth const $containerWidth = $container.offsetWidth

View File

@ -1,318 +1,303 @@
<template> <template>
<div id="tags-view-container" class="tags-view-container"> <div id="tags-view-container" class="tags-view-container">
<scroll-pane ref="scrollPane" class="tags-view-wrapper"> <scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll">
<router-link <router-link
v-for="tag in visitedViews" v-for="tag in visitedViews"
ref="tag" ref="tag"
:key="tag.path" :key="tag.path"
:class="isActive(tag)?'active':''" :class="isActive(tag)?'active':''"
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
tag="span" tag="span"
class="tags-view-item" class="tags-view-item"
:style="activeStyle(tag)" :style="activeStyle(tag)"
@click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''" @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''"
@contextmenu.prevent.native="openMenu(tag,$event)" @contextmenu.prevent.native="openMenu(tag,$event)"
> >
{{ tag.title }} {{ tag.title }}
<span <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
v-if="!isAffix(tag)" </router-link>
class="el-icon-close" </scroll-pane>
@click.prevent.stop="closeSelectedTag(tag)" <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
/> <li @click="refreshSelectedTag(selectedTag)">刷新页面</li>
</router-link> <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li>
</scroll-pane> <li @click="closeOthersTags">关闭其他</li>
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu"> <li @click="closeAllTags(selectedTag)">关闭所有</li>
<li @click="refreshSelectedTag(selectedTag)">刷新页面</li> </ul>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li> </div>
<li @click="closeOthersTags">关闭其他</li>
<li @click="closeAllTags(selectedTag)">关闭所有</li>
</ul>
</div>
</template> </template>
<script> <script>
import ScrollPane from "./ScrollPane"; import ScrollPane from './ScrollPane'
import path from "path"; import path from 'path'
export default { export default {
components: { ScrollPane }, components: { ScrollPane },
data() { data() {
return { return {
visible: false, visible: false,
top: 0, top: 0,
left: 0, left: 0,
selectedTag: {}, selectedTag: {},
affixTags: [] affixTags: []
};
},
computed: {
visitedViews() {
return this.$store.state.tagsView.visitedViews;
},
routes() {
return this.$store.state.permission.routes;
},
theme() {
return this.$store.state.settings.theme;
}
},
watch: {
$route() {
this.addTags();
this.moveToCurrentTag();
},
visible(value) {
if (value) {
document.body.addEventListener("click", this.closeMenu);
} else {
document.body.removeEventListener("click", this.closeMenu);
}
}
},
mounted() {
this.initTags();
this.addTags();
},
methods: {
isActive(route) {
return route.path === this.$route.path;
},
activeStyle(tag) {
if (!this.isActive(tag)) return {};
return {
"background-color": this.theme,
"border-color": this.theme
};
},
isAffix(tag) {
return tag.meta && tag.meta.affix;
},
filterAffixTags(routes, basePath = "/") {
let tags = [];
routes.forEach(route => {
if (route.meta && route.meta.affix) {
const tagPath = path.resolve(basePath, route.path);
tags.push({
fullPath: tagPath,
path: tagPath,
name: route.name,
meta: { ...route.meta }
});
}
if (route.children) {
const tempTags = this.filterAffixTags(
route.children,
route.path
);
if (tempTags.length >= 1) {
tags = [...tags, ...tempTags];
}
}
});
return tags;
},
initTags() {
const affixTags = (this.affixTags = this.filterAffixTags(
this.routes
));
for (const tag of affixTags) {
// Must have tag name
if (tag.name) {
this.$store.dispatch("tagsView/addVisitedView", tag);
}
}
},
addTags() {
const { name } = this.$route;
if (name) {
this.$store.dispatch("tagsView/addView", this.$route);
}
return false;
},
moveToCurrentTag() {
const tags = this.$refs.tag;
this.$nextTick(() => {
for (const tag of tags) {
if (tag.to.path === this.$route.path) {
this.$refs.scrollPane.moveToTarget(tag);
// when query is different then update
if (tag.to.fullPath !== this.$route.fullPath) {
this.$store.dispatch(
"tagsView/updateVisitedView",
this.$route
);
}
break;
}
}
});
},
refreshSelectedTag(view) {
this.$store.dispatch("tagsView/delCachedView", view).then(() => {
const { fullPath } = view;
this.$nextTick(() => {
this.$router.replace({
path: "/redirect" + fullPath
});
});
});
},
closeSelectedTag(view) {
this.$store
.dispatch("tagsView/delView", view)
.then(({ visitedViews }) => {
if (this.isActive(view)) {
this.toLastView(visitedViews, view);
}
});
},
closeOthersTags() {
this.$router.push(this.selectedTag);
this.$store
.dispatch("tagsView/delOthersViews", this.selectedTag)
.then(() => {
this.moveToCurrentTag();
});
},
closeAllTags(view) {
this.$store
.dispatch("tagsView/delAllViews")
.then(({ visitedViews }) => {
if (this.affixTags.some(tag => tag.path === view.path)) {
return;
}
this.toLastView(visitedViews, view);
});
},
toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0];
if (latestView) {
this.$router.push(latestView.fullPath);
} else {
// now the default is to redirect to the home page if there is no tags-view,
// you can adjust it according to your needs.
if (view.name === "Dashboard") {
// to reload home page
this.$router.replace({ path: "/redirect" + view.fullPath });
} else {
this.$router.push("/");
}
}
},
openMenu(tag, e) {
const menuMinWidth = 105;
const offsetLeft = this.$el.getBoundingClientRect().left; // container margin left
const offsetWidth = this.$el.offsetWidth; // container width
const maxLeft = offsetWidth - menuMinWidth; // left boundary
const left = e.clientX - offsetLeft + 15; // 15: margin right
if (left > maxLeft) {
this.left = maxLeft;
} else {
this.left = left;
}
this.top = e.clientY;
this.visible = true;
this.selectedTag = tag;
},
closeMenu() {
this.visible = false;
}
} }
}; },
computed: {
visitedViews() {
return this.$store.state.tagsView.visitedViews
},
routes() {
return this.$store.state.permission.routes
},
theme() {
return this.$store.state.settings.theme;
}
},
watch: {
$route() {
this.addTags()
this.moveToCurrentTag()
},
visible(value) {
if (value) {
document.body.addEventListener('click', this.closeMenu)
} else {
document.body.removeEventListener('click', this.closeMenu)
}
}
},
mounted() {
this.initTags()
this.addTags()
},
methods: {
isActive(route) {
return route.path === this.$route.path
},
activeStyle(tag) {
if (!this.isActive(tag)) return {};
return {
"background-color": this.theme,
"border-color": this.theme
};
},
isAffix(tag) {
return tag.meta && tag.meta.affix
},
filterAffixTags(routes, basePath = '/') {
let tags = []
routes.forEach(route => {
if (route.meta && route.meta.affix) {
const tagPath = path.resolve(basePath, route.path)
tags.push({
fullPath: tagPath,
path: tagPath,
name: route.name,
meta: { ...route.meta }
})
}
if (route.children) {
const tempTags = this.filterAffixTags(route.children, route.path)
if (tempTags.length >= 1) {
tags = [...tags, ...tempTags]
}
}
})
return tags
},
initTags() {
const affixTags = this.affixTags = this.filterAffixTags(this.routes)
for (const tag of affixTags) {
// Must have tag name
if (tag.name) {
this.$store.dispatch('tagsView/addVisitedView', tag)
}
}
},
addTags() {
const { name } = this.$route
if (name) {
this.$store.dispatch('tagsView/addView', this.$route)
}
return false
},
moveToCurrentTag() {
const tags = this.$refs.tag
this.$nextTick(() => {
for (const tag of tags) {
if (tag.to.path === this.$route.path) {
this.$refs.scrollPane.moveToTarget(tag)
// when query is different then update
if (tag.to.fullPath !== this.$route.fullPath) {
this.$store.dispatch('tagsView/updateVisitedView', this.$route)
}
break
}
}
})
},
refreshSelectedTag(view) {
this.$store.dispatch('tagsView/delCachedView', view).then(() => {
const { fullPath } = view
this.$nextTick(() => {
this.$router.replace({
path: '/redirect' + fullPath
})
})
})
},
closeSelectedTag(view) {
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
if (this.isActive(view)) {
this.toLastView(visitedViews, view)
}
})
},
closeOthersTags() {
this.$router.push(this.selectedTag)
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
this.moveToCurrentTag()
})
},
closeAllTags(view) {
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
if (this.affixTags.some(tag => tag.path === view.path)) {
return
}
this.toLastView(visitedViews, view)
})
},
toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
this.$router.push(latestView.fullPath)
} else {
// now the default is to redirect to the home page if there is no tags-view,
// you can adjust it according to your needs.
if (view.name === 'Dashboard') {
// to reload home page
this.$router.replace({ path: '/redirect' + view.fullPath })
} else {
this.$router.push('/')
}
}
},
openMenu(tag, e) {
const menuMinWidth = 105
const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
const offsetWidth = this.$el.offsetWidth // container width
const maxLeft = offsetWidth - menuMinWidth // left boundary
const left = e.clientX - offsetLeft + 15 // 15: margin right
if (left > maxLeft) {
this.left = maxLeft
} else {
this.left = left
}
this.top = e.clientY
this.visible = true
this.selectedTag = tag
},
closeMenu() {
this.visible = false
},
handleScroll() {
this.closeMenu()
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.tags-view-container { .tags-view-container {
height: 34px; height: 34px;
width: 100%; width: 100%;
background: #fff;
border-bottom: 1px solid #d8dce5;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
.tags-view-wrapper {
.tags-view-item {
display: inline-block;
position: relative;
cursor: pointer;
height: 26px;
line-height: 26px;
border: 1px solid #d8dce5;
color: #495060;
background: #fff;
padding: 0 8px;
font-size: 12px;
margin-left: 5px;
margin-top: 4px;
&:first-of-type {
margin-left: 15px;
}
&:last-of-type {
margin-right: 15px;
}
&.active {
background-color: #42b983;
color: #fff;
border-color: #42b983;
&::before {
content: '';
background: #fff;
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
position: relative;
margin-right: 2px;
}
}
}
}
.contextmenu {
margin: 0;
background: #fff; background: #fff;
border-bottom: 1px solid #d8dce5; z-index: 3000;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04); position: absolute;
.tags-view-wrapper { list-style-type: none;
.tags-view-item { padding: 5px 0;
display: inline-block; border-radius: 4px;
position: relative; font-size: 12px;
cursor: pointer; font-weight: 400;
height: 26px; color: #333;
line-height: 26px; box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
border: 1px solid #d8dce5; li {
color: #495060; margin: 0;
background: #fff; padding: 7px 16px;
padding: 0 8px; cursor: pointer;
font-size: 12px; &:hover {
margin-left: 5px; background: #eee;
margin-top: 4px; }
&:first-of-type {
margin-left: 15px;
}
&:last-of-type {
margin-right: 15px;
}
&.active {
background-color: #42b983;
color: #fff;
border-color: #42b983;
&::before {
content: "";
background: #fff;
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
position: relative;
margin-right: 2px;
}
}
}
}
.contextmenu {
margin: 0;
background: #fff;
z-index: 3000;
position: absolute;
list-style-type: none;
padding: 5px 0;
border-radius: 4px;
font-size: 12px;
font-weight: 400;
color: #333;
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
li {
margin: 0;
padding: 7px 16px;
cursor: pointer;
&:hover {
background: #eee;
}
}
} }
}
} }
</style> </style>
<style lang="scss"> <style lang="scss">
//reset element css of el-icon-close //reset element css of el-icon-close
.tags-view-wrapper { .tags-view-wrapper {
.tags-view-item { .tags-view-item {
.el-icon-close { .el-icon-close {
width: 16px; width: 16px;
height: 16px; height: 16px;
vertical-align: 2px; vertical-align: 2px;
border-radius: 50%; border-radius: 50%;
text-align: center; text-align: center;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); transition: all .3s cubic-bezier(.645, .045, .355, 1);
transform-origin: 100% 50%; transform-origin: 100% 50%;
&:before { &:before {
transform: scale(0.6); transform: scale(.6);
display: inline-block; display: inline-block;
vertical-align: -3px; vertical-align: -3px;
} }
&:hover { &:hover {
background-color: #b4bccc; background-color: #b4bccc;
color: #fff; color: #fff;
} }
}
} }
}
} }
</style> </style>

View File

@ -53,7 +53,7 @@ router.beforeEach((to, from, next) => {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next() next()
} else { } else {
next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done() NProgress.done()
} }
} }

View File

@ -111,7 +111,7 @@ export const constantRoutes = [
hidden: true, hidden: true,
children: [ children: [
{ {
path: 'edit', path: 'edit/:tableId(\\d+)',
component: (resolve) => require(['@/views/tool/gen/editTable'], resolve), component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
name: 'GenEdit', name: 'GenEdit',
meta: { title: '修改生成配置' } meta: { title: '修改生成配置' }

View File

@ -133,7 +133,7 @@
<!-- 添加或修改定时任务对话框 --> <!-- 添加或修改定时任务对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务名称" prop="jobName"> <el-form-item label="任务名称" prop="jobName">
@ -438,8 +438,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -448,8 +446,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -87,7 +87,7 @@
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['monitor:jobLog:export']" v-hasPermi="['monitor:job:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
</el-row> </el-row>
@ -196,9 +196,7 @@ export default {
jobName: undefined, jobName: undefined,
jobGroup: undefined, jobGroup: undefined,
status: undefined status: undefined
}, }
//
form: {}
}; };
}, },
created() { created() {

View File

@ -39,7 +39,7 @@
<el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" /> <el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="部门名称" align="center" prop="deptName" /> <el-table-column label="部门名称" align="center" prop="deptName" />
<el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" /> <el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" />
<el-table-column label="登录地点" align="center" prop="loginLocation" /> <el-table-column label="登录地点" align="center" prop="loginLocation" :show-overflow-tooltip="true" />
<el-table-column label="浏览器" align="center" prop="browser" /> <el-table-column label="浏览器" align="center" prop="browser" />
<el-table-column label="操作系统" align="center" prop="os" /> <el-table-column label="操作系统" align="center" prop="os" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180"> <el-table-column label="登录时间" align="center" prop="loginTime" width="180">

View File

@ -88,6 +88,15 @@
v-hasPermi="['system:config:export']" v-hasPermi="['system:config:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-refresh"
size="mini"
@click="handleClearCache"
v-hasPermi="['system:config:remove']"
>清理缓存</el-button>
</el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
@ -165,7 +174,7 @@
</template> </template>
<script> <script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig } from "@/api/system/config"; import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, clearCache } from "@/api/system/config";
export default { export default {
name: "Config", name: "Config",
@ -296,8 +305,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -306,8 +313,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }
@ -340,6 +345,14 @@ export default {
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg);
}).catch(function() {}); }).catch(function() {});
},
/** 清理缓存按钮操作 */
handleClearCache() {
clearCache().then(response => {
if (response.code === 200) {
this.msgSuccess("清理成功");
}
});
} }
} }
}; };

View File

@ -281,8 +281,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -291,8 +289,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -305,8 +305,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -315,8 +313,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -94,6 +94,15 @@
v-hasPermi="['system:dict:export']" v-hasPermi="['system:dict:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-refresh"
size="mini"
@click="handleClearCache"
v-hasPermi="['system:dict:remove']"
>清理缓存</el-button>
</el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
@ -173,7 +182,7 @@
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, exportType } from "@/api/system/dict/type"; import { listType, getType, delType, addType, updateType, exportType, clearCache } from "@/api/system/dict/type";
export default { export default {
name: "Dict", name: "Dict",
@ -300,8 +309,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -310,8 +317,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }
@ -344,6 +349,14 @@ export default {
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg);
}).catch(function() {}); }).catch(function() {});
},
/** 清理缓存按钮操作 */
handleClearCache() {
clearCache().then(response => {
if (response.code === 200) {
this.msgSuccess("清理成功");
}
});
} }
} }
}; };

View File

@ -340,8 +340,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -350,8 +348,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -308,8 +308,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -318,8 +316,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -277,8 +277,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -287,8 +285,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -482,8 +482,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -493,8 +491,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }
@ -510,8 +506,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.openDataScope = false; this.openDataScope = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -133,7 +133,7 @@
</el-row> </el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="40" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="用户编号" align="center" prop="userId" /> <el-table-column label="用户编号" align="center" prop="userId" />
<el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" /> <el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" prop="nickName" :show-overflow-tooltip="true" /> <el-table-column label="用户昵称" align="center" prop="nickName" :show-overflow-tooltip="true" />
@ -208,9 +208,11 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="归属部门" prop="deptId"> <el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" placeholder="请选择归属部门" /> <treeselect v-model="form.deptId" :options="deptOptions" :disable-branch-nodes="true" :show-count="true" placeholder="请选择归属部门" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" /> <el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
@ -221,6 +223,8 @@
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" /> <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName"> <el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" /> <el-input v-model="form.userName" placeholder="请输入用户名称" />
@ -231,6 +235,8 @@
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" /> <el-input v-model="form.password" placeholder="请输入用户密码" type="password" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="用户性别"> <el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择"> <el-select v-model="form.sex" placeholder="请选择">
@ -254,7 +260,8 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="岗位"> <el-form-item label="岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择"> <el-select v-model="form.postIds" multiple placeholder="请选择">
@ -281,6 +288,8 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
@ -572,8 +581,6 @@ export default {
resetUserPwd(row.userId, value).then(response => { resetUserPwd(row.userId, value).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功,新密码是:" + value); this.msgSuccess("修改成功,新密码是:" + value);
} else {
this.msgError(response.msg);
} }
}); });
}).catch(() => {}); }).catch(() => {});
@ -588,8 +595,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -598,8 +603,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -59,8 +59,6 @@ export default {
response => { response => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
} else {
this.msgError(response.msg);
} }
} }
); );

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<img v-bind:src="options.img" @click="editCropper()" title="点击上传头像" class="img-circle img-lg" /> <img v-bind:src="options.img" @click="editCropper()" title="点击上传头像" class="img-circle img-lg" />
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened">
<el-row> <el-row>
<el-col :xs="24" :md="12" :style="{height: '350px'}"> <el-col :xs="24" :md="12" :style="{height: '350px'}">
<vue-cropper <vue-cropper
@ -13,6 +13,7 @@
:autoCropHeight="options.autoCropHeight" :autoCropHeight="options.autoCropHeight"
:fixedBox="options.fixedBox" :fixedBox="options.fixedBox"
@realTime="realTime" @realTime="realTime"
v-if="visible"
/> />
</el-col> </el-col>
<el-col :xs="24" :md="12" :style="{height: '350px'}"> <el-col :xs="24" :md="12" :style="{height: '350px'}">
@ -67,6 +68,8 @@ export default {
return { return {
// //
open: false, open: false,
// cropper
visible: false,
// //
title: "修改头像", title: "修改头像",
options: { options: {
@ -84,6 +87,10 @@ export default {
editCropper() { editCropper() {
this.open = true; this.open = true;
}, },
//
modalOpened() {
this.visible = true;
},
// //
requestUpload() { requestUpload() {
}, },
@ -121,11 +128,10 @@ export default {
if (response.code === 200) { if (response.code === 200) {
this.open = false; this.open = false;
this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl; this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl;
store.commit('SET_AVATAR', this.options.img);
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
} else {
this.msgError(response.msg);
} }
this.$refs.cropper.clearCrop(); this.visible = false;
}); });
}); });
}, },

View File

@ -64,8 +64,6 @@ export default {
updateUserProfile(this.user).then(response => { updateUserProfile(this.user).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -147,8 +147,8 @@ export default {
info: {} info: {}
}; };
}, },
beforeCreate() { created() {
const { tableId } = this.$route.query; const tableId = this.$route.params && this.$route.params.tableId;
if (tableId) { if (tableId) {
// //
getGenTable(tableId).then(res => { getGenTable(tableId).then(res => {

View File

@ -270,7 +270,7 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEditTable(row) { handleEditTable(row) {
const tableId = row.tableId || this.ids[0]; const tableId = row.tableId || this.ids[0];
this.$router.push({ path: "/gen/edit", query: { tableId: tableId } }); this.$router.push("/gen/edit/" + tableId);
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {

View File

@ -82,12 +82,6 @@ module.exports = {
}) })
.end() .end()
config
// https://webpack.js.org/configuration/devtool/#development
.when(process.env.NODE_ENV === 'development',
config => config.devtool('cheap-source-map')
)
config config
.when(process.env.NODE_ENV !== 'development', .when(process.env.NODE_ENV !== 'development',
config => { config => {
@ -123,7 +117,11 @@ module.exports = {
} }
} }
}) })
config.optimization.runtimeChunk('single') config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, './public/robots.txt'),//防爬虫文件
to:'./',//到根目录下
}
} }
) )
} }

View File

@ -5,7 +5,7 @@
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>2.2.0</version> <version>2.3.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>ruoyi</name> <name>ruoyi</name>
@ -25,7 +25,7 @@
<java.version>1.8</java.version> <java.version>1.8</java.version>
<mybatis.spring.boot.starter.version>1.3.2</mybatis.spring.boot.starter.version> <mybatis.spring.boot.starter.version>1.3.2</mybatis.spring.boot.starter.version>
<pagehelper.spring.boot.starter.version>1.2.5</pagehelper.spring.boot.starter.version> <pagehelper.spring.boot.starter.version>1.2.5</pagehelper.spring.boot.starter.version>
<fastjson.version>1.2.68</fastjson.version> <fastjson.version>1.2.70</fastjson.version>
<druid.version>1.1.14</druid.version> <druid.version>1.1.14</druid.version>
<commons.io.version>2.5</commons.io.version> <commons.io.version>2.5</commons.io.version>
<commons.fileupload.version>1.3.3</commons.fileupload.version> <commons.fileupload.version>1.3.3</commons.fileupload.version>

View File

@ -120,8 +120,8 @@ create table sys_role (
-- ---------------------------- -- ----------------------------
-- 初始化-角色信息表数据 -- 初始化-角色信息表数据
-- ---------------------------- -- ----------------------------
insert into sys_role values('1', '管理员', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员'); insert into sys_role values('1', '系统管理员', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统管理员');
insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色'); insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色');
-- ---------------------------- -- ----------------------------

View File

@ -14,7 +14,7 @@ public class RuoYiApplication
{ {
public static void main(String[] args) public static void main(String[] args)
{ {
System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args); SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" + " .-------. ____ __ \n" +

View File

@ -109,6 +109,16 @@ public class Constants
*/ */
public static final String JWT_AUTHORITIES = "authorities"; public static final String JWT_AUTHORITIES = "authorities";
/**
* 参数管理 cache key
*/
public static final String SYS_CONFIG_KEY = "sys_config:";
/**
* 字典管理 cache key
*/
public static final String SYS_DICT_KEY = "sys_dict:";
/** /**
* 资源映射路径 前缀 * 资源映射路径 前缀
*/ */

View File

@ -5,7 +5,7 @@ package com.ruoyi.common.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public interface HttpStatus public class HttpStatus
{ {
/** /**
* 操作成功 * 操作成功

View File

@ -5,7 +5,7 @@ package com.ruoyi.common.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public interface ScheduleConstants public class ScheduleConstants
{ {
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";

View File

@ -376,6 +376,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
* *
* @return UUID 的哈希码值 * @return UUID 的哈希码值
*/ */
@Override
public int hashCode() public int hashCode()
{ {
long hilo = mostSigBits ^ leastSigBits; long hilo = mostSigBits ^ leastSigBits;
@ -391,6 +392,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
* *
* @return 如果对象相同则返回 {@code true}否则返回 {@code false} * @return 如果对象相同则返回 {@code true}否则返回 {@code false}
*/ */
@Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
if ((null == obj) || (obj.getClass() != UUID.class)) if ((null == obj) || (obj.getClass() != UUID.class))
@ -414,6 +416,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
* @return 在此 UUID 小于等于或大于 val 分别返回 -10 1 * @return 在此 UUID 小于等于或大于 val 分别返回 -10 1
* *
*/ */
@Override
public int compareTo(UUID val) public int compareTo(UUID val)
{ {
// The ordering is intentionally set up so that the UUIDs // The ordering is intentionally set up so that the UUIDs

View File

@ -0,0 +1,64 @@
package com.ruoyi.common.utils;
import java.util.Collection;
import java.util.List;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.redis.RedisCache;
import com.ruoyi.project.system.domain.SysDictData;
/**
* 字典工具类
*
* @author ruoyi
*/
public class DictUtils
{
/**
* 设置字典缓存
*
* @param key 参数键
* @param dictDatas 字典数据列表
*/
public static void setDictCache(String key, List<SysDictData> dictDatas)
{
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
}
/**
* 获取字典缓存
*
* @param key 参数键
* @return dictDatas 字典数据列表
*/
public static List<SysDictData> getDictCache(String key)
{
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj))
{
List<SysDictData> DictDatas = StringUtils.cast(cacheObj);
return DictDatas;
}
return null;
}
/**
* 清空字典缓存
*/
public static void clearDictCache()
{
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(Constants.SYS_DICT_KEY + "*");
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
}
/**
* 设置cache key
*
* @param configKey 参数键
* @return 缓存键key
*/
public static String getCacheKey(String configKey)
{
return Constants.SYS_DICT_KEY + configKey;
}
}

View File

@ -450,4 +450,10 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
} }
return sb.toString(); return sb.toString();
} }
@SuppressWarnings("unchecked")
public static <T> T cast(Object obj)
{
return (T) obj;
}
} }

View File

@ -139,10 +139,12 @@ public class VerifyCodeUtils
private static Color getRandColor(int fc, int bc) private static Color getRandColor(int fc, int bc)
{ {
if (fc > 255) if (fc > 255) {
fc = 255; fc = 255;
if (bc > 255) }
if (bc > 255) {
bc = 255; bc = 255;
}
int r = fc + random.nextInt(bc - fc); int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc); int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc); int b = fc + random.nextInt(bc - fc);

View File

@ -118,7 +118,7 @@ public class HttpUtils
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
try try
{ {
String urlNameString = url + "?" + param; String urlNameString = url;
log.info("sendPost - {}", urlNameString); log.info("sendPost - {}", urlNameString);
URL realUrl = new URL(urlNameString); URL realUrl = new URL(urlNameString);
URLConnection conn = realUrl.openConnection(); URLConnection conn = realUrl.openConnection();

View File

@ -4,6 +4,7 @@ import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.html.EscapeUtil;
/** /**
* 获取IP方法 * 获取IP方法
@ -40,8 +41,7 @@ public class IpUtils
{ {
ip = request.getRemoteAddr(); ip = request.getRemoteAddr();
} }
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : EscapeUtil.clean(ip);
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
} }
public static boolean internalIp(String ip) public static boolean internalIp(String ip)
@ -110,8 +110,9 @@ public class IpUtils
{ {
case 1: case 1:
l = Long.parseLong(elements[0]); l = Long.parseLong(elements[0]);
if ((l < 0L) || (l > 4294967295L)) if ((l < 0L) || (l > 4294967295L)) {
return null; return null;
}
bytes[0] = (byte) (int) (l >> 24 & 0xFF); bytes[0] = (byte) (int) (l >> 24 & 0xFF);
bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
@ -119,12 +120,14 @@ public class IpUtils
break; break;
case 2: case 2:
l = Integer.parseInt(elements[0]); l = Integer.parseInt(elements[0]);
if ((l < 0L) || (l > 255L)) if ((l < 0L) || (l > 255L)) {
return null; return null;
}
bytes[0] = (byte) (int) (l & 0xFF); bytes[0] = (byte) (int) (l & 0xFF);
l = Integer.parseInt(elements[1]); l = Integer.parseInt(elements[1]);
if ((l < 0L) || (l > 16777215L)) if ((l < 0L) || (l > 16777215L)) {
return null; return null;
}
bytes[1] = (byte) (int) (l >> 16 & 0xFF); bytes[1] = (byte) (int) (l >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF); bytes[3] = (byte) (int) (l & 0xFF);
@ -133,13 +136,15 @@ public class IpUtils
for (i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
{ {
l = Integer.parseInt(elements[i]); l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) if ((l < 0L) || (l > 255L)) {
return null; return null;
}
bytes[i] = (byte) (int) (l & 0xFF); bytes[i] = (byte) (int) (l & 0xFF);
} }
l = Integer.parseInt(elements[2]); l = Integer.parseInt(elements[2]);
if ((l < 0L) || (l > 65535L)) if ((l < 0L) || (l > 65535L)) {
return null; return null;
}
bytes[2] = (byte) (int) (l >> 8 & 0xFF); bytes[2] = (byte) (int) (l >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF); bytes[3] = (byte) (int) (l & 0xFF);
break; break;
@ -147,8 +152,9 @@ public class IpUtils
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
{ {
l = Integer.parseInt(elements[i]); l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) if ((l < 0L) || (l > 255L)) {
return null; return null;
}
bytes[i] = (byte) (int) (l & 0xFF); bytes[i] = (byte) (int) (l & 0xFF);
} }
break; break;

View File

@ -52,6 +52,11 @@ public class DataScopeAspect
*/ */
public static final String DATA_SCOPE_SELF = "5"; public static final String DATA_SCOPE_SELF = "5";
/**
* 数据权限过滤关键字
*/
public static final String DATA_SCOPE = "dataScope";
// 配置织入点 // 配置织入点
@Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.DataScope)") @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.DataScope)")
public void dataScopePointCut() public void dataScopePointCut()
@ -138,7 +143,7 @@ public class DataScopeAspect
if (StringUtils.isNotBlank(sqlString.toString())) if (StringUtils.isNotBlank(sqlString.toString()))
{ {
BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0]; BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0];
baseEntity.setDataScope(" AND (" + sqlString.substring(4) + ")"); baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
} }
} }

View File

@ -36,6 +36,7 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
this.clazz = clazz; this.clazz = clazz;
} }
@Override
public byte[] serialize(T t) throws SerializationException public byte[] serialize(T t) throws SerializationException
{ {
if (t == null) if (t == null)
@ -45,6 +46,7 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET);
} }
@Override
public T deserialize(byte[] bytes) throws SerializationException public T deserialize(byte[] bytes) throws SerializationException
{ {
if (bytes == null || bytes.length <= 0) if (bytes == null || bytes.length <= 0)

View File

@ -36,9 +36,6 @@ public class BaseEntity implements Serializable
/** 备注 */ /** 备注 */
private String remark; private String remark;
/** 数据权限 */
private String dataScope;
/** 开始时间 */ /** 开始时间 */
@JsonIgnore @JsonIgnore
private String beginTime; private String beginTime;
@ -110,16 +107,6 @@ public class BaseEntity implements Serializable
this.remark = remark; this.remark = remark;
} }
public String getDataScope()
{
return dataScope;
}
public void setDataScope(String dataScope)
{
this.dataScope = dataScope;
}
public String getBeginTime() public String getBeginTime()
{ {
return beginTime; return beginTime;

View File

@ -47,6 +47,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
* @param operIds 需要删除的操作日志ID * @param operIds 需要删除的操作日志ID
* @return 结果 * @return 结果
*/ */
@Override
public int deleteOperLogByIds(Long[] operIds) public int deleteOperLogByIds(Long[] operIds)
{ {
return operLogMapper.deleteOperLogByIds(operIds); return operLogMapper.deleteOperLogByIds(operIds);

View File

@ -118,4 +118,16 @@ public class SysConfigController extends BaseController
{ {
return toAjax(configService.deleteConfigByIds(configIds)); return toAjax(configService.deleteConfigByIds(configIds));
} }
/**
* 清空缓存
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/clearCache")
public AjaxResult clearCache()
{
configService.clearCache();
return AjaxResult.success();
}
} }

View File

@ -21,6 +21,7 @@ import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysDictData; import com.ruoyi.project.system.domain.SysDictData;
import com.ruoyi.project.system.service.ISysDictDataService; import com.ruoyi.project.system.service.ISysDictDataService;
import com.ruoyi.project.system.service.ISysDictTypeService;
/** /**
* 数据字典信息 * 数据字典信息
@ -34,6 +35,9 @@ public class SysDictDataController extends BaseController
@Autowired @Autowired
private ISysDictDataService dictDataService; private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysDictData dictData) public TableDataInfo list(SysDictData dictData)
@ -66,10 +70,10 @@ public class SysDictDataController extends BaseController
/** /**
* 根据字典类型查询字典数据信息 * 根据字典类型查询字典数据信息
*/ */
@GetMapping(value = "/dictType/{dictType}") @GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType) public AjaxResult dictType(@PathVariable String dictType)
{ {
return AjaxResult.success(dictDataService.selectDictDataByType(dictType)); return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
} }
/** /**

View File

@ -107,6 +107,18 @@ public class SysDictTypeController extends BaseController
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds)); return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
} }
/**
* 清空缓存
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/clearCache")
public AjaxResult clearCache()
{
dictTypeService.clearCache();
return AjaxResult.success();
}
/** /**
* 获取字典选择框列表 * 获取字典选择框列表
*/ */

View File

@ -42,10 +42,7 @@ public class SysLoginController
/** /**
* 登录方法 * 登录方法
* *
* @param username 用户名 * @param loginBody 登陆信息
* @param password 密码
* @param captcha 验证码
* @param uuid 唯一标识
* @return 结果 * @return 结果
*/ */
@PostMapping("/login") @PostMapping("/login")

View File

@ -48,7 +48,7 @@ public class SysPostController extends BaseController
} }
@Log(title = "岗位管理", businessType = BusinessType.EXPORT) @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')") @PreAuthorize("@ss.hasPermi('system:post:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysPost post) public AjaxResult export(SysPost post)
{ {

View File

@ -1,6 +1,7 @@
package com.ruoyi.project.system.controller; package com.ruoyi.project.system.controller;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -25,6 +26,7 @@ import com.ruoyi.framework.security.service.TokenService;
import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysRole;
import com.ruoyi.project.system.domain.SysUser; import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.ISysPostService; import com.ruoyi.project.system.service.ISysPostService;
import com.ruoyi.project.system.service.ISysRoleService; import com.ruoyi.project.system.service.ISysRoleService;
@ -101,7 +103,8 @@ public class SysUserController extends BaseController
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{ {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("roles", roleService.selectRoleAll()); List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId))
{ {

View File

@ -178,6 +178,7 @@ public class SysRole extends BaseEntity
this.deptIds = deptIds; this.deptIds = deptIds;
} }
@Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId()) .append("roleId", getRoleId())

View File

@ -50,14 +50,6 @@ public interface ISysConfigService
*/ */
public int updateConfig(SysConfig config); public int updateConfig(SysConfig config);
/**
* 删除参数配置信息
*
* @param configId 参数ID
* @return 结果
*/
public int deleteConfigById(Long configId);
/** /**
* 批量删除参数信息 * 批量删除参数信息
* *
@ -66,6 +58,11 @@ public interface ISysConfigService
*/ */
public int deleteConfigByIds(Long[] configIds); public int deleteConfigByIds(Long[] configIds);
/**
* 清空缓存数据
*/
public void clearCache();
/** /**
* 校验参数键名是否唯一 * 校验参数键名是否唯一
* *

View File

@ -18,14 +18,6 @@ public interface ISysDictDataService
*/ */
public List<SysDictData> selectDictDataList(SysDictData dictData); public List<SysDictData> selectDictDataList(SysDictData dictData);
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByType(String dictType);
/** /**
* 根据字典类型和字典键值查询字典数据信息 * 根据字典类型和字典键值查询字典数据信息
* *
@ -43,14 +35,6 @@ public interface ISysDictDataService
*/ */
public SysDictData selectDictDataById(Long dictCode); public SysDictData selectDictDataById(Long dictCode);
/**
* 通过字典ID删除字典数据信息
*
* @param dictCode 字典数据ID
* @return 结果
*/
public int deleteDictDataById(Long dictCode);
/** /**
* 批量删除字典数据信息 * 批量删除字典数据信息
* *

View File

@ -1,6 +1,7 @@
package com.ruoyi.project.system.service; package com.ruoyi.project.system.service;
import java.util.List; import java.util.List;
import com.ruoyi.project.system.domain.SysDictData;
import com.ruoyi.project.system.domain.SysDictType; import com.ruoyi.project.system.domain.SysDictType;
/** /**
@ -25,6 +26,14 @@ public interface ISysDictTypeService
*/ */
public List<SysDictType> selectDictTypeAll(); public List<SysDictType> selectDictTypeAll();
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByType(String dictType);
/** /**
* 根据字典类型ID查询信息 * 根据字典类型ID查询信息
* *
@ -41,14 +50,6 @@ public interface ISysDictTypeService
*/ */
public SysDictType selectDictTypeByType(String dictType); public SysDictType selectDictTypeByType(String dictType);
/**
* 通过字典ID删除字典信息
*
* @param dictId 字典ID
* @return 结果
*/
public int deleteDictTypeById(Long dictId);
/** /**
* 批量删除字典信息 * 批量删除字典信息
* *
@ -57,6 +58,11 @@ public interface ISysDictTypeService
*/ */
public int deleteDictTypeByIds(Long[] dictIds); public int deleteDictTypeByIds(Long[] dictIds);
/**
* 清空缓存数据
*/
public void clearCache();
/** /**
* 新增保存字典类型信息 * 新增保存字典类型信息
* *

View File

@ -1,10 +1,15 @@
package com.ruoyi.project.system.service.impl; package com.ruoyi.project.system.service.impl;
import java.util.Collection;
import java.util.List; import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.redis.RedisCache;
import com.ruoyi.project.system.domain.SysConfig; import com.ruoyi.project.system.domain.SysConfig;
import com.ruoyi.project.system.mapper.SysConfigMapper; import com.ruoyi.project.system.mapper.SysConfigMapper;
import com.ruoyi.project.system.service.ISysConfigService; import com.ruoyi.project.system.service.ISysConfigService;
@ -20,6 +25,22 @@ public class SysConfigServiceImpl implements ISysConfigService
@Autowired @Autowired
private SysConfigMapper configMapper; private SysConfigMapper configMapper;
@Autowired
private RedisCache redisCache;
/**
* 项目启动时初始化参数到缓存
*/
@PostConstruct
public void init()
{
List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
for (SysConfig config : configsList)
{
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
}
/** /**
* 查询参数配置信息 * 查询参数配置信息
* *
@ -43,10 +64,20 @@ public class SysConfigServiceImpl implements ISysConfigService
@Override @Override
public String selectConfigByKey(String configKey) public String selectConfigByKey(String configKey)
{ {
String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey)));
if (StringUtils.isNotEmpty(configValue))
{
return configValue;
}
SysConfig config = new SysConfig(); SysConfig config = new SysConfig();
config.setConfigKey(configKey); config.setConfigKey(configKey);
SysConfig retConfig = configMapper.selectConfig(config); SysConfig retConfig = configMapper.selectConfig(config);
return StringUtils.isNotNull(retConfig) ? retConfig.getConfigValue() : ""; if (StringUtils.isNotNull(retConfig))
{
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
return retConfig.getConfigValue();
}
return StringUtils.EMPTY;
} }
/** /**
@ -70,7 +101,12 @@ public class SysConfigServiceImpl implements ISysConfigService
@Override @Override
public int insertConfig(SysConfig config) public int insertConfig(SysConfig config)
{ {
return configMapper.insertConfig(config); int row = configMapper.insertConfig(config);
if (row > 0)
{
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
} }
/** /**
@ -82,19 +118,12 @@ public class SysConfigServiceImpl implements ISysConfigService
@Override @Override
public int updateConfig(SysConfig config) public int updateConfig(SysConfig config)
{ {
return configMapper.updateConfig(config); int row = configMapper.updateConfig(config);
} if (row > 0)
{
/** redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
* 删除参数配置信息 }
* return row;
* @param configId 参数ID
* @return 结果
*/
@Override
public int deleteConfigById(Long configId)
{
return configMapper.deleteConfigById(configId);
} }
/** /**
@ -106,7 +135,23 @@ public class SysConfigServiceImpl implements ISysConfigService
@Override @Override
public int deleteConfigByIds(Long[] configIds) public int deleteConfigByIds(Long[] configIds)
{ {
return configMapper.deleteConfigByIds(configIds); int count = configMapper.deleteConfigByIds(configIds);
if (count > 0)
{
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
redisCache.deleteObject(keys);
}
return count;
}
/**
* 清空缓存数据
*/
@Override
public void clearCache()
{
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
redisCache.deleteObject(keys);
} }
/** /**
@ -126,4 +171,15 @@ public class SysConfigServiceImpl implements ISysConfigService
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
/**
* 设置cache key
*
* @param configKey 参数键
* @return 缓存键key
*/
private String getCacheKey(String configKey)
{
return Constants.SYS_CONFIG_KEY + configKey;
}
} }

View File

@ -3,6 +3,7 @@ package com.ruoyi.project.system.service.impl;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.project.system.domain.SysDictData; import com.ruoyi.project.system.domain.SysDictData;
import com.ruoyi.project.system.mapper.SysDictDataMapper; import com.ruoyi.project.system.mapper.SysDictDataMapper;
import com.ruoyi.project.system.service.ISysDictDataService; import com.ruoyi.project.system.service.ISysDictDataService;
@ -30,18 +31,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService
return dictDataMapper.selectDictDataList(dictData); return dictDataMapper.selectDictDataList(dictData);
} }
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
@Override
public List<SysDictData> selectDictDataByType(String dictType)
{
return dictDataMapper.selectDictDataByType(dictType);
}
/** /**
* 根据字典类型和字典键值查询字典数据信息 * 根据字典类型和字典键值查询字典数据信息
* *
@ -67,27 +56,21 @@ public class SysDictDataServiceImpl implements ISysDictDataService
return dictDataMapper.selectDictDataById(dictCode); return dictDataMapper.selectDictDataById(dictCode);
} }
/**
* 通过字典ID删除字典数据信息
*
* @param dictCode 字典数据ID
* @return 结果
*/
@Override
public int deleteDictDataById(Long dictCode)
{
return dictDataMapper.deleteDictDataById(dictCode);
}
/** /**
* 批量删除字典数据信息 * 批量删除字典数据信息
* *
* @param dictCodes 需要删除的字典数据ID * @param dictCodes 需要删除的字典数据ID
* @return 结果 * @return 结果
*/ */
@Override
public int deleteDictDataByIds(Long[] dictCodes) public int deleteDictDataByIds(Long[] dictCodes)
{ {
return dictDataMapper.deleteDictDataByIds(dictCodes); int row = dictDataMapper.deleteDictDataByIds(dictCodes);
if (row > 0)
{
DictUtils.clearDictCache();
}
return row;
} }
/** /**
@ -99,7 +82,12 @@ public class SysDictDataServiceImpl implements ISysDictDataService
@Override @Override
public int insertDictData(SysDictData dictData) public int insertDictData(SysDictData dictData)
{ {
return dictDataMapper.insertDictData(dictData); int row = dictDataMapper.insertDictData(dictData);
if (row > 0)
{
DictUtils.clearDictCache();
}
return row;
} }
/** /**
@ -111,6 +99,11 @@ public class SysDictDataServiceImpl implements ISysDictDataService
@Override @Override
public int updateDictData(SysDictData dictData) public int updateDictData(SysDictData dictData)
{ {
return dictDataMapper.updateDictData(dictData); int row = dictDataMapper.updateDictData(dictData);
if (row > 0)
{
DictUtils.clearDictCache();
}
return row;
} }
} }

View File

@ -1,11 +1,15 @@
package com.ruoyi.project.system.service.impl; package com.ruoyi.project.system.service.impl;
import java.util.List; import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.system.domain.SysDictData;
import com.ruoyi.project.system.domain.SysDictType; import com.ruoyi.project.system.domain.SysDictType;
import com.ruoyi.project.system.mapper.SysDictDataMapper; import com.ruoyi.project.system.mapper.SysDictDataMapper;
import com.ruoyi.project.system.mapper.SysDictTypeMapper; import com.ruoyi.project.system.mapper.SysDictTypeMapper;
@ -25,6 +29,20 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
@Autowired @Autowired
private SysDictDataMapper dictDataMapper; private SysDictDataMapper dictDataMapper;
/**
* 项目启动时初始化字典到缓存
*/
@PostConstruct
public void init()
{
List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();
for (SysDictType dictType : dictTypeList)
{
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());
DictUtils.setDictCache(dictType.getDictType(), dictDatas);
}
}
/** /**
* 根据条件分页查询字典类型 * 根据条件分页查询字典类型
* *
@ -48,6 +66,29 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
return dictTypeMapper.selectDictTypeAll(); return dictTypeMapper.selectDictTypeAll();
} }
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
@Override
public List<SysDictData> selectDictDataByType(String dictType)
{
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
if (StringUtils.isNotNull(dictDatas))
{
return dictDatas;
}
dictDatas = dictDataMapper.selectDictDataByType(dictType);
if (StringUtils.isNotNull(dictDatas))
{
DictUtils.setDictCache(dictType, dictDatas);
return dictDatas;
}
return null;
}
/** /**
* 根据字典类型ID查询信息 * 根据字典类型ID查询信息
* *
@ -66,32 +107,44 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
* @param dictType 字典类型 * @param dictType 字典类型
* @return 字典类型 * @return 字典类型
*/ */
@Override
public SysDictType selectDictTypeByType(String dictType) public SysDictType selectDictTypeByType(String dictType)
{ {
return dictTypeMapper.selectDictTypeByType(dictType); return dictTypeMapper.selectDictTypeByType(dictType);
} }
/**
* 通过字典ID删除字典信息
*
* @param dictId 字典ID
* @return 结果
*/
@Override
public int deleteDictTypeById(Long dictId)
{
return dictTypeMapper.deleteDictTypeById(dictId);
}
/** /**
* 批量删除字典类型信息 * 批量删除字典类型信息
* *
* @param dictIds 需要删除的字典ID * @param dictIds 需要删除的字典ID
* @return 结果 * @return 结果
*/ */
@Override
public int deleteDictTypeByIds(Long[] dictIds) public int deleteDictTypeByIds(Long[] dictIds)
{ {
return dictTypeMapper.deleteDictTypeByIds(dictIds); for (Long dictId : dictIds)
{
SysDictType dictType = selectDictTypeById(dictId);
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
{
throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
}
}
int count = dictTypeMapper.deleteDictTypeByIds(dictIds);
if (count > 0)
{
DictUtils.clearDictCache();
}
return count;
}
/**
* 清空缓存数据
*/
@Override
public void clearCache()
{
DictUtils.clearDictCache();
} }
/** /**
@ -103,7 +156,12 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
@Override @Override
public int insertDictType(SysDictType dictType) public int insertDictType(SysDictType dictType)
{ {
return dictTypeMapper.insertDictType(dictType); int row = dictTypeMapper.insertDictType(dictType);
if (row > 0)
{
DictUtils.clearDictCache();
}
return row;
} }
/** /**
@ -118,7 +176,12 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
{ {
SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId()); SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());
dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType()); dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType());
return dictTypeMapper.updateDictType(dictType); int row = dictTypeMapper.updateDictType(dictType);
if (row > 0)
{
DictUtils.clearDictCache();
}
return row;
} }
/** /**

View File

@ -121,6 +121,7 @@ public class SysMenuServiceImpl implements ISysMenuService
* @param roleId 角色ID * @param roleId 角色ID
* @return 选中菜单列表 * @return 选中菜单列表
*/ */
@Override
public List<Integer> selectMenuListByRoleId(Long roleId) public List<Integer> selectMenuListByRoleId(Long roleId)
{ {
return menuMapper.selectMenuListByRoleId(roleId); return menuMapper.selectMenuListByRoleId(roleId);
@ -140,7 +141,7 @@ public class SysMenuServiceImpl implements ISysMenuService
{ {
RouterVo router = new RouterVo(); RouterVo router = new RouterVo();
router.setHidden("1".equals(menu.getVisible())); router.setHidden("1".equals(menu.getVisible()));
router.setName(StringUtils.capitalize(menu.getPath())); router.setName(getRouteName(menu));
router.setPath(getRouterPath(menu)); router.setPath(getRouterPath(menu));
router.setComponent(getComponent(menu)); router.setComponent(getComponent(menu));
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
@ -299,6 +300,23 @@ public class SysMenuServiceImpl implements ISysMenuService
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
/**
* 获取路由名称
*
* @param menu 菜单信息
* @return 路由名称
*/
public String getRouteName(SysMenu menu)
{
String routerName = StringUtils.capitalize(menu.getPath());
// 非外链并且是一级目录类型为目录
if (isMeunFrame(menu))
{
routerName = StringUtils.EMPTY;
}
return routerName;
}
/** /**
* 获取路由地址 * 获取路由地址
* *

View File

@ -84,6 +84,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
* @param noticeIds 需要删除的公告ID * @param noticeIds 需要删除的公告ID
* @return 结果 * @return 结果
*/ */
@Override
public int deleteNoticeByIds(Long[] noticeIds) public int deleteNoticeByIds(Long[] noticeIds)
{ {
return noticeMapper.deleteNoticeByIds(noticeIds); return noticeMapper.deleteNoticeByIds(noticeIds);

View File

@ -66,6 +66,7 @@ public class SysPostServiceImpl implements ISysPostService
* @param userId 用户ID * @param userId 用户ID
* @return 选中岗位ID列表 * @return 选中岗位ID列表
*/ */
@Override
public List<Integer> selectPostListByUserId(Long userId) public List<Integer> selectPostListByUserId(Long userId)
{ {
return postMapper.selectPostListByUserId(userId); return postMapper.selectPostListByUserId(userId);
@ -138,6 +139,7 @@ public class SysPostServiceImpl implements ISysPostService
* @return 结果 * @return 结果
* @throws Exception 异常 * @throws Exception 异常
*/ */
@Override
public int deletePostByIds(Long[] postIds) public int deletePostByIds(Long[] postIds)
{ {
for (Long postId : postIds) for (Long postId : postIds)

View File

@ -81,6 +81,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* *
* @return 角色列表 * @return 角色列表
*/ */
@Override
public List<SysRole> selectRoleAll() public List<SysRole> selectRoleAll()
{ {
return SpringUtils.getAopProxy(this).selectRoleList(new SysRole()); return SpringUtils.getAopProxy(this).selectRoleList(new SysRole());
@ -92,6 +93,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @param userId 用户ID * @param userId 用户ID
* @return 选中角色ID列表 * @return 选中角色ID列表
*/ */
@Override
public List<Integer> selectRoleListByUserId(Long userId) public List<Integer> selectRoleListByUserId(Long userId)
{ {
return roleMapper.selectRoleListByUserId(userId); return roleMapper.selectRoleListByUserId(userId);
@ -103,6 +105,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @param roleId 角色ID * @param roleId 角色ID
* @return 角色对象信息 * @return 角色对象信息
*/ */
@Override
public SysRole selectRoleById(Long roleId) public SysRole selectRoleById(Long roleId)
{ {
return roleMapper.selectRoleById(roleId); return roleMapper.selectRoleById(roleId);
@ -149,6 +152,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* *
* @param role 角色信息 * @param role 角色信息
*/ */
@Override
public void checkRoleAllowed(SysRole role) public void checkRoleAllowed(SysRole role)
{ {
if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin())
@ -207,6 +211,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @param role 角色信息 * @param role 角色信息
* @return 结果 * @return 结果
*/ */
@Override
public int updateRoleStatus(SysRole role) public int updateRoleStatus(SysRole role)
{ {
return roleMapper.updateRole(role); return roleMapper.updateRole(role);
@ -296,6 +301,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @param roleIds 需要删除的角色ID * @param roleIds 需要删除的角色ID
* @return 结果 * @return 结果
*/ */
@Override
public int deleteRoleByIds(Long[] roleIds) public int deleteRoleByIds(Long[] roleIds)
{ {
for (Long roleId : roleIds) for (Long roleId : roleIds)

View File

@ -72,6 +72,7 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
* @param user 用户信息 * @param user 用户信息
* @return 在线用户 * @return 在线用户
*/ */
@Override
public SysUserOnline loginUserToUserOnline(LoginUser user) public SysUserOnline loginUserToUserOnline(LoginUser user)
{ {
if (StringUtils.isNull(user) && StringUtils.isNull(user.getUser())) if (StringUtils.isNull(user) && StringUtils.isNull(user.getUser()))

View File

@ -192,6 +192,7 @@ public class SysUserServiceImpl implements ISysUserService
* *
* @param user 用户信息 * @param user 用户信息
*/ */
@Override
public void checkUserAllowed(SysUser user) public void checkUserAllowed(SysUser user)
{ {
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
@ -268,10 +269,11 @@ public class SysUserServiceImpl implements ISysUserService
/** /**
* 修改用户头像 * 修改用户头像
* *
* @param userId 用户ID * @param userName 用户名
* @param avatar 头像地址 * @param avatar 头像地址
* @return 结果 * @return 结果
*/ */
@Override
public boolean updateUserAvatar(String userName, String avatar) public boolean updateUserAvatar(String userName, String avatar)
{ {
return userMapper.updateUserAvatar(userName, avatar) > 0; return userMapper.updateUserAvatar(userName, avatar) > 0;
@ -376,6 +378,7 @@ public class SysUserServiceImpl implements ISysUserService
* @param userIds 需要删除的用户ID * @param userIds 需要删除的用户ID
* @return 结果 * @return 结果
*/ */
@Override
public int deleteUserByIds(Long[] userIds) public int deleteUserByIds(Long[] userIds)
{ {
for (Long userId : userIds) for (Long userId : userIds)

View File

@ -21,7 +21,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
/** /**
* 查询业务字段列表 * 查询业务字段列表
* *
* @param genTableColumn 业务字段编号 * @param tableId 业务字段编号
* @return 业务字段集合 * @return 业务字段集合
*/ */
@Override @Override

View File

@ -80,6 +80,7 @@ public class GenTableServiceImpl implements IGenTableService
* @param genTable 业务信息 * @param genTable 业务信息
* @return 数据库表集合 * @return 数据库表集合
*/ */
@Override
public List<GenTable> selectDbTableList(GenTable genTable) public List<GenTable> selectDbTableList(GenTable genTable)
{ {
return genTableMapper.selectDbTableList(genTable); return genTableMapper.selectDbTableList(genTable);
@ -91,6 +92,7 @@ public class GenTableServiceImpl implements IGenTableService
* @param tableNames 表名称组 * @param tableNames 表名称组
* @return 数据库表集合 * @return 数据库表集合
*/ */
@Override
public List<GenTable> selectDbTableListByNames(String[] tableNames) public List<GenTable> selectDbTableListByNames(String[] tableNames)
{ {
return genTableMapper.selectDbTableListByNames(tableNames); return genTableMapper.selectDbTableListByNames(tableNames);
@ -121,7 +123,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 删除业务对象 * 删除业务对象
* *
* @param ids 需要删除的数据ID * @param tableIds 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
@Override @Override
@ -142,9 +144,9 @@ public class GenTableServiceImpl implements IGenTableService
public void importGenTable(List<GenTable> tableList) public void importGenTable(List<GenTable> tableList)
{ {
String operName = SecurityUtils.getUsername(); String operName = SecurityUtils.getUsername();
for (GenTable table : tableList) try
{ {
try for (GenTable table : tableList)
{ {
String tableName = table.getTableName(); String tableName = table.getTableName();
GenUtils.initTable(table, operName); GenUtils.initTable(table, operName);
@ -160,10 +162,10 @@ public class GenTableServiceImpl implements IGenTableService
} }
} }
} }
catch (Exception e) }
{ catch (Exception e)
log.error("表名 " + table.getTableName() + " 导入失败:", e); {
} throw new CustomException("导入失败:" + e.getMessage());
} }
} }
@ -173,6 +175,7 @@ public class GenTableServiceImpl implements IGenTableService
* @param tableId 表编号 * @param tableId 表编号
* @return 预览数据列表 * @return 预览数据列表
*/ */
@Override
public Map<String, String> previewCode(Long tableId) public Map<String, String> previewCode(Long tableId)
{ {
Map<String, String> dataMap = new LinkedHashMap<>(); Map<String, String> dataMap = new LinkedHashMap<>();
@ -277,6 +280,7 @@ public class GenTableServiceImpl implements IGenTableService
* *
* @param genTable 业务信息 * @param genTable 业务信息
*/ */
@Override
public void validateEdit(GenTable genTable) public void validateEdit(GenTable genTable)
{ {
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
@ -301,7 +305,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 设置主键列信息 * 设置主键列信息
* *
* @param genTable 业务表信息 * @param table 业务表信息
* @param columns 业务字段列表 * @param columns 业务字段列表
*/ */
public void setPkColumn(GenTable table, List<GenTableColumn> columns) public void setPkColumn(GenTable table, List<GenTableColumn> columns)

View File

@ -13,7 +13,7 @@ public interface IGenTableColumnService
/** /**
* 查询业务字段列表 * 查询业务字段列表
* *
* @param genTableColumn 业务字段编号 * @param tableId 业务字段编号
* @return 业务字段集合 * @return 业务字段集合
*/ */
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);

View File

@ -58,11 +58,11 @@ public class GenUtils
{ {
column.setHtmlType(GenConstants.HTML_INPUT); column.setHtmlType(GenConstants.HTML_INPUT);
// 如果是浮点型 // 如果是浮点型 统一用BigDecimal
String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ",");
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0)
{ {
column.setJavaType(GenConstants.TYPE_DOUBLE); column.setJavaType(GenConstants.TYPE_BIGDECIMAL);
} }
// 如果是整形 // 如果是整形
else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10)

View File

@ -0,0 +1 @@
restart.include.json=/com.alibaba.fastjson.*.jar

View File

@ -3,7 +3,7 @@ ruoyi:
# 名称 # 名称
name: RuoYi name: RuoYi
# 版本 # 版本
version: 2.2.0 version: 2.3.0
# 版权年份 # 版权年份
copyrightYear: 2019 copyrightYear: 2019
# 实例演示开关 # 实例演示开关
@ -79,7 +79,7 @@ spring:
token: token:
# 令牌自定义标识 # 令牌自定义标识
header: Authorization header: Authorization
# 令牌 # 令牌
secret: abcdefghijklmnopqrstuvwxyz secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟 # 令牌有效期默认30分钟
expireTime: 30 expireTime: 30

View File

@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND status = #{status} AND status = #{status}
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${dataScope} ${params.dataScope}
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>

View File

@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND status = #{status} AND status = #{status}
</if> </if>
</where> </where>
order by dict_sort asc
</select> </select>
<select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult"> <select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
@ -73,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateDictData" parameterType="SysDictData"> <update id="updateDictData" parameterType="SysDictData">
update sys_dict_data update sys_dict_data
<set> <set>
<if test="dictSort != null and dictSort != ''">dict_sort = #{dictSort},</if> <if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if> <if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if> <if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if> <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
@ -94,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertDictData" parameterType="SysDictData"> <insert id="insertDictData" parameterType="SysDictData">
insert into sys_dict_data( insert into sys_dict_data(
<if test="dictSort != null and dictSort != ''">dict_sort,</if> <if test="dictSort != null">dict_sort,</if>
<if test="dictLabel != null and dictLabel != ''">dict_label,</if> <if test="dictLabel != null and dictLabel != ''">dict_label,</if>
<if test="dictValue != null and dictValue != ''">dict_value,</if> <if test="dictValue != null and dictValue != ''">dict_value,</if>
<if test="dictType != null and dictType != ''">dict_type,</if> <if test="dictType != null and dictType != ''">dict_type,</if>
@ -106,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="dictSort != null and dictSort != ''">#{dictSort},</if> <if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if> <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">#{dictValue},</if> <if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if> <if test="dictType != null and dictType != ''">#{dictType},</if>

View File

@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${dataScope} ${params.dataScope}
order by r.role_sort order by r.role_sort
</select> </select>

View File

@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) )) AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${dataScope} ${params.dataScope}
</select> </select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">

View File

@ -6,17 +6,17 @@ values('${functionName}', '3', '1', '${businessName}', '${moduleName}/${business
SELECT @parentId := LAST_INSERT_ID(); SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL -- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}查询', @parentId, '1', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); values('${functionName}查询', @parentId, '1', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}新增', @parentId, '2', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); values('${functionName}新增', @parentId, '2', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}修改', @parentId, '3', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); values('${functionName}修改', @parentId, '3', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}删除', @parentId, '4', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); values('${functionName}删除', @parentId, '4', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}导出', @parentId, '5', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); values('${functionName}导出', @parentId, '5', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');

View File

@ -146,7 +146,7 @@
v-for="dict in ${field}Options" v-for="dict in ${field}Options"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
#if($column.javaType == "Integer"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end
></el-option> ></el-option>
</el-select> </el-select>
@ -163,7 +163,7 @@
<el-radio <el-radio
v-for="dict in ${field}Options" v-for="dict in ${field}Options"
:key="dict.dictValue" :key="dict.dictValue"
#if($column.javaType == "Integer"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end
>{{dict.dictLabel}}</el-radio> >{{dict.dictLabel}}</el-radio>
</el-radio-group> </el-radio-group>
@ -375,8 +375,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -385,8 +383,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -174,7 +174,7 @@
v-for="dict in ${field}Options" v-for="dict in ${field}Options"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
#if($column.javaType == "Integer"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end
></el-option> ></el-option>
</el-select> </el-select>
@ -191,7 +191,7 @@
<el-radio <el-radio
v-for="dict in ${field}Options" v-for="dict in ${field}Options"
:key="dict.dictValue" :key="dict.dictValue"
#if($column.javaType == "Integer"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end
>{{dict.dictLabel}}</el-radio> >{{dict.dictLabel}}</el-radio>
</el-radio-group> </el-radio-group>
@ -392,8 +392,6 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} else { } else {
@ -402,8 +400,6 @@ export default {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else {
this.msgError(response.msg);
} }
}); });
} }

View File

@ -56,14 +56,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName,</if> <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
#end #end
#end #end
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">#{$column.javaField},</if> <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
#end #end
#end #end
</trim> </trim>
@ -74,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName) #if($column.columnName != $pkColumn.columnName)
<if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
#end #end
#end #end
</trim> </trim>