Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
fee8a595
"src/vscode:/vscode.git/clone" did not exist on "1283b228a9ac358f734752aaacb27f2db29ffa28"
Commit
fee8a595
authored
Dec 02, 2019
by
RuoYi
Browse files
若依 2.0
parent
cef26e77
Changes
76
Expand all
Show whitespace changes
Inline
Side-by-side
ruoyi-ui/src/views/system/notice/index.vue
View file @
fee8a595
...
@@ -176,6 +176,7 @@ import { listNotice, getNotice, delNotice, addNotice, updateNotice, exportNotice
...
@@ -176,6 +176,7 @@ import { listNotice, getNotice, delNotice, addNotice, updateNotice, exportNotice
import
Editor
from
'
@/components/Editor
'
;
import
Editor
from
'
@/components/Editor
'
;
export
default
{
export
default
{
name
:
"
Notice
"
,
components
:
{
components
:
{
Editor
Editor
}
,
}
,
...
...
ruoyi-ui/src/views/system/post/index.vue
View file @
fee8a595
...
@@ -153,6 +153,7 @@
...
@@ -153,6 +153,7 @@
import
{
listPost
,
getPost
,
delPost
,
addPost
,
updatePost
,
exportPost
}
from
"
@/api/system/post
"
;
import
{
listPost
,
getPost
,
delPost
,
addPost
,
updatePost
,
exportPost
}
from
"
@/api/system/post
"
;
export
default
{
export
default
{
name
:
"
Post
"
,
data
()
{
data
()
{
return
{
return
{
// 遮罩层
// 遮罩层
...
...
ruoyi-ui/src/views/system/role/index.vue
View file @
fee8a595
...
@@ -238,6 +238,7 @@ import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/m
...
@@ -238,6 +238,7 @@ import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/m
import
{
treeselect
as
deptTreeselect
,
roleDeptTreeselect
}
from
"
@/api/system/dept
"
;
import
{
treeselect
as
deptTreeselect
,
roleDeptTreeselect
}
from
"
@/api/system/dept
"
;
export
default
{
export
default
{
name
:
"
Role
"
,
data
()
{
data
()
{
return
{
return
{
// 遮罩层
// 遮罩层
...
...
ruoyi-ui/src/views/system/user/index.vue
View file @
fee8a595
...
@@ -290,12 +290,11 @@
...
@@ -290,12 +290,11 @@
<
script
>
<
script
>
import
{
listUser
,
getUser
,
delUser
,
addUser
,
updateUser
,
exportUser
,
resetUserPwd
,
changeUserStatus
}
from
"
@/api/system/user
"
;
import
{
listUser
,
getUser
,
delUser
,
addUser
,
updateUser
,
exportUser
,
resetUserPwd
,
changeUserStatus
}
from
"
@/api/system/user
"
;
import
{
treeselect
}
from
"
@/api/system/dept
"
;
import
{
treeselect
}
from
"
@/api/system/dept
"
;
import
{
listPost
}
from
"
@/api/system/post
"
;
import
{
listRole
}
from
"
@/api/system/role
"
;
import
Treeselect
from
"
@riophae/vue-treeselect
"
;
import
Treeselect
from
"
@riophae/vue-treeselect
"
;
import
"
@riophae/vue-treeselect/dist/vue-treeselect.css
"
;
import
"
@riophae/vue-treeselect/dist/vue-treeselect.css
"
;
export
default
{
export
default
{
name
:
"
User
"
,
components
:
{
Treeselect
},
components
:
{
Treeselect
},
data
()
{
data
()
{
return
{
return
{
...
@@ -423,18 +422,6 @@ export default {
...
@@ -423,18 +422,6 @@ export default {
this
.
queryParams
.
deptId
=
data
.
id
;
this
.
queryParams
.
deptId
=
data
.
id
;
this
.
getList
();
this
.
getList
();
},
},
/** 查询岗位列表 */
getPosts
()
{
listPost
().
then
(
response
=>
{
this
.
postOptions
=
response
.
rows
;
});
},
/** 查询角色列表 */
getRoles
()
{
listRole
().
then
(
response
=>
{
this
.
roleOptions
=
response
.
rows
;
});
},
// 用户状态修改
// 用户状态修改
handleStatusChange
(
row
)
{
handleStatusChange
(
row
)
{
let
text
=
row
.
status
===
"
0
"
?
"
启用
"
:
"
停用
"
;
let
text
=
row
.
status
===
"
0
"
?
"
启用
"
:
"
停用
"
;
...
@@ -494,21 +481,23 @@ export default {
...
@@ -494,21 +481,23 @@ export default {
handleAdd
()
{
handleAdd
()
{
this
.
reset
();
this
.
reset
();
this
.
getTreeselect
();
this
.
getTreeselect
();
this
.
getPosts
();
getUser
().
then
(
response
=>
{
this
.
getRoles
();
this
.
postOptions
=
response
.
posts
;
this
.
roleOptions
=
response
.
roles
;
this
.
open
=
true
;
this
.
open
=
true
;
this
.
title
=
"
添加用户
"
;
this
.
title
=
"
添加用户
"
;
this
.
form
.
password
=
this
.
initPassword
;
this
.
form
.
password
=
this
.
initPassword
;
});
},
},
/** 修改按钮操作 */
/** 修改按钮操作 */
handleUpdate
(
row
)
{
handleUpdate
(
row
)
{
this
.
reset
();
this
.
reset
();
this
.
getTreeselect
();
this
.
getTreeselect
();
this
.
getPosts
();
this
.
getRoles
();
const
userId
=
row
.
userId
||
this
.
ids
const
userId
=
row
.
userId
||
this
.
ids
getUser
(
userId
).
then
(
response
=>
{
getUser
(
userId
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
form
=
response
.
data
;
this
.
postOptions
=
response
.
posts
;
this
.
roleOptions
=
response
.
roles
;
this
.
form
.
postIds
=
response
.
postIds
;
this
.
form
.
postIds
=
response
.
postIds
;
this
.
form
.
roleIds
=
response
.
roleIds
;
this
.
form
.
roleIds
=
response
.
roleIds
;
this
.
open
=
true
;
this
.
open
=
true
;
...
...
ruoyi-ui/src/views/system/user/profile/index.vue
View file @
fee8a595
...
@@ -89,13 +89,3 @@ export default {
...
@@ -89,13 +89,3 @@ export default {
}
}
};
};
</
script
>
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
>
.avatar-uploader-icon
{
font-size
:
28px
;
width
:
120px
;
height
:
120px
;
line-height
:
120px
;
text-align
:
center
;
}
</
style
>
ruoyi-ui/src/views/tool/gen/basicInfoForm.vue
0 → 100644
View file @
fee8a595
<
template
>
<el-form
ref=
"basicInfoForm"
:model=
"info"
:rules=
"rules"
label-width=
"150px"
>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
label=
"表名称"
prop=
"tableName"
>
<el-input
placeholder=
"请输入仓库名称"
v-model=
"info.tableName"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"表描述"
prop=
"tableComment"
>
<el-input
placeholder=
"请输入"
v-model=
"info.tableComment"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"实体类名称"
prop=
"className"
>
<el-input
placeholder=
"请输入"
v-model=
"info.className"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"作者"
prop=
"functionAuthor"
>
<el-input
placeholder=
"请输入"
v-model=
"info.functionAuthor"
/>
</el-form-item>
</el-col>
<el-col
:span=
"24"
>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
type=
"textarea"
:rows=
"3"
v-model=
"info.remark"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</
template
>
<
script
>
export
default
{
name
:
"
BasicInfoForm
"
,
props
:
{
info
:
{
type
:
Object
,
default
:
null
}
},
data
()
{
return
{
rules
:
{
tableName
:
[
{
required
:
true
,
message
:
"
请输入表名称
"
,
trigger
:
"
blur
"
}
],
tableComment
:
[
{
required
:
true
,
message
:
"
请输入表描述
"
,
trigger
:
"
blur
"
}
],
className
:
[
{
required
:
true
,
message
:
"
请输入实体类名称
"
,
trigger
:
"
blur
"
}
],
functionAuthor
:
[
{
required
:
true
,
message
:
"
请输入作者
"
,
trigger
:
"
blur
"
}
]
}
};
}
};
</
script
>
ruoyi-ui/src/views/tool/gen/editTable.vue
0 → 100644
View file @
fee8a595
<
template
>
<el-card>
<el-tabs
v-model=
"activeName"
>
<el-tab-pane
label=
"基本信息"
name=
"basic"
>
<basic-info-form
ref=
"basicInfo"
:info=
"info"
/>
</el-tab-pane>
<el-tab-pane
label=
"字段信息"
name=
"cloum"
>
<el-table
:data=
"cloumns"
:max-height=
"tableHeight"
>
<el-table-column
label=
"序号"
type=
"index"
min-width=
"5%"
/>
<el-table-column
label=
"字段列名"
prop=
"columnName"
min-width=
"10%"
:show-overflow-tooltip=
"true"
/>
<el-table-column
label=
"字段描述"
prop=
"columnComment"
min-width=
"10%"
:show-overflow-tooltip=
"true"
/>
<el-table-column
label=
"物理类型"
prop=
"columnType"
min-width=
"10%"
:show-overflow-tooltip=
"true"
/>
<el-table-column
label=
"Java类型"
min-width=
"11%"
>
<template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.javaType"
>
<el-option
label=
"Long"
value=
"Long"
/>
<el-option
label=
"String"
value=
"String"
/>
<el-option
label=
"Ingeter"
value=
"Ingeter"
/>
<el-option
label=
"Double"
value=
"Double"
/>
<el-option
label=
"BigDecimal"
value=
"BigDecimal"
/>
<el-option
label=
"Date"
value=
"Date"
/>
</el-select>
</
template
>
</el-table-column>
<el-table-column
label=
"java属性"
min-width=
"10%"
>
<
template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.javaField"
></el-input>
</
template
>
</el-table-column>
<el-table-column
label=
"插入"
min-width=
"5%"
>
<
template
slot-scope=
"scope"
>
<el-checkbox
true-label=
"1"
v-model=
"scope.row.isInsert"
></el-checkbox>
</
template
>
</el-table-column>
<el-table-column
label=
"编辑"
min-width=
"5%"
>
<
template
slot-scope=
"scope"
>
<el-checkbox
true-label=
"1"
v-model=
"scope.row.isEdit"
></el-checkbox>
</
template
>
</el-table-column>
<el-table-column
label=
"列表"
min-width=
"5%"
>
<
template
slot-scope=
"scope"
>
<el-checkbox
true-label=
"1"
v-model=
"scope.row.isList"
></el-checkbox>
</
template
>
</el-table-column>
<el-table-column
label=
"查询"
min-width=
"5%"
>
<
template
slot-scope=
"scope"
>
<el-checkbox
true-label=
"1"
v-model=
"scope.row.isQuery"
></el-checkbox>
</
template
>
</el-table-column>
<el-table-column
label=
"查询方式"
min-width=
"10%"
>
<
template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.queryType"
>
<el-option
label=
"="
value=
"EQ"
/>
<el-option
label=
"!="
value=
"NE"
/>
<el-option
label=
">"
value=
"GT"
/>
<el-option
label=
">="
value=
"GTE"
/>
<el-option
label=
"
<
"
value=
"LT"
/>
<el-option
label=
"
<
="
value=
"LTE"
/>
<el-option
label=
"LIKE"
value=
"LIKE"
/>
<el-option
label=
"BETWEEN"
value=
"BETWEEN"
/>
</el-select>
</
template
>
</el-table-column>
<el-table-column
label=
"必填"
min-width=
"5%"
>
<
template
slot-scope=
"scope"
>
<el-checkbox
true-label=
"1"
v-model=
"scope.row.isRequired"
></el-checkbox>
</
template
>
</el-table-column>
<el-table-column
label=
"显示类型"
min-width=
"12%"
>
<
template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.htmlType"
>
<el-option
label=
"文本框"
value=
"input"
/>
<el-option
label=
"文本域"
value=
"textarea"
/>
<el-option
label=
"下拉框"
value=
"select"
/>
<el-option
label=
"单选框"
value=
"radio"
/>
<el-option
label=
"复选框"
value=
"checkbox"
/>
<el-option
label=
"日期控件"
value=
"datetime"
/>
</el-select>
</
template
>
</el-table-column>
<el-table-column
label=
"字典类型"
min-width=
"12%"
>
<
template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.dictType"
clearable
filterable
placeholder=
"请选择"
>
<el-option
v-for=
"dict in dictOptions"
:key=
"dict.dictType"
:label=
"dict.dictName"
:value=
"dict.dictType"
>
<span
style=
"float: left"
>
{{
dict
.
dictName
}}
</span>
<span
style=
"float: right; color: #8492a6; font-size: 13px"
>
{{
dict
.
dictType
}}
</span>
</el-option>
</el-select>
</
template
>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane
label=
"生成信息"
name=
"genInfo"
>
<gen-info-form
ref=
"genInfo"
:info=
"info"
/>
</el-tab-pane>
</el-tabs>
<el-form
label-width=
"100px"
>
<el-form-item
style=
"text-align: center;margin-left:-100px;margin-top:10px;"
>
<el-button
type=
"primary"
@
click=
"submitForm()"
>
提交
</el-button>
<el-button
@
click=
"close()"
>
返回
</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<
script
>
import
{
getGenTable
,
updateGenTable
}
from
"
@/api/tool/gen
"
;
import
{
optionselect
as
getDictOptionselect
}
from
"
@/api/system/dict/type
"
;
import
basicInfoForm
from
"
./basicInfoForm
"
;
import
genInfoForm
from
"
./genInfoForm
"
;
export
default
{
name
:
"
GenEdit
"
,
components
:
{
basicInfoForm
,
genInfoForm
},
data
()
{
return
{
// 选中选项卡的 name
activeName
:
"
cloum
"
,
// 表格的高度
tableHeight
:
document
.
documentElement
.
scrollHeight
-
245
+
"
px
"
,
// 表列信息
cloumns
:
[],
// 字典信息
dictOptions
:
[],
// 表详细信息
info
:
{}
};
},
beforeCreate
()
{
const
{
tableId
}
=
this
.
$route
.
query
;
if
(
tableId
)
{
// 获取表详细信息
getGenTable
(
tableId
).
then
(
res
=>
{
this
.
cloumns
=
res
.
data
.
rows
;
this
.
info
=
res
.
data
.
info
;
});
/** 查询字典下拉列表 */
getDictOptionselect
().
then
(
response
=>
{
this
.
dictOptions
=
response
.
data
;
});
}
},
methods
:
{
/** 提交按钮 */
submitForm
()
{
const
basicForm
=
this
.
$refs
.
basicInfo
.
$refs
.
basicInfoForm
;
const
genForm
=
this
.
$refs
.
genInfo
.
$refs
.
genInfoForm
;
Promise
.
all
([
basicForm
,
genForm
].
map
(
this
.
getFormPromise
)).
then
(
res
=>
{
const
validateResult
=
res
.
every
(
item
=>
!!
item
);
if
(
validateResult
)
{
const
genTable
=
Object
.
assign
({},
basicForm
.
model
,
genForm
.
model
);
genTable
.
columns
=
this
.
cloumns
;
genTable
.
params
=
{
treeCode
:
genTable
.
treeCode
,
treeName
:
genTable
.
treeName
,
treeParentCode
:
genTable
.
treeParentCode
};
updateGenTable
(
genTable
).
then
(
res
=>
{
this
.
msgSuccess
(
res
.
msg
);
if
(
res
.
code
===
200
)
{
this
.
close
();
}
});
}
else
{
this
.
msgError
(
"
表单校验未通过,请重新检查提交内容
"
);
}
});
},
getFormPromise
(
form
)
{
return
new
Promise
(
resolve
=>
{
form
.
validate
(
res
=>
{
resolve
(
res
);
});
});
},
/** 关闭按钮 */
close
()
{
this
.
$store
.
dispatch
(
"
tagsView/delView
"
,
this
.
$route
);
this
.
$router
.
push
({
path
:
"
/tool/gen
"
,
query
:
{
t
:
Date
.
now
()}})
}
}
};
</
script
>
ruoyi-ui/src/views/tool/gen/genInfoForm.vue
0 → 100644
View file @
fee8a595
<
template
>
<el-form
ref=
"genInfoForm"
:model=
"info"
:rules=
"rules"
label-width=
"150px"
>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
prop=
"tplCategory"
>
<span
slot=
"label"
>
生成模板
</span>
<el-select
v-model=
"info.tplCategory"
>
<el-option
label=
"单表(增删改查)"
value=
"crud"
/>
<el-option
label=
"树表(增删改查)"
value=
"tree"
disabled
/>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
prop=
"packageName"
>
<span
slot=
"label"
>
生成包路径
<el-tooltip
content=
"生成在哪个java包下,例如 com.ruoyi.system"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
</span>
<el-input
v-model=
"info.packageName"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
prop=
"moduleName"
>
<span
slot=
"label"
>
生成模块名
<el-tooltip
content=
"可理解为子系统名,例如 system"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
</span>
<el-input
v-model=
"info.moduleName"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
prop=
"businessName"
>
<span
slot=
"label"
>
生成业务名
<el-tooltip
content=
"可理解为功能英文名,例如 user"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
</span>
<el-input
v-model=
"info.businessName"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
prop=
"functionName"
>
<span
slot=
"label"
>
生成功能名
<el-tooltip
content=
"用作类描述,例如 用户"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
</span>
<el-input
v-model=
"info.functionName"
/>
</el-form-item>
</el-col>
</el-row>
<el-row
v-show=
"info.tplCategory == 'tree'"
>
<h4
class=
"form-header"
>
其他信息
</h4>
<el-col
:span=
"12"
>
<el-form-item>
<span
slot=
"label"
>
树编码字段
<el-tooltip
content=
"树显示的编码字段名, 如:dept_id"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
</span>
<el-select
v-model=
"info.treeCode"
placeholder=
"请选择"
>
<el-option
v-for=
"column in info.columns"
:key=
"column.columnName"
:label=
"column.columnName + ':' + column.columnComment"
:value=
"column.columnName"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item>
<span
slot=
"label"
>
树父编码字段
<el-tooltip
content=
"树显示的父编码字段名, 如:parent_Id"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
</span>
<el-select
v-model=
"info.treeParentCode"
placeholder=
"请选择"
>
<el-option
v-for=
"column in info.columns"
:key=
"column.columnName"
:label=
"column.columnName + ':' + column.columnComment"
:value=
"column.columnName"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item>
<span
slot=
"label"
>
树名称字段
<el-tooltip
content=
"树节点的显示名称字段名, 如:dept_name"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
</span>
<el-select
v-model=
"info.treeName"
placeholder=
"请选择"
>
<el-option
v-for=
"column in info.columns"
:key=
"column.columnName"
:label=
"column.columnName + ':' + column.columnComment"
:value=
"column.columnName"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</
template
>
<
script
>
export
default
{
name
:
"
BasicInfoForm
"
,
props
:
{
info
:
{
type
:
Object
,
default
:
null
}
},
data
()
{
return
{
rules
:
{
tplCategory
:
[
{
required
:
true
,
message
:
"
请选择生成模板
"
,
trigger
:
"
blur
"
}
],
packageName
:
[
{
required
:
true
,
message
:
"
请输入生成包路径
"
,
trigger
:
"
blur
"
}
],
moduleName
:
[
{
required
:
true
,
message
:
"
请输入生成模块名
"
,
trigger
:
"
blur
"
}
],
businessName
:
[
{
required
:
true
,
message
:
"
请输入生成业务名
"
,
trigger
:
"
blur
"
}
],
functionName
:
[
{
required
:
true
,
message
:
"
请输入生成功能名
"
,
trigger
:
"
blur
"
}
]
}
};
},
created
()
{}
};
</
script
>
ruoyi-ui/src/views/tool/gen/importTable.vue
0 → 100644
View file @
fee8a595
<
template
>
<!-- 导入表 -->
<el-dialog
title=
"导入表"
:visible.sync=
"visible"
width=
"800px"
top=
"5vh"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
:inline=
"true"
>
<el-form-item
label=
"表名称"
prop=
"tableName"
>
<el-input
v-model=
"queryParams.tableName"
placeholder=
"请输入表名称"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"表描述"
prop=
"tableComment"
>
<el-input
v-model=
"queryParams.tableComment"
placeholder=
"请输入表描述"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row>
<el-table
:data=
"dbTableList"
@
selection-change=
"handleSelectionChange"
height=
"260px"
>
<el-table-column
type=
"selection"
width=
"55"
></el-table-column>
<el-table-column
prop=
"tableName"
label=
"表名称"
></el-table-column>
<el-table-column
prop=
"tableComment"
label=
"表描述"
></el-table-column>
<el-table-column
prop=
"createTime"
label=
"创建时间"
></el-table-column>
<el-table-column
prop=
"updateTime"
label=
"更新时间"
></el-table-column>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page.sync=
"queryParams.pageNum"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</el-row>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"handleImportTable"
>
确 定
</el-button>
<el-button
@
click=
"visible = false"
>
取 消
</el-button>
</div>
</el-dialog>
</
template
>
<
script
>
import
{
listDbTable
,
importTable
}
from
"
@/api/tool/gen
"
;
export
default
{
data
()
{
return
{
// 遮罩层
visible
:
false
,
// 选中数组值
tables
:
[],
// 总条数
total
:
0
,
// 表数据
dbTableList
:
[],
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
tableName
:
undefined
,
tableComment
:
undefined
}
};
},
methods
:
{
// 显示弹框
show
()
{
this
.
getList
();
this
.
visible
=
true
;
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
tables
=
selection
.
map
(
item
=>
item
.
tableName
);
},
// 查询表数据
getList
()
{
listDbTable
(
this
.
queryParams
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
this
.
dbTableList
=
res
.
rows
;
this
.
total
=
res
.
total
;
}
});
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
;
this
.
getList
();
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"
queryForm
"
);
this
.
handleQuery
();
},
/** 导入按钮操作 */
handleImportTable
()
{
importTable
({
tables
:
this
.
tables
.
join
(
"
,
"
)
}).
then
(
res
=>
{
this
.
msgSuccess
(
res
.
msg
);
if
(
res
.
code
===
200
)
{
this
.
visible
=
false
;
this
.
$emit
(
"
ok
"
);
}
});
}
}
};
</
script
>
ruoyi-ui/src/views/tool/gen/index.vue
View file @
fee8a595
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
代码生成
<el-form
:model=
"queryParams"
ref=
"queryForm"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"表名称"
prop=
"tableName"
>
<el-input
v-model=
"queryParams.tableName"
placeholder=
"请输入表名称"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"表描述"
prop=
"tableComment"
>
<el-input
v-model=
"queryParams.tableComment"
placeholder=
"请输入表描述"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"创建时间"
>
<el-date-picker
v-model=
"dateRange"
size=
"small"
style=
"width: 240px"
value-format=
"yyyy-MM-dd"
type=
"daterange"
range-separator=
"-"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleGenTable"
v-hasPermi=
"['tool:gen:code']"
>
生成
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"info"
icon=
"el-icon-upload"
size=
"mini"
@
click=
"openImportTable"
v-hasPermi=
"['tool:gen:import']"
>
导入
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleEditTable"
v-hasPermi=
"['tool:gen:edit']"
>
修改
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleDelete"
v-hasPermi=
"['tool:gen:remove']"
>
删除
</el-button>
</el-col>
</el-row>
<el-table
v-loading=
"loading"
:data=
"tableList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
></el-table-column>
<el-table-column
label=
"序号"
align=
"center"
prop=
"tableId"
width=
"50px"
/>
<el-table-column
label=
"表名称"
align=
"center"
prop=
"tableName"
:show-overflow-tooltip=
"true"
width=
"130"
/>
<el-table-column
label=
"表描述"
align=
"center"
prop=
"tableComment"
:show-overflow-tooltip=
"true"
width=
"130"
/>
<el-table-column
label=
"实体"
align=
"center"
prop=
"className"
:show-overflow-tooltip=
"true"
width=
"130"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
width=
"160"
/>
<el-table-column
label=
"更新时间"
align=
"center"
prop=
"updateTime"
width=
"160"
/>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<template
slot-scope=
"scope"
>
<el-button
type=
"text"
size=
"small"
icon=
"el-icon-view"
@
click=
"handlePreview(scope.row)"
v-hasPermi=
"['tool:gen:preview']"
>
预览
</el-button>
<el-button
type=
"text"
size=
"small"
icon=
"el-icon-edit"
@
click=
"handleEditTable(scope.row)"
v-hasPermi=
"['tool:gen:edit']"
>
编辑
</el-button>
<el-button
type=
"text"
size=
"small"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['tool:gen:remove']"
>
删除
</el-button>
<el-button
type=
"text"
size=
"small"
icon=
"el-icon-download"
@
click=
"handleGenTable(scope.row)"
v-hasPermi=
"['tool:gen:code']"
>
生成代码
</el-button>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page.sync=
"queryParams.pageNum"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<!-- 预览界面 -->
<el-dialog
:title=
"preview.title"
:visible.sync=
"preview.open"
width=
"80%"
top=
"5vh"
>
<el-tabs
v-model=
"preview.activeName"
>
<el-tab-pane
v-for=
"(value, key) in preview.data"
:label=
"key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:name=
"key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:key=
"key"
>
<pre>
{{ value }}
</pre>
</el-tab-pane>
</el-tabs>
</el-dialog>
<import-table
ref=
"import"
@
ok=
"handleQuery"
/>
</div>
</div>
</template>
</template>
<
script
>
import
{
listTable
,
previewTable
,
delTable
}
from
"
@/api/tool/gen
"
;
import
importTable
from
"
./importTable
"
;
import
{
downLoadZip
}
from
"
@/utils/zipdownload
"
;
export
default
{
name
:
"
Gen
"
,
components
:
{
importTable
},
data
()
{
return
{
// 遮罩层
loading
:
true
,
// 唯一标识符
uniqueId
:
""
,
// 选中数组
ids
:
[],
// 选中表数组
tableNames
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 总条数
total
:
0
,
// 表数据
tableList
:
[],
// 日期范围
dateRange
:
""
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
tableName
:
undefined
,
tableComment
:
undefined
},
// 预览参数
preview
:
{
open
:
false
,
title
:
"
代码预览
"
,
data
:
{},
activeName
:
"
domain.java
"
}
};
},
created
()
{
this
.
getList
();
},
activated
()
{
const
time
=
this
.
$route
.
query
.
t
;
if
(
time
!=
null
&&
time
!=
this
.
uniqueId
)
{
this
.
uniqueId
=
time
;
this
.
resetQuery
();
}
},
methods
:
{
/** 查询表集合 */
getList
()
{
this
.
loading
=
true
;
listTable
(
this
.
addDateRange
(
this
.
queryParams
,
this
.
dateRange
)).
then
(
response
=>
{
this
.
tableList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
}
);
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
;
this
.
getList
();
},
/** 生成代码操作 */
handleGenTable
(
row
)
{
const
tableNames
=
row
.
tableName
||
this
.
tableNames
;
if
(
tableNames
==
""
)
{
this
.
msgError
(
"
请选择要生成的数据
"
);
return
;
}
downLoadZip
(
"
/tool/gen/batchGenCode?tables=
"
+
tableNames
,
"
ruoyi
"
);
},
/** 打开导入表弹窗 */
openImportTable
()
{
this
.
$refs
.
import
.
show
();
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
dateRange
=
[];
this
.
resetForm
(
"
queryForm
"
);
this
.
handleQuery
();
},
/** 预览按钮 */
handlePreview
(
row
)
{
previewTable
(
row
.
tableId
).
then
(
response
=>
{
this
.
preview
.
data
=
response
.
data
;
this
.
preview
.
open
=
true
;
});
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
tableId
);
this
.
tableNames
=
selection
.
map
(
item
=>
item
.
tableName
);
this
.
single
=
selection
.
length
!=
1
;
this
.
multiple
=
!
selection
.
length
;
},
/** 修改按钮操作 */
handleEditTable
(
row
)
{
const
tableId
=
row
.
tableId
||
this
.
ids
[
0
];
this
.
$router
.
push
({
path
:
"
/gen/edit
"
,
query
:
{
tableId
:
tableId
}
});
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
tableIds
=
row
.
tableId
||
this
.
ids
;
this
.
$confirm
(
'
是否确认删除表编号为"
'
+
tableIds
+
'
"的数据项?
'
,
"
警告
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
}).
then
(
function
()
{
return
delTable
(
tableIds
);
}).
then
(()
=>
{
this
.
getList
();
this
.
msgSuccess
(
"
删除成功
"
);
}).
catch
(
function
()
{});
}
}
};
</
script
>
\ No newline at end of file
ruoyi-ui/src/views/tool/swagger/index.vue
View file @
fee8a595
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
"
Swagger
"
,
data
()
{
data
()
{
return
{
return
{
src
:
process
.
env
.
VUE_APP_BASE_API
+
"
/swagger-ui.html
"
,
src
:
process
.
env
.
VUE_APP_BASE_API
+
"
/swagger-ui.html
"
,
...
...
ruoyi/pom.xml
View file @
fee8a595
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<groupId>
com.ruoyi
</groupId>
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi
</artifactId>
<artifactId>
ruoyi
</artifactId>
<version>
1.1
</version>
<version>
2.0.0
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
ruoyi
</name>
<name>
ruoyi
</name>
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
<swagger.version>
2.9.2
</swagger.version>
<swagger.version>
2.9.2
</swagger.version>
<poi.version>
3.17
</poi.version>
<poi.version>
3.17
</poi.version>
<oshi.version>
3.9.1
</oshi.version>
<oshi.version>
3.9.1
</oshi.version>
<velocity.version>
1.7
</velocity.version>
</properties>
</properties>
<dependencies>
<dependencies>
...
@@ -231,6 +232,12 @@
...
@@ -231,6 +232,12 @@
<artifactId>
poi-ooxml
</artifactId>
<artifactId>
poi-ooxml
</artifactId>
<version>
${poi.version}
</version>
<version>
${poi.version}
</version>
</dependency>
</dependency>
<!--velocity代码生成使用模板 -->
<dependency>
<groupId>
org.apache.velocity
</groupId>
<artifactId>
velocity
</artifactId>
<version>
${velocity.version}
</version>
</dependency>
</dependencies>
</dependencies>
...
...
ruoyi/sql/ry_20191
1
20.sql
→
ruoyi/sql/ry_2019120
2
.sql
View file @
fee8a595
...
@@ -246,8 +246,9 @@ insert into sys_menu values('1054', '任务导出', '110', '7', '#', '', 1, 'F',
...
@@ -246,8 +246,9 @@ insert into sys_menu values('1054', '任务导出', '110', '7', '#', '', 1, 'F',
insert
into
sys_menu
values
(
'1055'
,
'生成查询'
,
'114'
,
'1'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:query'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1055'
,
'生成查询'
,
'114'
,
'1'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:query'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1056'
,
'生成修改'
,
'114'
,
'2'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:edit'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1056'
,
'生成修改'
,
'114'
,
'2'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:edit'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1057'
,
'生成删除'
,
'114'
,
'3'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:remove'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1057'
,
'生成删除'
,
'114'
,
'3'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:remove'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1058'
,
'预览代码'
,
'114'
,
'4'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:preview'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1058'
,
'导入代码'
,
'114'
,
'2'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:import'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1059'
,
'生成代码'
,
'114'
,
'5'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:code'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1059'
,
'预览代码'
,
'114'
,
'4'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:preview'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
insert
into
sys_menu
values
(
'1060'
,
'生成代码'
,
'114'
,
'5'
,
'#'
,
''
,
1
,
'F'
,
'0'
,
'tool:gen:code'
,
'#'
,
'admin'
,
'2018-03-16 11-33-00'
,
'ry'
,
'2018-03-16 11-33-00'
,
''
);
-- ----------------------------
-- ----------------------------
...
@@ -362,6 +363,7 @@ insert into sys_role_menu values ('2', '1056');
...
@@ -362,6 +363,7 @@ insert into sys_role_menu values ('2', '1056');
insert
into
sys_role_menu
values
(
'2'
,
'1057'
);
insert
into
sys_role_menu
values
(
'2'
,
'1057'
);
insert
into
sys_role_menu
values
(
'2'
,
'1058'
);
insert
into
sys_role_menu
values
(
'2'
,
'1058'
);
insert
into
sys_role_menu
values
(
'2'
,
'1059'
);
insert
into
sys_role_menu
values
(
'2'
,
'1059'
);
insert
into
sys_role_menu
values
(
'2'
,
'1060'
);
-- ----------------------------
-- ----------------------------
-- 8、角色和部门关联表 角色1-N部门
-- 8、角色和部门关联表 角色1-N部门
...
...
ruoyi/src/main/java/com/ruoyi/common/constant/GenConstants.java
0 → 100644
View file @
fee8a595
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"
};
/** Entity基类字段 */
public
static
final
String
[]
BASE_ENTITY
=
{
"createBy"
,
"createTime"
,
"updateBy"
,
"updateTime"
,
"remark"
};
/** Tree基类字段 */
public
static
final
String
[]
TREE_ENTITY
=
{
"parentName"
,
"parentId"
,
"orderNum"
,
"ancestors"
};
/** 文本框 */
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"
;
}
ruoyi/src/main/java/com/ruoyi/common/utils/text/CharsetKit.java
0 → 100644
View file @
fee8a595
package
com.ruoyi.common.utils.text
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
com.ruoyi.common.utils.StringUtils
;
/**
* 字符集工具类
*
* @author ruoyi
*
*/
public
class
CharsetKit
{
/** ISO-8859-1 */
public
static
final
String
ISO_8859_1
=
"ISO-8859-1"
;
/** UTF-8 */
public
static
final
String
UTF_8
=
"UTF-8"
;
/** GBK */
public
static
final
String
GBK
=
"GBK"
;
/** ISO-8859-1 */
public
static
final
Charset
CHARSET_ISO_8859_1
=
Charset
.
forName
(
ISO_8859_1
);
/** UTF-8 */
public
static
final
Charset
CHARSET_UTF_8
=
Charset
.
forName
(
UTF_8
);
/** GBK */
public
static
final
Charset
CHARSET_GBK
=
Charset
.
forName
(
GBK
);
/**
* 转换为Charset对象
*
* @param charset 字符集,为空则返回默认字符集
* @return Charset
*/
public
static
Charset
charset
(
String
charset
)
{
return
StringUtils
.
isEmpty
(
charset
)
?
Charset
.
defaultCharset
()
:
Charset
.
forName
(
charset
);
}
/**
* 转换字符串的字符集编码
*
* @param source 字符串
* @param srcCharset 源字符集,默认ISO-8859-1
* @param destCharset 目标字符集,默认UTF-8
* @return 转换后的字符集
*/
public
static
String
convert
(
String
source
,
String
srcCharset
,
String
destCharset
)
{
return
convert
(
source
,
Charset
.
forName
(
srcCharset
),
Charset
.
forName
(
destCharset
));
}
/**
* 转换字符串的字符集编码
*
* @param source 字符串
* @param srcCharset 源字符集,默认ISO-8859-1
* @param destCharset 目标字符集,默认UTF-8
* @return 转换后的字符集
*/
public
static
String
convert
(
String
source
,
Charset
srcCharset
,
Charset
destCharset
)
{
if
(
null
==
srcCharset
)
{
srcCharset
=
StandardCharsets
.
ISO_8859_1
;
}
if
(
null
==
destCharset
)
{
srcCharset
=
StandardCharsets
.
UTF_8
;
}
if
(
StringUtils
.
isEmpty
(
source
)
||
srcCharset
.
equals
(
destCharset
))
{
return
source
;
}
return
new
String
(
source
.
getBytes
(
srcCharset
),
destCharset
);
}
/**
* @return 系统字符集编码
*/
public
static
String
systemCharset
()
{
return
Charset
.
defaultCharset
().
name
();
}
}
ruoyi/src/main/java/com/ruoyi/common/utils/text/Convert.java
0 → 100644
View file @
fee8a595
This diff is collapsed.
Click to expand it.
ruoyi/src/main/java/com/ruoyi/common/utils/text/StrFormatter.java
0 → 100644
View file @
fee8a595
package
com.ruoyi.common.utils.text
;
import
com.ruoyi.common.utils.StringUtils
;
/**
* 字符串格式化
*
* @author ruoyi
*/
public
class
StrFormatter
{
public
static
final
String
EMPTY_JSON
=
"{}"
;
public
static
final
char
C_BACKSLASH
=
'\\'
;
public
static
final
char
C_DELIM_START
=
'{'
;
public
static
final
char
C_DELIM_END
=
'}'
;
/**
* 格式化字符串<br>
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
* 例:<br>
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
*
* @param strPattern 字符串模板
* @param argArray 参数列表
* @return 结果
*/
public
static
String
format
(
final
String
strPattern
,
final
Object
...
argArray
)
{
if
(
StringUtils
.
isEmpty
(
strPattern
)
||
StringUtils
.
isEmpty
(
argArray
))
{
return
strPattern
;
}
final
int
strPatternLength
=
strPattern
.
length
();
// 初始化定义好的长度以获得更好的性能
StringBuilder
sbuf
=
new
StringBuilder
(
strPatternLength
+
50
);
int
handledPosition
=
0
;
int
delimIndex
;
// 占位符所在位置
for
(
int
argIndex
=
0
;
argIndex
<
argArray
.
length
;
argIndex
++)
{
delimIndex
=
strPattern
.
indexOf
(
EMPTY_JSON
,
handledPosition
);
if
(
delimIndex
==
-
1
)
{
if
(
handledPosition
==
0
)
{
return
strPattern
;
}
else
{
// 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
sbuf
.
append
(
strPattern
,
handledPosition
,
strPatternLength
);
return
sbuf
.
toString
();
}
}
else
{
if
(
delimIndex
>
0
&&
strPattern
.
charAt
(
delimIndex
-
1
)
==
C_BACKSLASH
)
{
if
(
delimIndex
>
1
&&
strPattern
.
charAt
(
delimIndex
-
2
)
==
C_BACKSLASH
)
{
// 转义符之前还有一个转义符,占位符依旧有效
sbuf
.
append
(
strPattern
,
handledPosition
,
delimIndex
-
1
);
sbuf
.
append
(
Convert
.
utf8Str
(
argArray
[
argIndex
]));
handledPosition
=
delimIndex
+
2
;
}
else
{
// 占位符被转义
argIndex
--;
sbuf
.
append
(
strPattern
,
handledPosition
,
delimIndex
-
1
);
sbuf
.
append
(
C_DELIM_START
);
handledPosition
=
delimIndex
+
1
;
}
}
else
{
// 正常占位符
sbuf
.
append
(
strPattern
,
handledPosition
,
delimIndex
);
sbuf
.
append
(
Convert
.
utf8Str
(
argArray
[
argIndex
]));
handledPosition
=
delimIndex
+
2
;
}
}
}
// append the characters following the last {} pair.
// 加入最后一个占位符后所有的字符
sbuf
.
append
(
strPattern
,
handledPosition
,
strPattern
.
length
());
return
sbuf
.
toString
();
}
}
ruoyi/src/main/java/com/ruoyi/framework/config/GenConfig.java
0 → 100644
View file @
fee8a595
package
com.ruoyi.framework.config
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
/**
* 读取代码生成相关配置
*
* @author ruoyi
*/
@Component
@ConfigurationProperties
(
prefix
=
"gen"
)
public
class
GenConfig
{
/** 作者 */
public
static
String
author
;
/** 生成包路径 */
public
static
String
packageName
;
/** 自动去除表前缀,默认是true */
public
static
boolean
autoRemovePre
;
/** 表前缀(类名不会包含表前缀) */
public
static
String
tablePrefix
;
public
static
String
getAuthor
()
{
return
author
;
}
public
void
setAuthor
(
String
author
)
{
GenConfig
.
author
=
author
;
}
public
static
String
getPackageName
()
{
return
packageName
;
}
public
void
setPackageName
(
String
packageName
)
{
GenConfig
.
packageName
=
packageName
;
}
public
static
boolean
getAutoRemovePre
()
{
return
autoRemovePre
;
}
public
void
setAutoRemovePre
(
boolean
autoRemovePre
)
{
GenConfig
.
autoRemovePre
=
autoRemovePre
;
}
public
static
String
getTablePrefix
()
{
return
tablePrefix
;
}
public
void
setTablePrefix
(
String
tablePrefix
)
{
GenConfig
.
tablePrefix
=
tablePrefix
;
}
}
ruoyi/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java
View file @
fee8a595
...
@@ -4,7 +4,6 @@ import java.io.Serializable;
...
@@ -4,7 +4,6 @@ import java.io.Serializable;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
@@ -40,9 +39,16 @@ public class BaseEntity implements Serializable
...
@@ -40,9 +39,16 @@ public class BaseEntity implements Serializable
/** 数据权限 */
/** 数据权限 */
private
String
dataScope
;
private
String
dataScope
;
/** 请求参数 */
/** 开始时间 */
@JsonIgnore
private
String
beginTime
;
/** 结束时间 */
@JsonIgnore
@JsonIgnore
private
String
params
;
private
String
endTime
;
/** 请求参数 */
private
Map
<
String
,
Object
>
params
;
public
String
getSearchValue
()
public
String
getSearchValue
()
{
{
...
@@ -114,17 +120,36 @@ public class BaseEntity implements Serializable
...
@@ -114,17 +120,36 @@ public class BaseEntity implements Serializable
this
.
dataScope
=
dataScope
;
this
.
dataScope
=
dataScope
;
}
}
@SuppressWarnings
(
"unchecked"
)
public
String
getBeginTime
()
{
return
beginTime
;
}
public
void
setBeginTime
(
String
beginTime
)
{
this
.
beginTime
=
beginTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Map
<
String
,
Object
>
getParams
()
public
Map
<
String
,
Object
>
getParams
()
{
{
if
(
params
==
null
)
if
(
params
==
null
)
{
{
return
new
HashMap
<>();
params
=
new
HashMap
<>();
}
}
return
JSON
.
parseObject
(
params
,
Map
.
class
)
;
return
params
;
}
}
public
void
setParams
(
String
params
)
public
void
setParams
(
Map
<
String
,
Object
>
params
)
{
{
this
.
params
=
params
;
this
.
params
=
params
;
}
}
...
...
ruoyi/src/main/java/com/ruoyi/project/system/controller/SysConfigController.java
View file @
fee8a595
...
@@ -70,7 +70,6 @@ public class SysConfigController extends BaseController
...
@@ -70,7 +70,6 @@ public class SysConfigController extends BaseController
/**
/**
* 根据参数键名查询参数值
* 根据参数键名查询参数值
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:config:query')"
)
@GetMapping
(
value
=
"/configKey/{configKey}"
)
@GetMapping
(
value
=
"/configKey/{configKey}"
)
public
AjaxResult
getConfigKey
(
@PathVariable
String
configKey
)
public
AjaxResult
getConfigKey
(
@PathVariable
String
configKey
)
{
{
...
...
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