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
Eladmin
Commits
c4fc3da1
Commit
c4fc3da1
authored
Jun 29, 2019
by
zhengjie
Browse files
代码生成器优化,新增多数据字典支持,用户修改密码优化
parent
375cdf4d
Changes
32
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/resources/template/generator/admin/Service.ftl
View file @
c4fc3da1
...
...
@@ -3,16 +3,16 @@ package ${package}.service;
import
$
{
package
}
.domain.$
{
className
}
;
import
$
{
package
}
.service.dto.$
{
className
}
DTO;
import
$
{
package
}
.service.dto.$
{
className
}
QueryCriteria;
import
org.springframework.cache.annotation.CacheConfig;
import
org.springframework.cache.annotation.CacheEvict;
import
org.springframework.cache.annotation.Cacheable;
//
import
org.springframework.cache.annotation.CacheConfig;
//
import
org.springframework.cache.annotation.CacheEvict;
//
import
org.springframework.cache.annotation.Cacheable;
import
org.springframework.data.domain.Pageable;
/**
*
@author $
{
author
}
*
@date $
{
date
}
*/
@
CacheConfig
(
cacheNames
=
"$
{
changeClassName
}
")
//
@
CacheConfig
(
cacheNames
=
"$
{
changeClassName
}
")
public
interface $
{
className
}
Service
{
/
**
...
...
@@ -21,7 +21,7 @@ public interface ${className}Service {
*
@
param
pageable
*
@
return
*
/
@
C
acheable
(
keyGenerator
=
"keyGenerator"
)
//
@
C
acheable
(
keyGenerator
=
"keyGenerator"
)
O
bject
queryAll
(
$
{
className
}
Q
ueryCriteria
criteria
,
P
ageable
pageable
)
;
/
**
...
...
@@ -29,7 +29,7 @@ public interface ${className}Service {
*
@
param
criteria
*
@
return
*
/
@
C
acheable
(
keyGenerator
=
"keyGenerator"
)
//
@
C
acheable
(
keyGenerator
=
"keyGenerator"
)
public
O
bject
queryAll
(
$
{
className
}
Q
ueryCriteria
criteria
)
;
/
**
...
...
@@ -37,7 +37,7 @@ public interface ${className}Service {
*
@
param
$
{
pkChangeColName
}
*
@
return
*
/
@
C
acheable
(
key
=
"#p0"
)
//
@
C
acheable
(
key
=
"#p0"
)
$
{
className
}
DTO
findById
(
$
{
pkColumnType
}
$
{
pkChangeColName
})
;
/
**
...
...
@@ -45,20 +45,20 @@ public interface ${className}Service {
*
@
param
resources
*
@
return
*
/
@
C
acheEvict
(
allEntries
=
true
)
//
@
C
acheEvict
(
allEntries
=
true
)
$
{
className
}
DTO
create
(
$
{
className
}
resources
)
;
/
**
*
update
*
@
param
resources
*
/
@
C
acheEvict
(
allEntries
=
true
)
//
@
C
acheEvict
(
allEntries
=
true
)
void
update
(
$
{
className
}
resources
)
;
/
**
*
delete
*
@
param
$
{
pkChangeColName
}
*
/
@
C
acheEvict
(
allEntries
=
true
)
//
@
C
acheEvict
(
allEntries
=
true
)
void
delete
(
$
{
pkColumnType
}
$
{
pkChangeColName
})
;
}
\ No newline at end of file
eladmin-system/src/main/resources/template/generator/admin/ServiceImpl.ftl
View file @
c4fc3da1
...
...
@@ -92,7 +92,6 @@ public class ${className}ServiceImpl implements ${className}Service {
public
void
update
(
$
{
className
}
resources
)
{
O
ptional
<$
{
className
}
>
optional
$
{
className
}
=
$
{
changeClassName
}
R
epository
.findById
(
resources
.get
$
{
pkCapitalColName
}())
;
V
alidationUtil
.isNull
(
optional
$
{
className
},
"${className}"
,
"id"
,
resources
.get
$
{
pkCapitalColName
}())
;
$
{
className
}
$
{
changeClassName
}
=
optional
$
{
className
}
.get
()
;
<#
if
columns
??>
<#
list
columns
as
column
>
...
...
@@ -107,9 +106,8 @@ public class ${className}ServiceImpl implements ${className}Service {
</#
if
>
</#
list
>
</#
if
>
//
此处需自己修改
resources
.set
$
{
pkCapitalColName
}(
$
{
changeClassName
}
.get
$
{
pkCapitalColName
}())
;
$
{
changeClassName
}
R
epository
.save
(
resources
)
;
$
{
changeClassName
}
.copy
(
resources
)
;
$
{
changeClassName
}
R
epository
.save
(
$
{
changeClassName
})
;
}
@
O
verride
...
...
eladmin-system/src/main/resources/template/generator/front/eForm.ftl
View file @
c4fc3da1
...
...
@@ -25,10 +25,6 @@ export default {
isAdd
:
{
type
:
B
oolean
,
required
:
true
},
sup_this
:
{
type
:
O
bject
,
default
:
null
}
},
data
()
{
...
...
@@ -71,7 +67,7 @@ export default {
duration
:
2500
})
this
.loading
=
false
this
.
$parent
.
$parent
.
init
()
this
.
$parent
.init
()
})
.catch
(
err
=>
{
this
.loading
=
false
console
.log
(
err
.response.data.message
)
...
...
@@ -86,7 +82,7 @@ export default {
duration
:
2500
})
this
.loading
=
false
this
.
sup_this
.init
()
this
.
$parent
.init
()
})
.catch
(
err
=>
{
this
.loading
=
false
console
.log
(
err
.response.data.message
)
...
...
eladmin-system/src/main/resources/template/generator/front/edit.ftl
deleted
100644 → 0
View file @
375cdf4d
<
template
>
<div>
<el-button size="mini" type="primary" icon="el-icon-edit" @click="to"/>
<eForm ref="form" :sup_this="sup_this" :is-add="false"/>
</div>
</
template
>
<
script
>
import
eForm from './form'
export
default
{
components
:
{
eForm
},
props
:
{
data
:
{
type
:
O
bject
,
required
:
true
},
sup_this
:
{
type
:
O
bject
,
required
:
true
}
},
methods
:
{
to
()
{
const
_
this
=
this
.
$refs
.form
_
this
.form
=
{
<#
if
columns
??>
<#
list
columns
as
column
>
$
{
column
.changeColumnName
}:
this
.data
.$
{
column
.changeColumnName
}
<#
if
column_has_next
>
,
</#
if
>
</#
list
>
</#
if
>
}
_
this
.dialog
=
true
}
}
}
</
script
>
<
style
scoped>
div
{
display
:
inline-block
;
margin-right
:
3
px
;
}
</
style
>
eladmin-system/src/main/resources/template/generator/front/header.ftl
deleted
100644 → 0
View file @
375cdf4d
<
template
>
<div class="head-container">
<#
if
hasQuery>
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
</#
if
>
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="$refs.form.dialog = true">新增</el-button>
<eForm ref="form" :is-add="true"/>
</div>
</div>
</
template
>
<
script
>
import
eForm from './form'
export
default
{
components
:
{
eForm
},
props
:
{
query
:
{
type
:
O
bject
,
required
:
true
}
},
data
()
{
return
{
<#
if
hasQuery
>
queryTypeOptions
:
[
<#
if
queryColumns
??>
<#
list
queryColumns
as
column
>
{
key
:
'$
{
column
.changeColumnName
}
'
,
display_name
:
'<#
if
column
.columnComment
!=
''>$
{
column
.columnComment
}
<#
else
>$
{
column
.changeColumnName
}
</#
if
>'
}
<#
if
column_has_next
>
,
</#
if
>
</#
list
>
</#
if
>
]
</#
if
>
}
},
methods
:
{
<#
if
hasQuery
>
toQuery
()
{
this
.
$parent
.page
=
0
this
.
$parent
.init
()
}
</#
if
>
}
}
</
script
>
eladmin-system/src/main/resources/template/generator/front/index.ftl
View file @
c4fc3da1
<#-
-noinspection
ALL-->
<
template
>
<div class="app-container">
<eHeader :query="query"/>
<!--工具栏-->
<div class="head-container">
<#if hasQuery>
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
</#if>
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add">新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<#if columns??>
...
...
@@ -21,7 +43,7 @@
</#if>
<el-table-column v-if="checkPermission(['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_EDIT','$
{
upperCaseClassName
}
_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<e
dit
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_EDIT']"
:data="scope.row" :sup_this="sup_this
"/>
<e
l-button
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_EDIT']"
size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)
"/>
<el-popover
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_DELETE']"
:ref="scope.row.$
{
pkChangeColName
}
"
...
...
@@ -41,6 +63,7 @@
<el-pagination
:total="total"
style="margin-top: 8px;"
:current-page="page + 1"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"/>
...
...
@@ -54,14 +77,22 @@ import { del } from '@/api/${changeClassName}'
<#
if
hasTimestamp>
import
{
parseTime
}
from '@/utils/index'
</#
if
>
import
eHeader from './module/header'
import
edit from './module/edit'
import
eForm from './form'
export
default
{
components
:
{
e
Header
,
edit
},
components
:
{
e
Form
},
mixins
:
[
initData
]
,
data
()
{
return
{
delLoading
:
false
,
sup_this
:
this
delLoading
:
false
,
<#
if
hasQuery
>
queryTypeOptions
:
[
<#
if
queryColumns
??>
<#
list
queryColumns
as
column
>
{
key
:
'$
{
column
.changeColumnName
}
'
,
display_name
:
'<#
if
column
.columnComment
!=
''>$
{
column
.columnComment
}
<#
else
>$
{
column
.changeColumnName
}
</#
if
>'
}
<#
if
column_has_next
>
,
</#
if
>
</#
list
>
</#
if
>
]
</#
if
>
}
},
created
()
{
...
...
@@ -91,6 +122,7 @@ export default {
del
(
$
{
pkChangeColName
})
.then
(
res
=>
{
this
.delLoading
=
false
this
.
$refs
[$
{
pkChangeColName
}
]
.doClose
()
this
.dleChangePage
()
this
.init
()
this
.
$notify
({
title
:
'删除成功'
,
...
...
@@ -102,6 +134,22 @@ export default {
this
.
$refs
[$
{
pkChangeColName
}
]
.doClose
()
console
.log
(
err
.response.data.message
)
})
},
add
()
{
this
.isAdd
=
true
this
.
$refs
.form.dialog
=
true
},
edit
(
data
)
{
this
.isAdd
=
false
const
_
this
=
this
.
$refs
.form
_
this
.form
=
{
<#
if
columns
??>
<#
list
columns
as
column
>
$
{
column
.changeColumnName
}:
data
.$
{
column
.changeColumnName
}
<#
if
column_has_next
>
,
</#
if
>
</#
list
>
</#
if
>
}
_
this
.dialog
=
true
}
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java
View file @
c4fc3da1
...
...
@@ -34,8 +34,8 @@ public class AliPayController {
private
AlipayService
alipayService
;
@GetMapping
(
value
=
"/aliPay"
)
public
ResponseEntity
get
(){
return
new
ResponseEntity
(
alipayService
.
find
(),
HttpStatus
.
OK
);
public
ResponseEntity
<
AlipayConfig
>
get
(){
return
new
ResponseEntity
<>
(
alipayService
.
find
(),
HttpStatus
.
OK
);
}
@Log
(
"配置支付宝"
)
...
...
@@ -49,8 +49,7 @@ public class AliPayController {
@Log
(
"支付宝PC网页支付"
)
@ApiOperation
(
value
=
"PC网页支付"
)
@PostMapping
(
value
=
"/aliPay/toPayAsPC"
)
public
ResponseEntity
toPayAsPC
(
@Validated@RequestBody
TradeVo
trade
)
throws
Exception
{
log
.
warn
(
"REST request to toPayAsPC Trade : {}"
+
trade
);
public
ResponseEntity
<
String
>
toPayAsPC
(
@Validated@RequestBody
TradeVo
trade
)
throws
Exception
{
AlipayConfig
alipay
=
alipayService
.
find
();
trade
.
setOutTradeNo
(
alipayUtils
.
getOrderCode
());
String
payUrl
=
alipayService
.
toPayAsPC
(
alipay
,
trade
);
...
...
@@ -60,8 +59,7 @@ public class AliPayController {
@Log
(
"支付宝手机网页支付"
)
@ApiOperation
(
value
=
"手机网页支付"
)
@PostMapping
(
value
=
"/aliPay/toPayAsWeb"
)
public
ResponseEntity
toPayAsWeb
(
@Validated
@RequestBody
TradeVo
trade
)
throws
Exception
{
log
.
warn
(
"REST request to toPayAsWeb Trade : {}"
+
trade
);
public
ResponseEntity
<
String
>
toPayAsWeb
(
@Validated
@RequestBody
TradeVo
trade
)
throws
Exception
{
AlipayConfig
alipay
=
alipayService
.
find
();
trade
.
setOutTradeNo
(
alipayUtils
.
getOrderCode
());
String
payUrl
=
alipayService
.
toPayAsWeb
(
alipay
,
trade
);
...
...
@@ -71,7 +69,7 @@ public class AliPayController {
@ApiIgnore
@GetMapping
(
"/aliPay/return"
)
@ApiOperation
(
value
=
"支付之后跳转的链接"
)
public
ResponseEntity
returnPage
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
ResponseEntity
<
String
>
returnPage
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
AlipayConfig
alipay
=
alipayService
.
find
();
response
.
setContentType
(
"text/html;charset="
+
alipay
.
getCharset
());
//内容验签,防止黑客篡改参数
...
...
@@ -85,12 +83,12 @@ public class AliPayController {
/**
* 根据业务需要返回数据,这里统一返回OK
*/
return
new
ResponseEntity
(
"payment successful"
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
"payment successful"
,
HttpStatus
.
OK
);
}
else
{
/**
* 根据业务需要返回数据
*/
return
new
ResponseEntity
(
HttpStatus
.
BAD_REQUEST
);
return
new
ResponseEntity
<>
(
HttpStatus
.
BAD_REQUEST
);
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/PictureController.java
View file @
c4fc3da1
...
...
@@ -45,7 +45,7 @@ public class PictureController {
public
ResponseEntity
upload
(
@RequestParam
MultipartFile
file
){
String
userName
=
SecurityUtils
.
getUsername
();
Picture
picture
=
pictureService
.
upload
(
file
,
userName
);
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
(
3
);
map
.
put
(
"errno"
,
0
);
map
.
put
(
"id"
,
picture
.
getId
());
map
.
put
(
"data"
,
new
String
[]{
picture
.
getUrl
()});
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java
View file @
c4fc3da1
...
...
@@ -56,7 +56,7 @@ public class QiniuController {
@PostMapping
(
value
=
"/qiNiuContent"
)
public
ResponseEntity
upload
(
@RequestParam
MultipartFile
file
){
QiniuContent
qiniuContent
=
qiNiuService
.
upload
(
file
,
qiNiuService
.
find
());
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
(
3
);
map
.
put
(
"id"
,
qiniuContent
.
getId
());
map
.
put
(
"errno"
,
0
);
map
.
put
(
"data"
,
new
String
[]{
qiniuContent
.
getUrl
()});
...
...
@@ -84,7 +84,7 @@ public class QiniuController {
@Log
(
"下载文件"
)
@GetMapping
(
value
=
"/qiNiuContent/download/{id}"
)
public
ResponseEntity
download
(
@PathVariable
Long
id
){
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
(
1
);
map
.
put
(
"url"
,
qiNiuService
.
download
(
qiNiuService
.
findByContentId
(
id
),
qiNiuService
.
find
()));
return
new
ResponseEntity
(
map
,
HttpStatus
.
OK
);
}
...
...
eladmin-tools/src/main/java/me/zhengjie/service/QiNiuService.java
View file @
c4fc3da1
...
...
@@ -45,6 +45,7 @@ public interface QiNiuService {
* 上传文件
* @param file
* @param qiniuConfig
* @return
*/
@CacheEvict
(
allEntries
=
true
)
QiniuContent
upload
(
MultipartFile
file
,
QiniuConfig
qiniuConfig
);
...
...
@@ -84,7 +85,7 @@ public interface QiNiuService {
/**
* 删除文件
* @param ids
* @
return
* @
param config
*/
@CacheEvict
(
allEntries
=
true
)
void
deleteAll
(
Long
[]
ids
,
QiniuConfig
config
);
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java
View file @
c4fc3da1
...
...
@@ -83,7 +83,8 @@ public class EmailServiceImpl implements EmailService {
.
setTitle
(
emailVo
.
getSubject
())
.
setContent
(
content
)
.
setHtml
(
true
)
.
setUseGlobalSession
(
false
)
//关闭session
//关闭session
.
setUseGlobalSession
(
false
)
.
send
();
}
catch
(
Exception
e
){
throw
new
BadRequestException
(
e
.
getMessage
());
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/PictureServiceImpl.java
View file @
c4fc3da1
...
...
@@ -49,7 +49,7 @@ public class PictureServiceImpl implements PictureService {
public
Picture
upload
(
MultipartFile
multipartFile
,
String
username
)
{
File
file
=
FileUtil
.
toFile
(
multipartFile
);
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<>(
1
);
paramMap
.
put
(
"smfile"
,
file
);
String
result
=
HttpUtil
.
post
(
ElAdminConstant
.
Url
.
SM_MS_URL
,
paramMap
);
...
...
Prev
1
2
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