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
Commit
fee8a595
authored
Dec 02, 2019
by
RuoYi
Browse files
若依 2.0
parent
cef26e77
Changes
76
Hide 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
import
Editor
from
'
@/components/Editor
'
;
export
default
{
name
:
"
Notice
"
,
components
:
{
Editor
}
,
...
...
ruoyi-ui/src/views/system/post/index.vue
View file @
fee8a595
...
...
@@ -153,6 +153,7 @@
import
{
listPost
,
getPost
,
delPost
,
addPost
,
updatePost
,
exportPost
}
from
"
@/api/system/post
"
;
export
default
{
name
:
"
Post
"
,
data
()
{
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
import
{
treeselect
as
deptTreeselect
,
roleDeptTreeselect
}
from
"
@/api/system/dept
"
;
export
default
{
name
:
"
Role
"
,
data
()
{
return
{
// 遮罩层
...
...
ruoyi-ui/src/views/system/user/index.vue
View file @
fee8a595
...
...
@@ -290,12 +290,11 @@
<
script
>
import
{
listUser
,
getUser
,
delUser
,
addUser
,
updateUser
,
exportUser
,
resetUserPwd
,
changeUserStatus
}
from
"
@/api/system/user
"
;
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
"
@riophae/vue-treeselect/dist/vue-treeselect.css
"
;
export
default
{
name
:
"
User
"
,
components
:
{
Treeselect
},
data
()
{
return
{
...
...
@@ -423,18 +422,6 @@ export default {
this
.
queryParams
.
deptId
=
data
.
id
;
this
.
getList
();
},
/** 查询岗位列表 */
getPosts
()
{
listPost
().
then
(
response
=>
{
this
.
postOptions
=
response
.
rows
;
});
},
/** 查询角色列表 */
getRoles
()
{
listRole
().
then
(
response
=>
{
this
.
roleOptions
=
response
.
rows
;
});
},
// 用户状态修改
handleStatusChange
(
row
)
{
let
text
=
row
.
status
===
"
0
"
?
"
启用
"
:
"
停用
"
;
...
...
@@ -494,21 +481,23 @@ export default {
handleAdd
()
{
this
.
reset
();
this
.
getTreeselect
();
this
.
getPosts
();
this
.
getRoles
();
this
.
open
=
true
;
this
.
title
=
"
添加用户
"
;
this
.
form
.
password
=
this
.
initPassword
;
getUser
().
then
(
response
=>
{
this
.
postOptions
=
response
.
posts
;
this
.
roleOptions
=
response
.
roles
;
this
.
open
=
true
;
this
.
title
=
"
添加用户
"
;
this
.
form
.
password
=
this
.
initPassword
;
});
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
();
this
.
getTreeselect
();
this
.
getPosts
();
this
.
getRoles
();
const
userId
=
row
.
userId
||
this
.
ids
getUser
(
userId
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
postOptions
=
response
.
posts
;
this
.
roleOptions
=
response
.
roles
;
this
.
form
.
postIds
=
response
.
postIds
;
this
.
form
.
roleIds
=
response
.
roleIds
;
this
.
open
=
true
;
...
...
ruoyi-ui/src/views/system/user/profile/index.vue
View file @
fee8a595
...
...
@@ -89,13 +89,3 @@ export default {
}
};
</
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
>
<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>
</
template
>
\ No newline at end of file
</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 @@
</
template
>
<
script
>
export
default
{
name
:
"
Swagger
"
,
data
()
{
return
{
src
:
process
.
env
.
VUE_APP_BASE_API
+
"
/swagger-ui.html
"
,
...
...
ruoyi/pom.xml
View file @
fee8a595
...
...
@@ -5,7 +5,7 @@
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi
</artifactId>
<version>
1.1
</version>
<version>
2.0.0
</version>
<packaging>
jar
</packaging>
<name>
ruoyi
</name>
...
...
@@ -34,6 +34,7 @@
<swagger.version>
2.9.2
</swagger.version>
<poi.version>
3.17
</poi.version>
<oshi.version>
3.9.1
</oshi.version>
<velocity.version>
1.7
</velocity.version>
</properties>
<dependencies>
...
...
@@ -231,6 +232,12 @@
<artifactId>
poi-ooxml
</artifactId>
<version>
${poi.version}
</version>
</dependency>
<!--velocity代码生成使用模板 -->
<dependency>
<groupId>
org.apache.velocity
</groupId>
<artifactId>
velocity
</artifactId>
<version>
${velocity.version}
</version>
</dependency>
</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',
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
(
'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
(
'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
(
'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'
,
'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');
insert
into
sys_role_menu
values
(
'2'
,
'1057'
);
insert
into
sys_role_menu
values
(
'2'
,
'1058'
);
insert
into
sys_role_menu
values
(
'2'
,
'1059'
);
insert
into
sys_role_menu
values
(
'2'
,
'1060'
);
-- ----------------------------
-- 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
package
com.ruoyi.common.utils.text
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.nio.ByteBuffer
;
import
java.nio.charset.Charset
;
import
java.text.NumberFormat
;
import
java.util.Set
;
import
com.ruoyi.common.utils.StringUtils
;
/**
* 类型转换器
*
* @author ruoyi
*/
public
class
Convert
{
/**
* 转换为字符串<br>
* 如果给定的值为null,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
String
toStr
(
Object
value
,
String
defaultValue
)
{
if
(
null
==
value
)
{
return
defaultValue
;
}
if
(
value
instanceof
String
)
{
return
(
String
)
value
;
}
return
value
.
toString
();
}
/**
* 转换为字符串<br>
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
String
toStr
(
Object
value
)
{
return
toStr
(
value
,
null
);
}
/**
* 转换为字符<br>
* 如果给定的值为null,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Character
toChar
(
Object
value
,
Character
defaultValue
)
{
if
(
null
==
value
)
{
return
defaultValue
;
}
if
(
value
instanceof
Character
)
{
return
(
Character
)
value
;
}
final
String
valueStr
=
toStr
(
value
,
null
);
return
StringUtils
.
isEmpty
(
valueStr
)
?
defaultValue
:
valueStr
.
charAt
(
0
);
}
/**
* 转换为字符<br>
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Character
toChar
(
Object
value
)
{
return
toChar
(
value
,
null
);
}
/**
* 转换为byte<br>
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Byte
toByte
(
Object
value
,
Byte
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
Byte
)
{
return
(
Byte
)
value
;
}
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
byteValue
();
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
return
Byte
.
parseByte
(
valueStr
);
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为byte<br>
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Byte
toByte
(
Object
value
)
{
return
toByte
(
value
,
null
);
}
/**
* 转换为Short<br>
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Short
toShort
(
Object
value
,
Short
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
Short
)
{
return
(
Short
)
value
;
}
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
shortValue
();
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
return
Short
.
parseShort
(
valueStr
.
trim
());
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为Short<br>
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Short
toShort
(
Object
value
)
{
return
toShort
(
value
,
null
);
}
/**
* 转换为Number<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Number
toNumber
(
Object
value
,
Number
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
Number
)
{
return
(
Number
)
value
;
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
return
NumberFormat
.
getInstance
().
parse
(
valueStr
);
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为Number<br>
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Number
toNumber
(
Object
value
)
{
return
toNumber
(
value
,
null
);
}
/**
* 转换为int<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Integer
toInt
(
Object
value
,
Integer
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
Integer
)
{
return
(
Integer
)
value
;
}
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
intValue
();
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
return
Integer
.
parseInt
(
valueStr
.
trim
());
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为int<br>
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Integer
toInt
(
Object
value
)
{
return
toInt
(
value
,
null
);
}
/**
* 转换为Integer数组<br>
*
* @param str 被转换的值
* @return 结果
*/
public
static
Integer
[]
toIntArray
(
String
str
)
{
return
toIntArray
(
","
,
str
);
}
/**
* 转换为Long数组<br>
*
* @param str 被转换的值
* @return 结果
*/
public
static
Long
[]
toLongArray
(
String
str
)
{
return
toLongArray
(
","
,
str
);
}
/**
* 转换为Integer数组<br>
*
* @param split 分隔符
* @param split 被转换的值
* @return 结果
*/
public
static
Integer
[]
toIntArray
(
String
split
,
String
str
)
{
if
(
StringUtils
.
isEmpty
(
str
))
{
return
new
Integer
[]
{};
}
String
[]
arr
=
str
.
split
(
split
);
final
Integer
[]
ints
=
new
Integer
[
arr
.
length
];
for
(
int
i
=
0
;
i
<
arr
.
length
;
i
++)
{
final
Integer
v
=
toInt
(
arr
[
i
],
0
);
ints
[
i
]
=
v
;
}
return
ints
;
}
/**
* 转换为Long数组<br>
*
* @param split 分隔符
* @param str 被转换的值
* @return 结果
*/
public
static
Long
[]
toLongArray
(
String
split
,
String
str
)
{
if
(
StringUtils
.
isEmpty
(
str
))
{
return
new
Long
[]
{};
}
String
[]
arr
=
str
.
split
(
split
);
final
Long
[]
longs
=
new
Long
[
arr
.
length
];
for
(
int
i
=
0
;
i
<
arr
.
length
;
i
++)
{
final
Long
v
=
toLong
(
arr
[
i
],
null
);
longs
[
i
]
=
v
;
}
return
longs
;
}
/**
* 转换为String数组<br>
*
* @param str 被转换的值
* @return 结果
*/
public
static
String
[]
toStrArray
(
String
str
)
{
return
toStrArray
(
","
,
str
);
}
/**
* 转换为String数组<br>
*
* @param split 分隔符
* @param split 被转换的值
* @return 结果
*/
public
static
String
[]
toStrArray
(
String
split
,
String
str
)
{
return
str
.
split
(
split
);
}
/**
* 转换为long<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Long
toLong
(
Object
value
,
Long
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
Long
)
{
return
(
Long
)
value
;
}
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
longValue
();
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
// 支持科学计数法
return
new
BigDecimal
(
valueStr
.
trim
()).
longValue
();
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为long<br>
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Long
toLong
(
Object
value
)
{
return
toLong
(
value
,
null
);
}
/**
* 转换为double<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Double
toDouble
(
Object
value
,
Double
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
Double
)
{
return
(
Double
)
value
;
}
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
doubleValue
();
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
// 支持科学计数法
return
new
BigDecimal
(
valueStr
.
trim
()).
doubleValue
();
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为double<br>
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Double
toDouble
(
Object
value
)
{
return
toDouble
(
value
,
null
);
}
/**
* 转换为Float<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Float
toFloat
(
Object
value
,
Float
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
Float
)
{
return
(
Float
)
value
;
}
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
floatValue
();
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
return
Float
.
parseFloat
(
valueStr
.
trim
());
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为Float<br>
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Float
toFloat
(
Object
value
)
{
return
toFloat
(
value
,
null
);
}
/**
* 转换为boolean<br>
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
Boolean
toBool
(
Object
value
,
Boolean
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
Boolean
)
{
return
(
Boolean
)
value
;
}
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
valueStr
=
valueStr
.
trim
().
toLowerCase
();
switch
(
valueStr
)
{
case
"true"
:
return
true
;
case
"false"
:
return
false
;
case
"yes"
:
return
true
;
case
"ok"
:
return
true
;
case
"no"
:
return
false
;
case
"1"
:
return
true
;
case
"0"
:
return
false
;
default
:
return
defaultValue
;
}
}
/**
* 转换为boolean<br>
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
Boolean
toBool
(
Object
value
)
{
return
toBool
(
value
,
null
);
}
/**
* 转换为Enum对象<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
*
* @param clazz Enum的Class
* @param value 值
* @param defaultValue 默认值
* @return Enum
*/
public
static
<
E
extends
Enum
<
E
>>
E
toEnum
(
Class
<
E
>
clazz
,
Object
value
,
E
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
clazz
.
isAssignableFrom
(
value
.
getClass
()))
{
@SuppressWarnings
(
"unchecked"
)
E
myE
=
(
E
)
value
;
return
myE
;
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
return
Enum
.
valueOf
(
clazz
,
valueStr
);
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为Enum对象<br>
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
*
* @param clazz Enum的Class
* @param value 值
* @return Enum
*/
public
static
<
E
extends
Enum
<
E
>>
E
toEnum
(
Class
<
E
>
clazz
,
Object
value
)
{
return
toEnum
(
clazz
,
value
,
null
);
}
/**
* 转换为BigInteger<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
BigInteger
toBigInteger
(
Object
value
,
BigInteger
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
BigInteger
)
{
return
(
BigInteger
)
value
;
}
if
(
value
instanceof
Long
)
{
return
BigInteger
.
valueOf
((
Long
)
value
);
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
return
new
BigInteger
(
valueStr
);
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为BigInteger<br>
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
BigInteger
toBigInteger
(
Object
value
)
{
return
toBigInteger
(
value
,
null
);
}
/**
* 转换为BigDecimal<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public
static
BigDecimal
toBigDecimal
(
Object
value
,
BigDecimal
defaultValue
)
{
if
(
value
==
null
)
{
return
defaultValue
;
}
if
(
value
instanceof
BigDecimal
)
{
return
(
BigDecimal
)
value
;
}
if
(
value
instanceof
Long
)
{
return
new
BigDecimal
((
Long
)
value
);
}
if
(
value
instanceof
Double
)
{
return
new
BigDecimal
((
Double
)
value
);
}
if
(
value
instanceof
Integer
)
{
return
new
BigDecimal
((
Integer
)
value
);
}
final
String
valueStr
=
toStr
(
value
,
null
);
if
(
StringUtils
.
isEmpty
(
valueStr
))
{
return
defaultValue
;
}
try
{
return
new
BigDecimal
(
valueStr
);
}
catch
(
Exception
e
)
{
return
defaultValue
;
}
}
/**
* 转换为BigDecimal<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public
static
BigDecimal
toBigDecimal
(
Object
value
)
{
return
toBigDecimal
(
value
,
null
);
}
/**
* 将对象转为字符串<br>
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
*
* @param obj 对象
* @return 字符串
*/
public
static
String
utf8Str
(
Object
obj
)
{
return
str
(
obj
,
CharsetKit
.
CHARSET_UTF_8
);
}
/**
* 将对象转为字符串<br>
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
*
* @param obj 对象
* @param charsetName 字符集
* @return 字符串
*/
public
static
String
str
(
Object
obj
,
String
charsetName
)
{
return
str
(
obj
,
Charset
.
forName
(
charsetName
));
}
/**
* 将对象转为字符串<br>
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
*
* @param obj 对象
* @param charset 字符集
* @return 字符串
*/
public
static
String
str
(
Object
obj
,
Charset
charset
)
{
if
(
null
==
obj
)
{
return
null
;
}
if
(
obj
instanceof
String
)
{
return
(
String
)
obj
;
}
else
if
(
obj
instanceof
byte
[]
||
obj
instanceof
Byte
[])
{
return
str
((
Byte
[])
obj
,
charset
);
}
else
if
(
obj
instanceof
ByteBuffer
)
{
return
str
((
ByteBuffer
)
obj
,
charset
);
}
return
obj
.
toString
();
}
/**
* 将byte数组转为字符串
*
* @param bytes byte数组
* @param charset 字符集
* @return 字符串
*/
public
static
String
str
(
byte
[]
bytes
,
String
charset
)
{
return
str
(
bytes
,
StringUtils
.
isEmpty
(
charset
)
?
Charset
.
defaultCharset
()
:
Charset
.
forName
(
charset
));
}
/**
* 解码字节码
*
* @param data 字符串
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
* @return 解码后的字符串
*/
public
static
String
str
(
byte
[]
data
,
Charset
charset
)
{
if
(
data
==
null
)
{
return
null
;
}
if
(
null
==
charset
)
{
return
new
String
(
data
);
}
return
new
String
(
data
,
charset
);
}
/**
* 将编码的byteBuffer数据转换为字符串
*
* @param data 数据
* @param charset 字符集,如果为空使用当前系统字符集
* @return 字符串
*/
public
static
String
str
(
ByteBuffer
data
,
String
charset
)
{
if
(
data
==
null
)
{
return
null
;
}
return
str
(
data
,
Charset
.
forName
(
charset
));
}
/**
* 将编码的byteBuffer数据转换为字符串
*
* @param data 数据
* @param charset 字符集,如果为空使用当前系统字符集
* @return 字符串
*/
public
static
String
str
(
ByteBuffer
data
,
Charset
charset
)
{
if
(
null
==
charset
)
{
charset
=
Charset
.
defaultCharset
();
}
return
charset
.
decode
(
data
).
toString
();
}
// ----------------------------------------------------------------------- 全角半角转换
/**
* 半角转全角
*
* @param input String.
* @return 全角字符串.
*/
public
static
String
toSBC
(
String
input
)
{
return
toSBC
(
input
,
null
);
}
/**
* 半角转全角
*
* @param input String
* @param notConvertSet 不替换的字符集合
* @return 全角字符串.
*/
public
static
String
toSBC
(
String
input
,
Set
<
Character
>
notConvertSet
)
{
char
c
[]
=
input
.
toCharArray
();
for
(
int
i
=
0
;
i
<
c
.
length
;
i
++)
{
if
(
null
!=
notConvertSet
&&
notConvertSet
.
contains
(
c
[
i
]))
{
// 跳过不替换的字符
continue
;
}
if
(
c
[
i
]
==
' '
)
{
c
[
i
]
=
'\u3000'
;
}
else
if
(
c
[
i
]
<
'\
177
'
)
{
c
[
i
]
=
(
char
)
(
c
[
i
]
+
65248
);
}
}
return
new
String
(
c
);
}
/**
* 全角转半角
*
* @param input String.
* @return 半角字符串
*/
public
static
String
toDBC
(
String
input
)
{
return
toDBC
(
input
,
null
);
}
/**
* 替换全角为半角
*
* @param text 文本
* @param notConvertSet 不替换的字符集合
* @return 替换后的字符
*/
public
static
String
toDBC
(
String
text
,
Set
<
Character
>
notConvertSet
)
{
char
c
[]
=
text
.
toCharArray
();
for
(
int
i
=
0
;
i
<
c
.
length
;
i
++)
{
if
(
null
!=
notConvertSet
&&
notConvertSet
.
contains
(
c
[
i
]))
{
// 跳过不替换的字符
continue
;
}
if
(
c
[
i
]
==
'\u3000'
)
{
c
[
i
]
=
' '
;
}
else
if
(
c
[
i
]
>
'\
uFF00
'
&&
c
[
i
]
<
'\
uFF5F
'
)
{
c
[
i
]
=
(
char
)
(
c
[
i
]
-
65248
);
}
}
String
returnString
=
new
String
(
c
);
return
returnString
;
}
/**
* 数字金额大写转换 先写个完整的然后将如零拾替换成零
*
* @param n 数字
* @return 中文大写数字
*/
public
static
String
digitUppercase
(
double
n
)
{
String
[]
fraction
=
{
"角"
,
"分"
};
String
[]
digit
=
{
"零"
,
"壹"
,
"贰"
,
"叁"
,
"肆"
,
"伍"
,
"陆"
,
"柒"
,
"捌"
,
"玖"
};
String
[][]
unit
=
{
{
"元"
,
"万"
,
"亿"
},
{
""
,
"拾"
,
"佰"
,
"仟"
}
};
String
head
=
n
<
0
?
"负"
:
""
;
n
=
Math
.
abs
(
n
);
String
s
=
""
;
for
(
int
i
=
0
;
i
<
fraction
.
length
;
i
++)
{
s
+=
(
digit
[(
int
)
(
Math
.
floor
(
n
*
10
*
Math
.
pow
(
10
,
i
))
%
10
)]
+
fraction
[
i
]).
replaceAll
(
"(零.)+"
,
""
);
}
if
(
s
.
length
()
<
1
)
{
s
=
"整"
;
}
int
integerPart
=
(
int
)
Math
.
floor
(
n
);
for
(
int
i
=
0
;
i
<
unit
[
0
].
length
&&
integerPart
>
0
;
i
++)
{
String
p
=
""
;
for
(
int
j
=
0
;
j
<
unit
[
1
].
length
&&
n
>
0
;
j
++)
{
p
=
digit
[
integerPart
%
10
]
+
unit
[
1
][
j
]
+
p
;
integerPart
=
integerPart
/
10
;
}
s
=
p
.
replaceAll
(
"(零.)*零$"
,
""
).
replaceAll
(
"^$"
,
"零"
)
+
unit
[
0
][
i
]
+
s
;
}
return
head
+
s
.
replaceAll
(
"(零.)*零元"
,
"元"
).
replaceFirst
(
"(零.)+"
,
""
).
replaceAll
(
"(零.)+"
,
"零"
).
replaceAll
(
"^整$"
,
"零元整"
);
}
}
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;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
...
@@ -40,9 +39,16 @@ public class BaseEntity implements Serializable
/** 数据权限 */
private
String
dataScope
;
/** 请求参数 */
/** 开始时间 */
@JsonIgnore
private
String
beginTime
;
/** 结束时间 */
@JsonIgnore
private
String
params
;
private
String
endTime
;
/** 请求参数 */
private
Map
<
String
,
Object
>
params
;
public
String
getSearchValue
()
{
...
...
@@ -114,17 +120,36 @@ public class BaseEntity implements Serializable
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
()
{
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
;
}
...
...
ruoyi/src/main/java/com/ruoyi/project/system/controller/SysConfigController.java
View file @
fee8a595
...
...
@@ -70,7 +70,6 @@ public class SysConfigController extends BaseController
/**
* 根据参数键名查询参数值
*/
@PreAuthorize
(
"@ss.hasPermi('system:config:query')"
)
@GetMapping
(
value
=
"/configKey/{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