From fee8a5955b61ce8e880f376c68b03a2ec8ac7dbb Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 2 Dec 2019 09:28:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=A5=E4=BE=9D=202.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 + ruoyi-ui/package.json | 2 +- ruoyi-ui/src/api/system/dict/type.js | 8 + ruoyi-ui/src/api/system/user.js | 3 +- ruoyi-ui/src/api/tool/gen.js | 59 ++ ruoyi-ui/src/assets/styles/ruoyi.scss | 14 + ruoyi-ui/src/router/index.js | 28 +- ruoyi-ui/src/utils/ruoyi.js | 50 +- ruoyi-ui/src/utils/zipdownload.js | 40 + ruoyi-ui/src/views/monitor/druid/index.vue | 1 + .../src/views/monitor/logininfor/index.vue | 1 + ruoyi-ui/src/views/monitor/online/index.vue | 1 + ruoyi-ui/src/views/monitor/operlog/index.vue | 1 + ruoyi-ui/src/views/monitor/server/index.vue | 1 + ruoyi-ui/src/views/redirect.vue | 12 - ruoyi-ui/src/views/system/config/index.vue | 1 + ruoyi-ui/src/views/system/dept/index.vue | 1 + ruoyi-ui/src/views/system/dict/data.vue | 1 + ruoyi-ui/src/views/system/dict/index.vue | 1 + ruoyi-ui/src/views/system/menu/index.vue | 1 + ruoyi-ui/src/views/system/notice/index.vue | 1 + ruoyi-ui/src/views/system/post/index.vue | 1 + ruoyi-ui/src/views/system/role/index.vue | 1 + ruoyi-ui/src/views/system/user/index.vue | 31 +- .../src/views/system/user/profile/index.vue | 10 - ruoyi-ui/src/views/tool/gen/basicInfoForm.vue | 61 ++ ruoyi-ui/src/views/tool/gen/editTable.vue | 204 ++++ ruoyi-ui/src/views/tool/gen/genInfoForm.vue | 154 +++ ruoyi-ui/src/views/tool/gen/importTable.vue | 114 ++ ruoyi-ui/src/views/tool/gen/index.vue | 286 ++++- ruoyi-ui/src/views/tool/swagger/index.vue | 1 + ruoyi/pom.xml | 9 +- .../sql/{ry_20191120.sql => ry_20191202.sql} | 6 +- .../ruoyi/common/constant/GenConstants.java | 94 ++ .../ruoyi/common/utils/text/CharsetKit.java | 87 ++ .../com/ruoyi/common/utils/text/Convert.java | 999 ++++++++++++++++++ .../ruoyi/common/utils/text/StrFormatter.java | 93 ++ .../com/ruoyi/framework/config/GenConfig.java | 66 ++ .../framework/web/domain/BaseEntity.java | 39 +- .../controller/SysConfigController.java | 1 - .../system/controller/SysDeptController.java | 2 - .../controller/SysDictDataController.java | 1 - .../controller/SysDictTypeController.java | 10 + .../system/controller/SysMenuController.java | 2 - .../system/controller/SysUserController.java | 17 +- .../service/impl/SysMenuServiceImpl.java | 3 +- .../tool/gen/controller/GenController.java | 185 ++++ .../project/tool/gen/domain/GenTable.java | 269 +++++ .../tool/gen/domain/GenTableColumn.java | 368 +++++++ .../tool/gen/mapper/GenTableColumnMapper.java | 52 + .../tool/gen/mapper/GenTableMapper.java | 76 ++ .../service/GenTableColumnServiceImpl.java | 68 ++ .../tool/gen/service/GenTableServiceImpl.java | 340 ++++++ .../gen/service/IGenTableColumnService.java | 44 + .../tool/gen/service/IGenTableService.java | 99 ++ .../ruoyi/project/tool/gen/util/GenUtils.java | 238 +++++ .../tool/gen/util/VelocityInitializer.java | 35 + .../project/tool/gen/util/VelocityUtils.java | 281 +++++ ruoyi/src/main/resources/application.yml | 15 +- .../mybatis/monitor/SysLogininforMapper.xml | 8 +- .../mybatis/monitor/SysOperLogMapper.xml | 8 +- .../mybatis/system/SysConfigMapper.xml | 8 +- .../mybatis/system/SysDictTypeMapper.xml | 8 +- .../mybatis/system/SysRoleMapper.xml | 8 +- .../mybatis/system/SysUserMapper.xml | 8 +- .../mybatis/tool/GenTableColumnMapper.xml | 120 +++ .../resources/mybatis/tool/GenTableMapper.xml | 181 ++++ .../main/resources/vm/java/controller.java.vm | 103 ++ .../src/main/resources/vm/java/domain.java.vm | 76 ++ .../src/main/resources/vm/java/mapper.java.vm | 61 ++ .../main/resources/vm/java/service.java.vm | 61 ++ .../resources/vm/java/serviceImpl.java.vm | 109 ++ ruoyi/src/main/resources/vm/js/api.js.vm | 53 + ruoyi/src/main/resources/vm/sql/sql.vm | 22 + ruoyi/src/main/resources/vm/vue/index.vue.vm | 440 ++++++++ ruoyi/src/main/resources/vm/xml/mapper.xml.vm | 95 ++ 76 files changed, 5832 insertions(+), 130 deletions(-) create mode 100644 ruoyi-ui/src/api/tool/gen.js create mode 100644 ruoyi-ui/src/utils/zipdownload.js delete mode 100644 ruoyi-ui/src/views/redirect.vue create mode 100644 ruoyi-ui/src/views/tool/gen/basicInfoForm.vue create mode 100644 ruoyi-ui/src/views/tool/gen/editTable.vue create mode 100644 ruoyi-ui/src/views/tool/gen/genInfoForm.vue create mode 100644 ruoyi-ui/src/views/tool/gen/importTable.vue rename ruoyi/sql/{ry_20191120.sql => ry_20191202.sql} (98%) create mode 100644 ruoyi/src/main/java/com/ruoyi/common/constant/GenConstants.java create mode 100644 ruoyi/src/main/java/com/ruoyi/common/utils/text/CharsetKit.java create mode 100644 ruoyi/src/main/java/com/ruoyi/common/utils/text/Convert.java create mode 100644 ruoyi/src/main/java/com/ruoyi/common/utils/text/StrFormatter.java create mode 100644 ruoyi/src/main/java/com/ruoyi/framework/config/GenConfig.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTable.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTableColumn.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableColumnMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableColumnServiceImpl.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableServiceImpl.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableColumnService.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableService.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/GenUtils.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityInitializer.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java create mode 100644 ruoyi/src/main/resources/mybatis/tool/GenTableColumnMapper.xml create mode 100644 ruoyi/src/main/resources/mybatis/tool/GenTableMapper.xml create mode 100644 ruoyi/src/main/resources/vm/java/controller.java.vm create mode 100644 ruoyi/src/main/resources/vm/java/domain.java.vm create mode 100644 ruoyi/src/main/resources/vm/java/mapper.java.vm create mode 100644 ruoyi/src/main/resources/vm/java/service.java.vm create mode 100644 ruoyi/src/main/resources/vm/java/serviceImpl.java.vm create mode 100644 ruoyi/src/main/resources/vm/js/api.js.vm create mode 100644 ruoyi/src/main/resources/vm/sql/sql.vm create mode 100644 ruoyi/src/main/resources/vm/vue/index.vue.vm create mode 100644 ruoyi/src/main/resources/vm/xml/mapper.xml.vm diff --git a/README.md b/README.md index a859b1d96..fd9c93bf3 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 d6f08df02..ceb331e29 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 80a6cfab9..4b45a355e 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 3b1170e7e..45c09ebbf 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 000000000..21b9b8324 --- /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 9e0cdc37b..77307e578 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 526d755c9..47ddd61d7 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 db97dcc58..602fdd6c6 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 000000000..3a8681468 --- /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 6ab35b26d..9e8e1e75b 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 b84fac5cc..354f7e051 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 735c3b9b3..bcefdb879 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 649e302f5..dcb8cb70f 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 2dd211f49..44ca109b7 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 eda8d21d9..b1a5cdb1c 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 caedc5031..404bec3e4 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 5c4f28fd4..ffd3f42bb 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 05379c220..497fed646 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 760036b92..00c364571 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 000000000..f3e87172b --- /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 000000000..3897aa46c --- /dev/null +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -0,0 +1,204 @@ + + 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 000000000..7b9a32a69 --- /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 000000000..e4418708d --- /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 c0c06736a..0c159a0fd 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -1,5 +1,287 @@ \ 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 00484e28f..624b59a2d 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 000000000..ef9d682b8 --- /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