diff --git a/README.md b/README.md
index a859b1d..fd9c93b 100644
--- a/README.md
+++ b/README.md
@@ -71,6 +71,10 @@ https://www.oschina.net/project/top_cn_2019#ruoyi
|
+ |
+ |
+
+
|
|
diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json
index d6f08df..ceb331e 100644
--- a/ruoyi-ui/package.json
+++ b/ruoyi-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "ruoyi",
- "version": "1.1.0",
+ "version": "2.0.0",
"description": "若依管理系统",
"author": "若依",
"license": "MIT",
diff --git a/ruoyi-ui/src/api/system/dict/type.js b/ruoyi-ui/src/api/system/dict/type.js
index 80a6cfa..4b45a35 100644
--- a/ruoyi-ui/src/api/system/dict/type.js
+++ b/ruoyi-ui/src/api/system/dict/type.js
@@ -51,3 +51,11 @@ export function exportType(query) {
params: query
})
}
+
+// 获取字典选择框列表
+export function optionselect() {
+ return request({
+ url: '/system/dict/type/optionselect',
+ method: 'get'
+ })
+}
\ No newline at end of file
diff --git a/ruoyi-ui/src/api/system/user.js b/ruoyi-ui/src/api/system/user.js
index 3b1170e..45c09eb 100644
--- a/ruoyi-ui/src/api/system/user.js
+++ b/ruoyi-ui/src/api/system/user.js
@@ -1,4 +1,5 @@
import request from '@/utils/request'
+import { praseStrEmpty } from "@/utils/ruoyi";
// 查询用户列表
export function listUser(query) {
@@ -12,7 +13,7 @@ export function listUser(query) {
// 查询用户详细
export function getUser(userId) {
return request({
- url: '/system/user/' + userId,
+ url: '/system/user/' + praseStrEmpty(userId),
method: 'get'
})
}
diff --git a/ruoyi-ui/src/api/tool/gen.js b/ruoyi-ui/src/api/tool/gen.js
new file mode 100644
index 0000000..21b9b83
--- /dev/null
+++ b/ruoyi-ui/src/api/tool/gen.js
@@ -0,0 +1,59 @@
+import request from '@/utils/request'
+
+// 查询生成表数据
+export function listTable(query) {
+ return request({
+ url: '/tool/gen/list',
+ method: 'get',
+ params: query
+ })
+}
+// 查询db数据库列表
+export function listDbTable(query) {
+ return request({
+ url: '/tool/gen/db/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 查询表详细信息
+export function getGenTable(tableId) {
+ return request({
+ url: '/tool/gen/' + tableId,
+ method: 'get'
+ })
+}
+
+// 修改代码生成信息
+export function updateGenTable(data) {
+ return request({
+ url: '/tool/gen',
+ method: 'put',
+ data: data
+ })
+}
+
+// 导入表
+export function importTable(data) {
+ return request({
+ url: '/tool/gen/importTable',
+ method: 'post',
+ params: data
+ })
+}
+// 预览生成代码
+export function previewTable(tableId) {
+ return request({
+ url: '/tool/gen/preview/' + tableId,
+ method: 'get'
+ })
+}
+// 删除表数据
+export function delTable(tableId) {
+ return request({
+ url: '/tool/gen/' + tableId,
+ method: 'delete'
+ })
+}
+
diff --git a/ruoyi-ui/src/assets/styles/ruoyi.scss b/ruoyi-ui/src/assets/styles/ruoyi.scss
index 9e0cdc3..77307e5 100644
--- a/ruoyi-ui/src/assets/styles/ruoyi.scss
+++ b/ruoyi-ui/src/assets/styles/ruoyi.scss
@@ -53,6 +53,10 @@
margin-left: 20px;
}
+.el-dialog {
+ margin-top: 6vh !important;
+}
+
.el-table .el-table__header-wrapper th {
word-break: break-word;
background-color: #f8f8f9;
@@ -61,6 +65,16 @@
font-size: 13px;
}
+/** 表单布局 **/
+.form-header {
+ font-size:15px;
+ color:#6379bb;
+ border-bottom:1px solid #ddd;
+ margin:8px 10px 25px 10px;
+ padding-bottom:5px
+}
+
+/** 表格布局 **/
.pagination-container {
position: relative;
height: 25px;
diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js
index 526d755..47ddd61 100644
--- a/ruoyi-ui/src/router/index.js
+++ b/ruoyi-ui/src/router/index.js
@@ -26,17 +26,6 @@ import Layout from '@/layout'
// 公共路由
export const constantRoutes = [
- {
- path: '/redirect',
- component: Layout,
- hidden: true,
- children: [
- {
- path: '/redirect/:path*',
- component: () => import('@/views/redirect')
- }
- ]
- },
{
path: '/login',
component: () => import('@/views/login'),
@@ -74,7 +63,7 @@ export const constantRoutes = [
{
path: 'profile',
component: () => import('@/views/system/user/profile/index'),
- name: '个人中心',
+ name: 'Profile',
meta: { title: '个人中心', icon: 'user' }
}
]
@@ -87,10 +76,23 @@ export const constantRoutes = [
{
path: 'type/data/:dictId(\\d+)',
component: () => import('@/views/system/dict/data'),
- name: '字典数据',
+ name: 'Data',
meta: { title: '字典数据', icon: '' }
}
]
+ },
+ {
+ path: '/gen',
+ component: Layout,
+ hidden: true,
+ children: [
+ {
+ path: 'edit',
+ component: () => import('@/views/tool/gen/editTable'),
+ name: 'GenEdit',
+ meta: { title: '修改生成配置' }
+ }
+ ]
}
]
diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js
index db97dcc..602fdd6 100644
--- a/ruoyi-ui/src/utils/ruoyi.js
+++ b/ruoyi-ui/src/utils/ruoyi.js
@@ -9,21 +9,21 @@ const baseURL = process.env.VUE_APP_BASE_API
export function parseTime(time, pattern) {
if (arguments.length === 0) {
return null
- }
- const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
- let date
- if (typeof time === 'object') {
+ }
+ const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
+ let date
+ if (typeof time === 'object') {
date = time
- } else {
+ } else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
- time = parseInt(time)
+ time = parseInt(time)
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
- time = time * 1000
+ time = time * 1000
}
date = new Date(time)
- }
- const formatObj = {
+ }
+ const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
@@ -31,22 +31,22 @@ export function parseTime(time, pattern) {
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
- }
- const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
+ }
+ const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
- if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
+ if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
if (result.length > 0 && value < 10) {
- value = '0' + value
+ value = '0' + value
}
return value || 0
- })
- return time_str
+ })
+ return time_str
}
// 表单重置
export function resetForm(refName) {
- if (this.$refs[refName] !== undefined) {
+ if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
}
@@ -54,11 +54,11 @@ export function resetForm(refName) {
// 添加日期范围
export function addDateRange(params, dateRange) {
var search = params;
- if (null != dateRange) {
- search.params = {
- beginTime: this.dateRange[0],
- endTime: this.dateRange[1]
- };
+ search.beginTime = "";
+ search.endTime = "";
+ if (null != dateRange && '' != dateRange) {
+ search.beginTime = this.dateRange[0];
+ search.endTime = this.dateRange[1];
}
return search;
}
@@ -92,4 +92,12 @@ export function sprintf(str) {
return arg;
});
return flag ? str : '';
+}
+
+// 转换字符串,undefined,null等转化为""
+export function praseStrEmpty(str) {
+ if (!str || str == "undefined" || str == "null") {
+ return "";
+ }
+ return str;
}
\ No newline at end of file
diff --git a/ruoyi-ui/src/utils/zipdownload.js b/ruoyi-ui/src/utils/zipdownload.js
new file mode 100644
index 0000000..3a86814
--- /dev/null
+++ b/ruoyi-ui/src/utils/zipdownload.js
@@ -0,0 +1,40 @@
+import axios from 'axios'
+import { getToken } from '@/utils/auth'
+
+const mimeMap = {
+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ zip: 'application/zip'
+}
+
+const baseUrl = process.env.VUE_APP_BASE_API
+export function downLoadZip(str, filename) {
+ var url = baseUrl + str
+ axios({
+ method: 'get',
+ url: url,
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + getToken() }
+ }).then(res => {
+ resolveBlob(res, mimeMap.zip)
+ })
+}
+/**
+ * 解析blob响应内容并下载
+ * @param {*} res blob响应内容
+ * @param {String} mimeType MIME类型
+ */
+export function resolveBlob(res, mimeType) {
+ const aLink = document.createElement('a')
+ var blob = new Blob([res.data], { type: mimeType })
+ // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
+ var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
+ var contentDisposition = decodeURI(res.headers['content-disposition'])
+ var result = patt.exec(contentDisposition)
+ var fileName = result[1]
+ fileName = fileName.replace(/\"/g, '')
+ aLink.href = URL.createObjectURL(blob)
+ aLink.setAttribute('download', fileName) // 设置下载文件名称
+ document.body.appendChild(aLink)
+ aLink.click()
+ document.body.appendChild(aLink)
+}
diff --git a/ruoyi-ui/src/views/monitor/druid/index.vue b/ruoyi-ui/src/views/monitor/druid/index.vue
index 6ab35b2..9e8e1e7 100644
--- a/ruoyi-ui/src/views/monitor/druid/index.vue
+++ b/ruoyi-ui/src/views/monitor/druid/index.vue
@@ -5,6 +5,7 @@
diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue
index b84fac5..354f7e0 100644
--- a/ruoyi-ui/src/views/system/config/index.vue
+++ b/ruoyi-ui/src/views/system/config/index.vue
@@ -168,6 +168,7 @@
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig } from "@/api/system/config";
export default {
+ name: "Config",
data() {
return {
// 遮罩层
diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue
index 735c3b9..bcefdb8 100644
--- a/ruoyi-ui/src/views/system/dept/index.vue
+++ b/ruoyi-ui/src/views/system/dept/index.vue
@@ -143,6 +143,7 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
+ name: "Dept",
components: { Treeselect },
data() {
return {
diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue
index 649e302..dcb8cb7 100644
--- a/ruoyi-ui/src/views/system/dict/data.vue
+++ b/ruoyi-ui/src/views/system/dict/data.vue
@@ -159,6 +159,7 @@ import { listData, getData, delData, addData, updateData, exportData } from "@/a
import { listType, getType } from "@/api/system/dict/type";
export default {
+ name: "Data",
data() {
return {
// 遮罩层
diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue
index 2dd211f..44ca109 100644
--- a/ruoyi-ui/src/views/system/dict/index.vue
+++ b/ruoyi-ui/src/views/system/dict/index.vue
@@ -176,6 +176,7 @@
import { listType, getType, delType, addType, updateType, exportType } from "@/api/system/dict/type";
export default {
+ name: "Dict",
data() {
return {
// 遮罩层
diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue
index eda8d21..b1a5cdb 100644
--- a/ruoyi-ui/src/views/system/menu/index.vue
+++ b/ruoyi-ui/src/views/system/menu/index.vue
@@ -179,6 +179,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import IconSelect from "@/components/IconSelect";
export default {
+ name: "Menu",
components: { Treeselect, IconSelect },
data() {
return {
diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue
index caedc50..404bec3 100644
--- a/ruoyi-ui/src/views/system/notice/index.vue
+++ b/ruoyi-ui/src/views/system/notice/index.vue
@@ -176,6 +176,7 @@ import { listNotice, getNotice, delNotice, addNotice, updateNotice, exportNotice
import Editor from '@/components/Editor';
export default {
+ name: "Notice",
components: {
Editor
},
diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue
index 5c4f28f..ffd3f42 100644
--- a/ruoyi-ui/src/views/system/post/index.vue
+++ b/ruoyi-ui/src/views/system/post/index.vue
@@ -153,6 +153,7 @@
import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post";
export default {
+ name: "Post",
data() {
return {
// 遮罩层
diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue
index 05379c2..497fed6 100644
--- a/ruoyi-ui/src/views/system/role/index.vue
+++ b/ruoyi-ui/src/views/system/role/index.vue
@@ -238,6 +238,7 @@ import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/m
import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
export default {
+ name: "Role",
data() {
return {
// 遮罩层
diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue
index 760036b..00c3645 100644
--- a/ruoyi-ui/src/views/system/user/index.vue
+++ b/ruoyi-ui/src/views/system/user/index.vue
@@ -290,12 +290,11 @@
-
-
diff --git a/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue
new file mode 100644
index 0000000..f3e8717
--- /dev/null
+++ b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue
new file mode 100644
index 0000000..3897aa4
--- /dev/null
+++ b/ruoyi-ui/src/views/tool/gen/editTable.vue
@@ -0,0 +1,204 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ dict.dictName }}
+ {{ dict.dictType }}
+
+
+
+
+
+
+
+
+
+
+
+
+ 提交
+ 返回
+
+
+
+
+
diff --git a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue
new file mode 100644
index 0000000..7b9a32a
--- /dev/null
+++ b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue
@@ -0,0 +1,154 @@
+
+
+
+
+
+ 生成模板
+
+
+
+
+
+
+
+
+
+
+ 生成包路径
+
+
+
+
+
+
+
+
+
+
+
+ 生成模块名
+
+
+
+
+
+
+
+
+
+
+
+ 生成业务名
+
+
+
+
+
+
+
+
+
+
+
+ 生成功能名
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 树编码字段
+
+
+
+
+
+
+
+
+
+
+
+
+ 树父编码字段
+
+
+
+
+
+
+
+
+
+
+
+
+ 树名称字段
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-ui/src/views/tool/gen/importTable.vue b/ruoyi-ui/src/views/tool/gen/importTable.vue
new file mode 100644
index 0000000..e441870
--- /dev/null
+++ b/ruoyi-ui/src/views/tool/gen/importTable.vue
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue
index c0c0673..0c159a0 100644
--- a/ruoyi-ui/src/views/tool/gen/index.vue
+++ b/ruoyi-ui/src/views/tool/gen/index.vue
@@ -1,5 +1,287 @@
- 代码生成
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 生成
+
+
+ 导入
+
+
+ 修改
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 预览
+ 编辑
+ 删除
+ 生成代码
+
+
+
+
+
+
+
+
+ {{ value }}
+
+
+
+
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/tool/swagger/index.vue b/ruoyi-ui/src/views/tool/swagger/index.vue
index 00484e2..624b59a 100644
--- a/ruoyi-ui/src/views/tool/swagger/index.vue
+++ b/ruoyi-ui/src/views/tool/swagger/index.vue
@@ -5,6 +5,7 @@
\ No newline at end of file
diff --git a/ruoyi/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi/src/main/resources/vm/xml/mapper.xml.vm
new file mode 100644
index 0000000..ef9d682
--- /dev/null
+++ b/ruoyi/src/main/resources/vm/xml/mapper.xml.vm
@@ -0,0 +1,95 @@
+
+
+
+
+
+#foreach ($column in $columns)
+
+#end
+
+
+
+ select#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()),#end#end from ${tableName}
+
+
+
+
+
+
+
+ insert into ${tableName}
+
+#foreach($column in $columns)
+#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
+ $column.columnName,
+#end
+#end
+
+
+#foreach($column in $columns)
+#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
+ #{$column.javaField},
+#end
+#end
+
+
+
+
+ update ${tableName}
+
+#foreach($column in $columns)
+#if($column.columnName != $pkColumn.columnName)
+ $column.columnName = #{$column.javaField},
+#end
+#end
+
+ where ${pkColumn.columnName} = #{${pkColumn.javaField}}
+
+
+
+ delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
+
+
+
+ delete from ${tableName} where ${pkColumn.columnName} in
+
+ #{${pkColumn.javaField}}
+
+
+
+
\ No newline at end of file