后端:增加 Banner 增删改查接口
This commit is contained in:
27
promotion/promotion-service-api/pom.xml
Normal file
27
promotion/promotion-service-api/pom.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>promotion</artifactId>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>promotion-service-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>common-framework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.mall.promotion.api;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerPageBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.BannerAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.BannerPageDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO;
|
||||
|
||||
public interface BannerService {
|
||||
|
||||
CommonResult<BannerPageBO> getBannerPage(BannerPageDTO bannerPageDTO);
|
||||
|
||||
CommonResult<BannerBO> addBanner(Integer adminId, BannerAddDTO bannerAddDTO);
|
||||
|
||||
CommonResult<Boolean> updateBanner(Integer adminId, BannerUpdateDTO bannerUpdateDTO);
|
||||
|
||||
CommonResult<Boolean> updateBannerStatus(Integer adminId, Integer bannerId, Integer status);
|
||||
|
||||
CommonResult<Boolean> deleteBanner(Integer adminId, Integer bannerId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package cn.iocoder.mall.promotion.api.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Banner BO
|
||||
*/
|
||||
public class BannerBO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 跳转链接
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 图片链接
|
||||
*/
|
||||
private String picUrl;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public BannerBO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public BannerBO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public BannerBO setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public BannerBO setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public BannerBO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public BannerBO setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public BannerBO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public BannerBO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.mall.promotion.api.bo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BannerPageBO {
|
||||
|
||||
/**
|
||||
* Banner 数组
|
||||
*/
|
||||
private List<BannerBO> list;
|
||||
/**
|
||||
* 总量
|
||||
*/
|
||||
private Integer total;
|
||||
|
||||
public List<BannerBO> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public BannerPageBO setList(List<BannerBO> list) {
|
||||
this.list = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public BannerPageBO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.mall.promotion.api.constant;
|
||||
|
||||
/**
|
||||
* 错误码枚举类
|
||||
*
|
||||
* 营销系统,使用 1-006-000-000 段
|
||||
*/
|
||||
public enum PromotionErrorCodeEnum {
|
||||
|
||||
// ========== Banner 模块 ==========
|
||||
BANNER_NOT_EXISTS(1002002000, "账号不存在"),
|
||||
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
PromotionErrorCodeEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.iocoder.mall.promotion.api.dto;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Banner 添加 DTO
|
||||
*/
|
||||
public class BannerAddDTO {
|
||||
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 6, max = 32, message = "标题长度为 6-32 位")
|
||||
private String title;
|
||||
@NotEmpty(message = "跳转链接不能为空")
|
||||
@URL(message = "跳转链接格式不正确")
|
||||
private String url;
|
||||
@NotEmpty(message = "图片链接不能为空")
|
||||
@URL(message = "图片链接格式不正确")
|
||||
private String picUrl;
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
@Length(max = 255, message = "备注最大长度为 255 位")
|
||||
private String memo;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public BannerAddDTO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public BannerAddDTO setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public BannerAddDTO setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public BannerAddDTO setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public BannerAddDTO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.mall.promotion.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public class BannerPageDTO {
|
||||
|
||||
/**
|
||||
* 标题,模糊匹配
|
||||
*/
|
||||
private String title;
|
||||
|
||||
@NotNull(message = "页码不能为空")
|
||||
private Integer pageNo;
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
public Integer getPageNo() {
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public BannerPageDTO setPageNo(Integer pageNo) {
|
||||
this.pageNo = pageNo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public BannerPageDTO setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public BannerPageDTO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.iocoder.mall.promotion.api.dto;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Banner 更新 DTO
|
||||
*/
|
||||
public class BannerUpdateDTO {
|
||||
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 6, max = 32, message = "标题长度为 6-32 位")
|
||||
private String title;
|
||||
@NotEmpty(message = "跳转链接不能为空")
|
||||
@URL(message = "跳转链接格式不正确")
|
||||
private String url;
|
||||
@URL(message = "图片链接格式不正确")
|
||||
private String picUrl;
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
@Length(max = 255, message = "备注最大长度为 255 位")
|
||||
private String memo;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public BannerUpdateDTO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public BannerUpdateDTO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public BannerUpdateDTO setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public BannerUpdateDTO setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public BannerUpdateDTO setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public BannerUpdateDTO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user