Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
roo-cloud
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
万敏
roo-cloud
Commits
db97484d
Commit
db97484d
authored
Aug 02, 2021
by
wanmin@bu2.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
banner管理
parent
340376f8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
302 additions
and
0 deletions
+302
-0
roo-admin/roo-admin-server/src/main/java/com/roo/controller/BannerController.java
...er/src/main/java/com/roo/controller/BannerController.java
+116
-0
roo-admin/roo-admin-server/src/main/java/com/roo/dao/BannerDao.java
...roo-admin-server/src/main/java/com/roo/dao/BannerDao.java
+16
-0
roo-admin/roo-admin-server/src/main/java/com/roo/entity/BannerEntity.java
...min-server/src/main/java/com/roo/entity/BannerEntity.java
+55
-0
roo-admin/roo-admin-server/src/main/java/com/roo/excel/BannerExcel.java
...admin-server/src/main/java/com/roo/excel/BannerExcel.java
+37
-0
roo-admin/roo-admin-server/src/main/java/com/roo/service/BannerService.java
...n-server/src/main/java/com/roo/service/BannerService.java
+15
-0
roo-admin/roo-admin-server/src/main/java/com/roo/service/impl/BannerServiceImpl.java
...src/main/java/com/roo/service/impl/BannerServiceImpl.java
+32
-0
roo-admin/roo-admin-server/src/main/resources/mapper/BannerDao.xml
.../roo-admin-server/src/main/resources/mapper/BannerDao.xml
+17
-0
roo-admin/roo-admin-server/src/test/java/com/roo/service/Test.java
.../roo-admin-server/src/test/java/com/roo/service/Test.java
+14
-0
No files found.
roo-admin/roo-admin-server/src/main/java/com/roo/controller/BannerController.java
0 → 100644
View file @
db97484d
package
com.roo.controller
;
import
com.roo.commons.log.annotation.LogOperation
;
import
com.roo.commons.tools.constant.Constant
;
import
com.roo.commons.tools.page.PageData
;
import
com.roo.commons.tools.utils.Result
;
import
com.roo.commons.tools.utils.ExcelUtils
;
import
com.roo.commons.tools.validator.AssertUtils
;
import
com.roo.commons.tools.validator.ValidatorUtils
;
import
com.roo.commons.tools.validator.group.AddGroup
;
import
com.roo.commons.tools.validator.group.DefaultGroup
;
import
com.roo.commons.tools.validator.group.UpdateGroup
;
import
com.roo.dto.BannerDTO
;
import
com.roo.excel.BannerExcel
;
import
com.roo.service.BannerService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Map
;
/**
* banner图
*
* @author momin 460363410@qq.com
* @since 1.0 2021-08-02
*/
@RestController
@RequestMapping
(
"banner"
)
@Api
(
tags
=
"banner图"
)
public
class
BannerController
{
@Autowired
private
BannerService
bannerService
;
@GetMapping
(
"page"
)
@ApiOperation
(
"分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER_FIELD
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"String"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
@PreAuthorize
(
"hasAuthority('banner:banner:page')"
)
public
Result
<
PageData
<
BannerDTO
>>
page
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
BannerDTO
>
page
=
bannerService
.
page
(
params
);
return
new
Result
<
PageData
<
BannerDTO
>>().
ok
(
page
);
}
@GetMapping
(
"{id}"
)
@ApiOperation
(
"信息"
)
@PreAuthorize
(
"hasAuthority('banner:banner:info')"
)
public
Result
<
BannerDTO
>
get
(
@PathVariable
(
"id"
)
Long
id
){
BannerDTO
data
=
bannerService
.
get
(
id
);
return
new
Result
<
BannerDTO
>().
ok
(
data
);
}
@PostMapping
@ApiOperation
(
"保存"
)
@LogOperation
(
"保存"
)
@PreAuthorize
(
"hasAuthority('banner:banner:save')"
)
public
Result
save
(
@RequestBody
BannerDTO
dto
){
//效验数据
ValidatorUtils
.
validateEntity
(
dto
,
AddGroup
.
class
,
DefaultGroup
.
class
);
bannerService
.
save
(
dto
);
return
new
Result
();
}
@PutMapping
@ApiOperation
(
"修改"
)
@LogOperation
(
"修改"
)
@PreAuthorize
(
"hasAuthority('banner:banner:update')"
)
public
Result
update
(
@RequestBody
BannerDTO
dto
){
//效验数据
ValidatorUtils
.
validateEntity
(
dto
,
UpdateGroup
.
class
,
DefaultGroup
.
class
);
bannerService
.
update
(
dto
);
return
new
Result
();
}
@DeleteMapping
@ApiOperation
(
"删除"
)
@LogOperation
(
"删除"
)
@PreAuthorize
(
"hasAuthority('banner:banner:delete')"
)
public
Result
delete
(
@RequestBody
Long
[]
ids
){
//效验数据
AssertUtils
.
isArrayEmpty
(
ids
,
"id"
);
bannerService
.
delete
(
ids
);
return
new
Result
();
}
@GetMapping
(
"export"
)
@ApiOperation
(
"导出"
)
@LogOperation
(
"导出"
)
@PreAuthorize
(
"hasAuthority('banner:banner:export')"
)
public
void
export
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
,
HttpServletResponse
response
)
throws
Exception
{
List
<
BannerDTO
>
list
=
bannerService
.
list
(
params
);
ExcelUtils
.
exportExcelToTarget
(
response
,
null
,
"banner图"
,
list
,
BannerExcel
.
class
);
}
}
\ No newline at end of file
roo-admin/roo-admin-server/src/main/java/com/roo/dao/BannerDao.java
0 → 100644
View file @
db97484d
package
com.roo.dao
;
import
com.roo.commons.mybatis.dao.BaseDao
;
import
com.roo.entity.BannerEntity
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* banner图
*
* @author momin 460363410@qq.com
* @since 1.0 2021-08-02
*/
@Mapper
public
interface
BannerDao
extends
BaseDao
<
BannerEntity
>
{
}
\ No newline at end of file
roo-admin/roo-admin-server/src/main/java/com/roo/entity/BannerEntity.java
0 → 100644
View file @
db97484d
package
com.roo.entity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
com.baomidou.mybatisplus.annotation.*
;
import
java.util.Date
;
/**
* banner图
*
* @author momin 460363410@qq.com
* @since 1.0 2021-08-02
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@TableName
(
"roo_wallet.t_banner"
)
public
class
BannerEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键
*/
@TableId
private
Long
id
;
/**
* 图片地址
*/
private
String
image
;
/**
* 超链接地址
*/
private
String
href
;
/**
* 类型:1=dapp
*/
private
Integer
type
;
/**
* 排序,正序
*/
private
Integer
sort
;
/**
* 是否启用
*/
private
Boolean
isEnabled
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
createDate
;
/**
* 更新时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateDate
;
}
roo-admin/roo-admin-server/src/main/java/com/roo/excel/BannerExcel.java
0 → 100644
View file @
db97484d
package
com.roo.excel
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.ContentRowHeight
;
import
com.alibaba.excel.annotation.write.style.HeadRowHeight
;
import
lombok.Data
;
import
java.util.Date
;
/**
* banner图
*
* @author momin 460363410@qq.com
* @since 1.0 2021-08-02
*/
@Data
@ContentRowHeight
(
20
)
@HeadRowHeight
(
20
)
@ColumnWidth
(
25
)
public
class
BannerExcel
{
@ExcelProperty
(
value
=
"主键"
,
index
=
0
)
private
Long
id
;
@ExcelProperty
(
value
=
"图片地址"
,
index
=
1
)
private
String
image
;
@ExcelProperty
(
value
=
"超链接地址"
,
index
=
2
)
private
String
href
;
@ExcelProperty
(
value
=
"类型:1=dapp"
,
index
=
3
)
private
Integer
type
;
@ExcelProperty
(
value
=
"排序,正序"
,
index
=
4
)
private
Integer
sort
;
@ExcelProperty
(
value
=
"是否启用"
,
index
=
5
)
private
Boolean
isEnabled
;
@ExcelProperty
(
value
=
"创建时间"
,
index
=
6
)
private
Date
createDate
;
@ExcelProperty
(
value
=
"更新时间"
,
index
=
7
)
private
Date
updateDate
;
}
\ No newline at end of file
roo-admin/roo-admin-server/src/main/java/com/roo/service/BannerService.java
0 → 100644
View file @
db97484d
package
com.roo.service
;
import
com.roo.commons.mybatis.service.CrudService
;
import
com.roo.dto.BannerDTO
;
import
com.roo.entity.BannerEntity
;
/**
* banner图
*
* @author momin 460363410@qq.com
* @since 1.0 2021-08-02
*/
public
interface
BannerService
extends
CrudService
<
BannerEntity
,
BannerDTO
>
{
}
\ No newline at end of file
roo-admin/roo-admin-server/src/main/java/com/roo/service/impl/BannerServiceImpl.java
0 → 100644
View file @
db97484d
package
com.roo.service.impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.roo.commons.mybatis.service.impl.CrudServiceImpl
;
import
com.roo.dao.BannerDao
;
import
com.roo.dto.BannerDTO
;
import
com.roo.entity.BannerEntity
;
import
com.roo.service.BannerService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.Map
;
/**
* banner图
*
* @author momin 460363410@qq.com
* @since 1.0 2021-08-02
*/
@Service
public
class
BannerServiceImpl
extends
CrudServiceImpl
<
BannerDao
,
BannerEntity
,
BannerDTO
>
implements
BannerService
{
@Override
public
QueryWrapper
<
BannerEntity
>
getWrapper
(
Map
<
String
,
Object
>
params
){
QueryWrapper
<
BannerEntity
>
wrapper
=
new
QueryWrapper
<>();
return
wrapper
;
}
}
\ No newline at end of file
roo-admin/roo-admin-server/src/main/resources/mapper/BannerDao.xml
0 → 100644
View file @
db97484d
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.roo.dao.BannerDao"
>
<resultMap
type=
"com.roo.entity.BannerEntity"
id=
"bannerMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"image"
column=
"image"
/>
<result
property=
"href"
column=
"href"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"sort"
column=
"sort"
/>
<result
property=
"isEnabled"
column=
"is_enabled"
/>
<result
property=
"createDate"
column=
"create_date"
/>
<result
property=
"updateDate"
column=
"update_date"
/>
</resultMap>
</mapper>
\ No newline at end of file
roo-admin/roo-admin-server/src/test/java/com/roo/service/Test.java
0 → 100644
View file @
db97484d
package
com.roo.service
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
{
PasswordEncoder
passwordEncoder
=
new
BCryptPasswordEncoder
();
// String encode = passwordEncoder.encode("roo.top");
boolean
matches
=
passwordEncoder
.
matches
(
"renrenio"
,
"$2a$10$aiWOK7GmRzyLyRihSF0cMedcbsEo0t11/y8f.tnBkF2hCeSd0Bq.i"
);
System
.
out
.
println
(
matches
);
// System.out.println(encode);
}
}
Write
Preview
Markdown
is supported
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