前端:管理后台增加 Banner CRUD 功能
This commit is contained in:
@@ -14,7 +14,7 @@ public class BannerVO {
|
||||
private String title;
|
||||
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
|
||||
private String url;
|
||||
@ApiModelProperty(value = "突脸链接", required = true, example = "http://www.iocoder.cn/01.jpg")
|
||||
@ApiModelProperty(value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg")
|
||||
private String picUrl;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "10")
|
||||
private Integer sort;
|
||||
|
||||
@@ -12,13 +12,15 @@ import javax.validation.constraints.NotNull;
|
||||
public class BannerAddDTO {
|
||||
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 6, max = 32, message = "标题长度为 6-32 位")
|
||||
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
||||
private String title;
|
||||
@NotEmpty(message = "跳转链接不能为空")
|
||||
@URL(message = "跳转链接格式不正确")
|
||||
@Length(max = 255, message = "跳转链接最大长度为 255 位")
|
||||
private String url;
|
||||
@NotEmpty(message = "图片链接不能为空")
|
||||
@URL(message = "图片链接格式不正确")
|
||||
@Length(max = 255, message = "图片链接最大长度为 255 位")
|
||||
private String picUrl;
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@@ -14,12 +14,15 @@ public class BannerUpdateDTO {
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 6, max = 32, message = "标题长度为 6-32 位")
|
||||
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
||||
private String title;
|
||||
@NotEmpty(message = "跳转链接不能为空")
|
||||
@URL(message = "跳转链接格式不正确")
|
||||
@Length(max = 255, message = "跳转链接最大长度为 255 位")
|
||||
private String url;
|
||||
@NotEmpty(message = "图片链接不能为空")
|
||||
@URL(message = "图片链接格式不正确")
|
||||
@Length(max = 255, message = "图片链接最大长度为 255 位")
|
||||
private String picUrl;
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BannerServiceImpl implements BannerService {
|
||||
@Override
|
||||
public CommonResult<BannerBO> addBanner(Integer adminId, BannerAddDTO bannerAddDTO) {
|
||||
// 保存到数据库
|
||||
BannerDO banner = BannerConvert.INSTANCE.convert(bannerAddDTO);
|
||||
BannerDO banner = BannerConvert.INSTANCE.convert(bannerAddDTO).setStatus(CommonStatusEnum.ENABLE.getValue());
|
||||
banner.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()).setCreateTime(new Date());
|
||||
bannerMapper.insert(banner);
|
||||
// 返回成功
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<if test="url != null">
|
||||
url = #{url},
|
||||
</if>
|
||||
<if test="pic_url != null">
|
||||
<if test="picUrl != null">
|
||||
pic_url = #{picUrl} ,
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
@@ -85,8 +85,8 @@
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="VALUES != null">
|
||||
VALUES = #{VALUES},
|
||||
<if test="memo != null">
|
||||
memo = #{memo},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted}
|
||||
|
||||
Reference in New Issue
Block a user