Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
git test
RuoYi
Commits
1c3541cc
Commit
1c3541cc
authored
5 years ago
by
RuoYi
Browse files
Options
Download
Email Patches
Plain Diff
若依 4.0
parent
5f05734e
Changes
63
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
README.md
+1
-1
README.md
pom.xml
+10
-2
pom.xml
ruoyi-admin/pom.xml
+1
-1
ruoyi-admin/pom.xml
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
+24
-0
...om/ruoyi/web/controller/system/SysDictTypeController.java
ruoyi-admin/src/main/resources/application.yml
+1
-1
ruoyi-admin/src/main/resources/application.yml
ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css
+5
-0
ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css
ruoyi-admin/src/main/resources/templates/include.html
+2
-2
ruoyi-admin/src/main/resources/templates/include.html
ruoyi-admin/src/main/resources/templates/index.html
+2
-2
ruoyi-admin/src/main/resources/templates/index.html
ruoyi-admin/src/main/resources/templates/login.html
+2
-2
ruoyi-admin/src/main/resources/templates/login.html
ruoyi-admin/src/main/resources/templates/main.html
+64
-2
ruoyi-admin/src/main/resources/templates/main.html
ruoyi-admin/src/main/resources/templates/system/dict/type/tree.html
+42
-0
...n/src/main/resources/templates/system/dict/type/tree.html
ruoyi-common/pom.xml
+7
-1
ruoyi-common/pom.xml
ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java
+1
-1
...-common/src/main/java/com/ruoyi/common/config/Global.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
+88
-0
...src/main/java/com/ruoyi/common/constant/GenConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
+50
-0
...rc/main/java/com/ruoyi/common/core/domain/TreeEntity.java
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
+17
-1
...c/main/java/com/ruoyi/common/core/page/TableDataInfo.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java
+33
-0
...mon/src/main/java/com/ruoyi/common/utils/StringUtils.java
ruoyi-framework/pom.xml
+1
-1
ruoyi-framework/pom.xml
ruoyi-generator/pom.xml
+1
-1
ruoyi-generator/pom.xml
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
+123
-12
...in/java/com/ruoyi/generator/controller/GenController.java
with
475 additions
and
30 deletions
+475
-30
README.md
+
1
-
1
View file @
1c3541cc
...
...
@@ -87,4 +87,4 @@
## 若依交流群
QQ群:
[

](https://jq.qq.com/?_wv=1027&k=5HBAaYN)
[

](https://jq.qq.com/?_wv=1027&k=5cHeRVW)
[

](https://jq.qq.com/?_wv=1027&k=53R0L5Z)
[

](https://jq.qq.com/?_wv=1027&k=5g75dCU)
[

](https://jq.qq.com/?_wv=1027&k=58cPoHA)
[

](https://jq.qq.com/?_wv=1027&k=5Ofd4Pb) 点击按钮入群。
\ No newline at end of file
QQ群:
[

](https://jq.qq.com/?_wv=1027&k=5HBAaYN)
[

](https://jq.qq.com/?_wv=1027&k=5cHeRVW)
[

](https://jq.qq.com/?_wv=1027&k=53R0L5Z)
[

](https://jq.qq.com/?_wv=1027&k=5g75dCU)
[

](https://jq.qq.com/?_wv=1027&k=58cPoHA)
[

](https://jq.qq.com/?_wv=1027&k=5Ofd4Pb)
[

](https://jq.qq.com/?_wv=1027&k=5yugASz) 点击按钮入群。
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pom.xml
+
10
-
2
View file @
1c3541cc
...
...
@@ -6,14 +6,14 @@
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi
</artifactId>
<version>
3.4
</version>
<version>
4.0.0
</version>
<name>
ruoyi
</name>
<url>
http://www.ruoyi.vip
</url>
<description>
若依管理系统
</description>
<properties>
<ruoyi.version>
3.4
</ruoyi.version>
<ruoyi.version>
4.0.0
</ruoyi.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<java.version>
1.8
</java.version>
...
...
@@ -25,6 +25,7 @@
<kaptcha.version>
2.3.2
</kaptcha.version>
<swagger.version>
2.9.2
</swagger.version>
<pagehelper.boot.version>
1.2.5
</pagehelper.boot.version>
<fastjson.version>
1.2.47
</fastjson.version>
<oshi.version>
3.9.1
</oshi.version>
<commons.io.version>
2.5
</commons.io.version>
<commons.fileupload.version>
1.3.3
</commons.fileupload.version>
...
...
@@ -167,6 +168,13 @@
<artifactId>
velocity
</artifactId>
<version>
${velocity.version}
</version>
</dependency>
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
${fastjson.version}
</version>
</dependency>
<!-- 定时任务-->
<dependency>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-admin/pom.xml
+
1
-
1
View file @
1c3541cc
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
ruoyi
</artifactId>
<groupId>
com.ruoyi
</groupId>
<version>
3.4
</version>
<version>
4.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
+
24
-
0
View file @
1c3541cc
...
...
@@ -15,6 +15,7 @@ import com.ruoyi.common.annotation.Log;
import
com.ruoyi.common.constant.UserConstants
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.Ztree
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
...
...
@@ -155,4 +156,27 @@ public class SysDictTypeController extends BaseController
{
return
dictTypeService
.
checkDictTypeUnique
(
dictType
);
}
/**
* 选择字典树
*/
@GetMapping
(
"/selectDictTree/{columnId}/{dictType}"
)
public
String
selectDeptTree
(
@PathVariable
(
"columnId"
)
Long
columnId
,
@PathVariable
(
"dictType"
)
String
dictType
,
ModelMap
mmap
)
{
mmap
.
put
(
"columnId"
,
columnId
);
mmap
.
put
(
"dict"
,
dictTypeService
.
selectDictTypeByType
(
dictType
));
return
prefix
+
"/tree"
;
}
/**
* 加载字典列表树
*/
@GetMapping
(
"/treeData"
)
@ResponseBody
public
List
<
Ztree
>
treeData
()
{
List
<
Ztree
>
ztrees
=
dictTypeService
.
selectDictTree
(
new
SysDictType
());
return
ztrees
;
}
}
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/application.yml
+
1
-
1
View file @
1c3541cc
...
...
@@ -3,7 +3,7 @@ ruoyi:
# 名称
name
:
RuoYi
# 版本
version
:
3.4
.0
version
:
4.0
.0
# 版权年份
copyrightYear
:
2019
# 实例演示开关
...
...
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css
+
5
-
0
View file @
1c3541cc
...
...
@@ -335,6 +335,11 @@ label.error {
right
:
42px
}
.input-group.date
label
.error
{
z-index
:
99
;
right
:
3px
}
.Validform_error
,
input
.error
,
select
.error
{
background-color
:
#fbe2e2
;
border-color
:
#c66161
;
...
...
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/templates/include.html
+
2
-
2
View file @
1c3541cc
...
...
@@ -39,8 +39,8 @@
<script
th:src=
"@{/ajax/libs/iCheck/icheck.min.js}"
></script>
<script
th:src=
"@{/ajax/libs/layer/layer.min.js}"
></script>
<script
th:src=
"@{/ajax/libs/layui/layui.js}"
></script>
<script
th:src=
"@{/ruoyi/js/common.js?v=
3.4
.0}"
></script>
<script
th:src=
"@{/ruoyi/js/ry-ui.js?v=
3.4
.0}"
></script>
<script
th:src=
"@{/ruoyi/js/common.js?v=
4.0
.0}"
></script>
<script
th:src=
"@{/ruoyi/js/ry-ui.js?v=
4.0
.0}"
></script>
<script
th:inline=
"javascript"
>
var
ctx
=
[[@{
/
}]];
</script>
</div>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/templates/index.html
+
2
-
2
View file @
1c3541cc
...
...
@@ -15,7 +15,7 @@
<link
th:href=
"@{/css/animate.css}"
rel=
"stylesheet"
/>
<link
th:href=
"@{/css/style.css}"
rel=
"stylesheet"
/>
<link
th:href=
"@{/css/skins.css}"
rel=
"stylesheet"
/>
<link
th:href=
"@{/ruoyi/css/ry-ui.css?v=
3.4
.0}"
rel=
"stylesheet"
/>
<link
th:href=
"@{/ruoyi/css/ry-ui.css?v=
4.0
.0}"
rel=
"stylesheet"
/>
</head>
<body
class=
"fixed-sidebar full-height-layout gray-bg"
style=
"overflow: hidden"
th:classappend=
"|${@config.getKey('sys.index.sideTheme')} ${@config.getKey('sys.index.skinName')}|"
>
<div
id=
"wrapper"
>
...
...
@@ -232,7 +232,7 @@
<script
th:src=
"@{/js/jquery.contextMenu.min.js}"
></script>
<script
th:src=
"@{/ajax/libs/blockUI/jquery.blockUI.js}"
></script>
<script
th:src=
"@{/ajax/libs/layer/layer.min.js}"
></script>
<script
th:src=
"@{/ruoyi/js/ry-ui.js?v=
3.4
.0}"
></script>
<script
th:src=
"@{/ruoyi/js/ry-ui.js?v=
4.0
.0}"
></script>
<script
th:src=
"@{/ruoyi/index.js}"
></script>
<script
th:src=
"@{/ajax/libs/fullscreen/jquery.fullscreen.js}"
></script>
<script
th:inline=
"javascript"
>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/templates/login.html
+
2
-
2
View file @
1c3541cc
...
...
@@ -10,7 +10,7 @@
<link
href=
"../static/css/font-awesome.min.css"
th:href=
"@{/css/font-awesome.min.css}"
rel=
"stylesheet"
/>
<link
href=
"../static/css/style.css"
th:href=
"@{/css/style.css}"
rel=
"stylesheet"
/>
<link
href=
"../static/css/login.min.css"
th:href=
"@{/css/login.min.css}"
rel=
"stylesheet"
/>
<link
href=
"../static/ruoyi/css/ry-ui.css"
th:href=
"@{/ruoyi/css/ry-ui.css?v=
3.4
.0}"
rel=
"stylesheet"
/>
<link
href=
"../static/ruoyi/css/ry-ui.css"
th:href=
"@{/ruoyi/css/ry-ui.css?v=
4.0
.0}"
rel=
"stylesheet"
/>
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html" />
<![endif]-->
...
...
@@ -80,7 +80,7 @@
<script
src=
"../static/ajax/libs/validate/messages_zh.min.js"
th:src=
"@{/ajax/libs/validate/messages_zh.min.js}"
></script>
<script
src=
"../static/ajax/libs/layer/layer.min.js"
th:src=
"@{/ajax/libs/layer/layer.min.js}"
></script>
<script
src=
"../static/ajax/libs/blockUI/jquery.blockUI.js"
th:src=
"@{/ajax/libs/blockUI/jquery.blockUI.js}"
></script>
<script
src=
"../static/ruoyi/js/ry-ui.js"
th:src=
"@{/ruoyi/js/ry-ui.js?v=
3.4
.0}"
></script>
<script
src=
"../static/ruoyi/js/ry-ui.js"
th:src=
"@{/ruoyi/js/ry-ui.js?v=
4.0
.0}"
></script>
<script
src=
"../static/ruoyi/login.js"
th:src=
"@{/ruoyi/login.js}"
></script>
</body>
</html>
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/templates/main.html
+
64
-
2
View file @
1c3541cc
...
...
@@ -81,7 +81,7 @@
<div
class=
"ibox-content"
>
<p><i
class=
"fa fa-send-o"
></i>
官网:
<a
href=
"http://www.ruoyi.vip"
target=
"_blank"
>
http://www.ruoyi.vip
</a>
</p>
<p><i
class=
"fa fa-qq"
></i>
QQ群:
<s>
满1389287
</s>
<s>
满1679294
</s>
<s>
满1529866
</s>
<s>
满1772718
</s>
<s>
满1366522
</s>
<a
href=
"https://jq.qq.com/?_wv=1027&k=5
O
fd
4Pb
"
target=
"_blank"
>
1
382251
</a>
<p><i
class=
"fa fa-qq"
></i>
QQ群:
<s>
满1389287
</s>
<s>
满1679294
</s>
<s>
满1529866
</s>
<s>
满1772718
</s>
<s>
满1366522
</s>
<s>
满1382251
</s>
<a
href=
"https://jq.qq.com/?_wv=1027&k=5fd
Q1eG
"
target=
"_blank"
>
1
145125
</a>
</p>
<p><i
class=
"fa fa-weixin"
></i>
微信:
<a
href=
"javascript:;"
>
/ *若依
</a>
</p>
...
...
@@ -98,13 +98,75 @@
<div
class=
"ibox-content no-padding"
>
<div
class=
"panel-body"
>
<div
class=
"panel-group"
id=
"version"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h5
class=
"panel-title"
>
<a
data-toggle=
"collapse"
data-parent=
"#version"
href=
"#v40"
>
v4.0.0
</a><code
class=
"pull-right"
>
2019.08.08
</code>
</h5>
</div>
<div
id=
"v40"
class=
"panel-collapse collapse in"
>
<div
class=
"panel-body"
>
<ol>
<li>
代码生成支持预览、编辑,保存方案
</li>
<li>
新增防止表单重复提交注解
</li>
<li>
新增后端校验(和前端保持一致)
</li>
<li>
新增同一个用户最大会话数控制
</li>
<li>
Excel导出子对象支持多个字段
</li>
<li>
定时任务支持静态调用和多参数
</li>
<li>
定时任务增加分组条件查询
</li>
<li>
字典类型增加任务分组数据
</li>
<li>
新增表格是否首次加载数据
</li>
<li>
新增parentTab选项卡可在同一页签打开
</li>
<li>
多数据源支持类注解(允许继承父类的注解)
</li>
<li>
部门及以下数据权限(调整为以下及所有子节点)
</li>
<li>
新增角色数据权限配(仅本人数据权限)
</li>
<li>
修改菜单权限显示问题
</li>
<li>
上传文件修改路径及返回名称
</li>
<li>
添加报表插件及示例
</li>
<li>
添加首页统计模板
</li>
<li>
添加表格拖拽示例
</li>
<li>
添加卡片列表示例
</li>
<li>
添加富文本编辑器示例
</li>
<li>
添加表格动态增删改查示例
</li>
<li>
添加用户页面岗位选择框提示
</li>
<li>
点击菜单操作添加背景高亮显示
</li>
<li>
表格树新增showSearch是否显示检索信息
</li>
<li>
解决表格列设置sortName无效问题
</li>
<li>
表格图片预览支持自定义设置宽高
</li>
<li>
添加表格列浮动提示(单击文本复制)
</li>
<li>
PC端收起菜单后支持浮动显示
</li>
<li>
详细操作样式调整
</li>
<li>
修改用户更新描述空串不更新问题
</li>
<li>
导入修改为模板渲染
</li>
<li>
修改菜单及部门排序规则
</li>
<li>
角色导出数据范围表达式翻译
</li>
<li>
添加summernote富文本字体大小
</li>
<li>
优化表格底部下边框防重叠
&
汇总像素问题
</li>
<li>
树表格支持属性多层级访问
</li>
<li>
修复IE浏览器用户管理界面右侧留白问题
</li>
<li>
重置按钮刷新表格
</li>
<li>
重置密码更新用户缓存
</li>
<li>
优化验证码属性参数
</li>
<li>
支持数据监控配置用户名和密码
</li>
<li>
文件上传修改按钮背景及加载动画
</li>
<li>
支持配置一级菜单href跳转
</li>
<li>
侧边栏添加一套浅色主题
</li>
<li>
树表格添加回调函数(校验异常状态)
</li>
<li>
用户个人中心适配手机端显示
</li>
<li>
Excel支持设置导出类型
&
更换样式
</li>
<li>
检查属性改变修改为克隆方式(防止热部署强转异常)
</li>
<li>
其他细节优化
</li>
</ol>
</div>
</div>
</div>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h5
class=
"panel-title"
>
<a
data-toggle=
"collapse"
data-parent=
"#version"
href=
"#v34"
>
v3.4.0
</a><code
class=
"pull-right"
>
2019.06.03
</code>
</h5>
</div>
<div
id=
"v34"
class=
"panel-collapse collapse
in
"
>
<div
id=
"v34"
class=
"panel-collapse collapse"
>
<div
class=
"panel-body"
>
<ol>
<li>
新增实例演示菜单及demo
</li>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/templates/system/dict/type/tree.html
0 → 100644
+
42
-
0
View file @
1c3541cc
<!DOCTYPE html>
<html
lang=
"zh"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<th:block
th:include=
"include :: header('字典树选择')"
/>
<th:block
th:include=
"include :: ztree-css"
/>
</head>
<style>
body
{
height
:
auto
;
font-family
:
"Microsoft YaHei"
;}
button
{
font-family
:
"SimSun"
,
"Helvetica Neue"
,
Helvetica
,
Arial
;}
</style>
<body
class=
"hold-transition box box-main"
>
<input
id=
"columnId"
type=
"hidden"
th:value=
"${columnId}"
/>
<input
id=
"treeId"
type=
"hidden"
th:value=
"${dict?.dictId}"
/>
<input
id=
"dictType"
type=
"hidden"
th:value=
"${dict?.dictType}"
/>
<div
class=
"wrapper"
><div
class=
"treeShowHideButton"
onclick=
"$.tree.toggleSearch();"
>
<label
id=
"btnShow"
title=
"显示搜索"
style=
"display:none;"
>
︾
</label>
<label
id=
"btnHide"
title=
"隐藏搜索"
>
︽
</label>
</div>
<div
class=
"treeSearchInput"
id=
"search"
>
<label
for=
"keyword"
>
关键字:
</label><input
type=
"text"
class=
"empty"
id=
"keyword"
maxlength=
"50"
>
<button
class=
"btn"
id=
"btn"
onclick=
"$.tree.searchNode()"
>
搜索
</button>
</div>
<div
id=
"tree"
class=
"ztree treeselect"
></div>
</div>
<th:block
th:include=
"include :: footer"
/>
<th:block
th:include=
"include :: ztree-js"
/>
<script
th:inline=
"javascript"
>
$
(
function
()
{
var
url
=
ctx
+
"
system/dict/treeData
"
;
var
options
=
{
url
:
url
,
onClick
:
zOnClick
};
$
.
tree
.
init
(
options
);
});
function
zOnClick
(
event
,
treeId
,
treeNode
)
{
$
(
"
#dictType
"
).
val
(
treeNode
.
title
);
}
</script>
</body>
</html>
This diff is collapsed.
Click to expand it.
ruoyi-common/pom.xml
+
7
-
1
View file @
1c3541cc
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
ruoyi
</artifactId>
<groupId>
com.ruoyi
</groupId>
<version>
3.4
</version>
<version>
4.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
@@ -59,6 +59,12 @@
<artifactId>
jackson-databind
</artifactId>
</dependency>
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
</dependency>
<!-- io常用工具类 -->
<dependency>
<groupId>
commons-io
</groupId>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java
+
1
-
1
View file @
1c3541cc
...
...
@@ -81,7 +81,7 @@ public class Global
*/
public
static
String
getVersion
()
{
return
StringUtils
.
nvl
(
getConfig
(
"ruoyi.version"
),
"
3.4
.0"
);
return
StringUtils
.
nvl
(
getConfig
(
"ruoyi.version"
),
"
4.0
.0"
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
0 → 100644
+
88
-
0
View file @
1c3541cc
package
com.ruoyi.common.constant
;
/**
* 代码生成通用常量
*
* @author ruoyi
*/
public
class
GenConstants
{
/** 单表(增删改查) */
public
static
final
String
TPL_CRUD
=
"crud"
;
/** 树表(增删改查) */
public
static
final
String
TPL_TREE
=
"tree"
;
/** 树编码字段 */
public
static
final
String
TREE_CODE
=
"treeCode"
;
/** 树父编码字段 */
public
static
final
String
TREE_PARENT_CODE
=
"treeParentCode"
;
/** 树名称字段 */
public
static
final
String
TREE_NAME
=
"treeName"
;
/** 数据库字符串类型 */
public
static
final
String
[]
COLUMNTYPE_STR
=
{
"char"
,
"varchar"
,
"narchar"
,
"varchar2"
,
"tinytext"
,
"text"
,
"mediumtext"
,
"longtext"
};
/** 数据库时间类型 */
public
static
final
String
[]
COLUMNTYPE_TIME
=
{
"datetime"
,
"time"
,
"date"
,
"timestamp"
};
/** 数据库数字类型 */
public
static
final
String
[]
COLUMNTYPE_NUMBER
=
{
"tinyint"
,
"smallint"
,
"mediumint"
,
"int"
,
"number"
,
"integer"
,
"bigint"
,
"float"
,
"float"
,
"double"
,
"decimal"
};
/** 页面不需要编辑字段 */
public
static
final
String
[]
COLUMNNAME_NOT_EDIT
=
{
"id"
,
"create_by"
,
"create_time"
,
"del_flag"
};
/** 页面不需要显示的列表字段 */
public
static
final
String
[]
COLUMNNAME_NOT_LIST
=
{
"id"
,
"create_by"
,
"create_time"
,
"del_flag"
,
"update_by"
,
"update_time"
};
/** 页面不需要查询字段 */
public
static
final
String
[]
COLUMNNAME_NOT_QUERY
=
{
"id"
,
"create_by"
,
"create_time"
,
"del_flag"
,
"update_by"
,
"update_time"
,
"remark"
};
/** 文本框 */
public
static
final
String
HTML_INPUT
=
"input"
;
/** 文本域 */
public
static
final
String
HTML_TEXTAREA
=
"textarea"
;
/** 下拉框 */
public
static
final
String
HTML_SELECT
=
"select"
;
/** 单选框 */
public
static
final
String
HTML_RADIO
=
"radio"
;
/** 复选框 */
public
static
final
String
HTML_CHECKBOX
=
"checkbox"
;
/** 日期控件 */
public
static
final
String
HTML_DATETIME
=
"datetime"
;
/** 字符串类型 */
public
static
final
String
TYPE_STRING
=
"String"
;
/** 整型 */
public
static
final
String
TYPE_INTEGER
=
"Integer"
;
/** 长整型 */
public
static
final
String
TYPE_LONG
=
"Long"
;
/** 浮点型 */
public
static
final
String
TYPE_DOUBLE
=
"Double"
;
/** 高精度计算类型 */
public
static
final
String
TYPE_BIGDECIMAL
=
"BigDecimal"
;
/** 时间类型 */
public
static
final
String
TYPE_DATE
=
"Date"
;
/** 模糊查询 */
public
static
final
String
QUERY_LIKE
=
"Like"
;
/** 需要 */
public
static
final
String
REQUIRE
=
"1"
;
}
This diff is collapsed.
Click to expand it.
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
0 → 100644
+
50
-
0
View file @
1c3541cc
package
com.ruoyi.common.core.domain
;
/**
* Tree基类
*
* @author ruoyi
*/
public
class
TreeEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 父菜单名称 */
private
String
parentName
;
/** 父菜单ID */
private
Long
parentId
;
/** 显示顺序 */
private
Integer
orderNum
;
public
String
getParentName
()
{
return
parentName
;
}
public
void
setParentName
(
String
parentName
)
{
this
.
parentName
=
parentName
;
}
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
public
Integer
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
Integer
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
+
17
-
1
View file @
1c3541cc
...
...
@@ -11,13 +11,19 @@ import java.util.List;
public
class
TableDataInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 总记录数 */
private
long
total
;
/** 列表数据 */
private
List
<?>
rows
;
/** 消息状态码 */
private
int
code
;
/** 消息内容 */
private
int
msg
;
/**
* 表格数据对象
*/
...
...
@@ -66,4 +72,14 @@ public class TableDataInfo implements Serializable
{
this
.
code
=
code
;
}
}
public
int
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
int
msg
)
{
this
.
msg
=
msg
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java
+
33
-
0
View file @
1c3541cc
...
...
@@ -362,4 +362,37 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
}
return
result
.
toString
();
}
/**
* 驼峰式命名法 例如:user_name->userName
*/
public
static
String
toCamelCase
(
String
s
)
{
if
(
s
==
null
)
{
return
null
;
}
s
=
s
.
toLowerCase
();
StringBuilder
sb
=
new
StringBuilder
(
s
.
length
());
boolean
upperCase
=
false
;
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
if
(
c
==
SEPARATOR
)
{
upperCase
=
true
;
}
else
if
(
upperCase
)
{
sb
.
append
(
Character
.
toUpperCase
(
c
));
upperCase
=
false
;
}
else
{
sb
.
append
(
c
);
}
}
return
sb
.
toString
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ruoyi-framework/pom.xml
+
1
-
1
View file @
1c3541cc
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
ruoyi
</artifactId>
<groupId>
com.ruoyi
</groupId>
<version>
3.4
</version>
<version>
4.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-generator/pom.xml
+
1
-
1
View file @
1c3541cc
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
ruoyi
</artifactId>
<groupId>
com.ruoyi
</groupId>
<version>
3.4
</version>
<version>
4.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
+
123
-
12
View file @
1c3541cc
...
...
@@ -2,11 +2,14 @@ package com.ruoyi.generator.controller;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -14,11 +17,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.core.text.Convert
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.generator.domain.TableInfo
;
import
com.ruoyi.generator.service.IGenService
;
import
com.ruoyi.common.utils.security.PermissionUtils
;
import
com.ruoyi.generator.domain.GenTable
;
import
com.ruoyi.generator.domain.GenTableColumn
;
import
com.ruoyi.generator.service.IGenTableColumnService
;
import
com.ruoyi.generator.service.IGenTableService
;
/**
* 代码生成 操作处理
...
...
@@ -32,7 +39,10 @@ public class GenController extends BaseController
private
String
prefix
=
"tool/gen"
;
@Autowired
private
IGenService
genService
;
private
IGenTableService
genTableService
;
@Autowired
private
IGenTableColumnService
genTableColumnService
;
@RequiresPermissions
(
"tool:gen:view"
)
@GetMapping
()
...
...
@@ -41,16 +51,121 @@ public class GenController extends BaseController
return
prefix
+
"/gen"
;
}
/**
* 查询代码生成列表
*/
@RequiresPermissions
(
"tool:gen:list"
)
@PostMapping
(
"/list"
)
@ResponseBody
public
TableDataInfo
list
(
TableInfo
tableInfo
)
public
TableDataInfo
genList
(
GenTable
genTable
)
{
startPage
();
List
<
GenTable
>
list
=
genTableService
.
selectGenTableList
(
genTable
);
return
getDataTable
(
list
);
}
/**
* 查询数据库列表
*/
@RequiresPermissions
(
"tool:gen:list"
)
@PostMapping
(
"/db/list"
)
@ResponseBody
public
TableDataInfo
dataList
(
GenTable
genTable
)
{
startPage
();
List
<
Table
Info
>
list
=
genService
.
selectTableList
(
tableInfo
);
List
<
Gen
Table
>
list
=
gen
Table
Service
.
select
Db
TableList
(
genTable
);
return
getDataTable
(
list
);
}
/**
* 查询数据表字段列表
*/
@RequiresPermissions
(
"tool:gen:list"
)
@PostMapping
(
"/column/list"
)
@ResponseBody
public
TableDataInfo
columnList
(
GenTableColumn
genTableColumn
)
{
TableDataInfo
dataInfo
=
new
TableDataInfo
();
List
<
GenTableColumn
>
list
=
genTableColumnService
.
selectGenTableColumnListByTableId
(
genTableColumn
);
dataInfo
.
setRows
(
list
);
dataInfo
.
setTotal
(
list
.
size
());
return
dataInfo
;
}
/**
* 导入表结构
*/
@RequiresPermissions
(
"tool:gen:list"
)
@GetMapping
(
"/importTable"
)
public
String
importTable
()
{
return
prefix
+
"/importTable"
;
}
/**
* 导入表结构(保存)
*/
@RequiresPermissions
(
"tool:gen:list"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
IMPORT
)
@PostMapping
(
"/importTable"
)
@ResponseBody
public
AjaxResult
importTableSave
(
String
tables
)
{
String
[]
tableNames
=
Convert
.
toStrArray
(
tables
);
// 查询表信息
List
<
GenTable
>
tableList
=
genTableService
.
selectDbTableListByNames
(
tableNames
);
String
operName
=
(
String
)
PermissionUtils
.
getPrincipalProperty
(
"loginName"
);
genTableService
.
importGenTable
(
tableList
,
operName
);
return
AjaxResult
.
success
();
}
/**
* 修改代码生成业务
*/
@GetMapping
(
"/edit/{tableId}"
)
public
String
edit
(
@PathVariable
(
"tableId"
)
Long
tableId
,
ModelMap
mmap
)
{
GenTable
table
=
genTableService
.
selectGenTableById
(
tableId
);
mmap
.
put
(
"table"
,
table
);
return
prefix
+
"/edit"
;
}
/**
* 修改保存代码生成业务
*/
@RequiresPermissions
(
"tool:gen:edit"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
"/edit"
)
@ResponseBody
public
AjaxResult
editSave
(
@Validated
GenTable
genTable
)
{
genTableService
.
validateEdit
(
genTable
);
genTableService
.
updateGenTable
(
genTable
);
return
AjaxResult
.
success
();
}
@RequiresPermissions
(
"tool:gen:remove"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
DELETE
)
@PostMapping
(
"/remove"
)
@ResponseBody
public
AjaxResult
remove
(
String
ids
)
{
genTableService
.
deleteGenTableByIds
(
ids
);
return
AjaxResult
.
success
();
}
/**
* 预览代码
*/
@RequiresPermissions
(
"tool:gen:preview"
)
@GetMapping
(
"/preview/{tableId}"
)
@ResponseBody
public
AjaxResult
preview
(
@PathVariable
(
"tableId"
)
Long
tableId
)
throws
IOException
{
Map
<
String
,
String
>
dataMap
=
genTableService
.
previewCode
(
tableId
);
return
AjaxResult
.
success
(
dataMap
);
}
/**
* 生成代码
*/
...
...
@@ -59,7 +174,7 @@ public class GenController extends BaseController
@GetMapping
(
"/genCode/{tableName}"
)
public
void
genCode
(
HttpServletResponse
response
,
@PathVariable
(
"tableName"
)
String
tableName
)
throws
IOException
{
byte
[]
data
=
genService
.
generatorCode
(
tableName
);
byte
[]
data
=
gen
Table
Service
.
generatorCode
(
tableName
);
genCode
(
response
,
data
);
}
...
...
@@ -73,16 +188,12 @@ public class GenController extends BaseController
public
void
batchGenCode
(
HttpServletResponse
response
,
String
tables
)
throws
IOException
{
String
[]
tableNames
=
Convert
.
toStrArray
(
tables
);
byte
[]
data
=
genService
.
generatorCode
(
tableNames
);
byte
[]
data
=
gen
Table
Service
.
generatorCode
(
tableNames
);
genCode
(
response
,
data
);
}
/**
* 生成zip文件
*
* @param response
* @param data
* @throws IOException
*/
private
void
genCode
(
HttpServletResponse
response
,
byte
[]
data
)
throws
IOException
{
...
...
@@ -92,4 +203,4 @@ public class GenController extends BaseController
response
.
setContentType
(
"application/octet-stream; charset=UTF-8"
);
IOUtils
.
write
(
data
,
response
.
getOutputStream
());
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment