- demo 项目,增加提交订单接口

This commit is contained in:
YunaiV
2019-09-20 16:53:30 +08:00
parent 73af7c3932
commit 683b9a7a19
29 changed files with 438 additions and 9 deletions

View File

@@ -1,7 +1,12 @@
package cn.iocoder.mall.demo.business.api;
import cn.iocoder.mall.demo.business.bo.order.DemoOrderAddBO;
import cn.iocoder.mall.demo.business.bo.order.DemoOrderCancelBO;
public interface DemoOrderService {
int add(DemoOrderAddBO addBO);
int cancel(DemoOrderCancelBO cancelBO);
}

View File

@@ -1,9 +1,20 @@
package cn.iocoder.mall.demo.business.api;
import cn.iocoder.mall.demo.business.bo.DemoProductBO;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.demo.business.bo.product.*;
public interface DemoProductService {
DemoProductBO get(Integer id);
PageResult<DemoProductBO> page(DemoProductPageBO page);
int add(DemoProductAddBO product);
int update(DemoProductUpdateBO product);
// void updateQuantityIncrease();
void updateQuantityReduce(DemoProductQuantityReduceBO reduceBO);
}

View File

@@ -1,4 +0,0 @@
package cn.iocoder.mall.demo.business.bo;
public class DemoProductBO {
}

View File

@@ -0,0 +1,21 @@
package cn.iocoder.mall.demo.business.bo.order;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* Demo 订单添加 BO
*/
@Data
@Accessors(chain = true)
public class DemoOrderAddBO {
@NotNull(message = "用户编号不能为空")
private Integer userId;
@NotNull(message = "用户编号不能为空")
private Integer productId;
}

View File

@@ -0,0 +1,4 @@
package cn.iocoder.mall.demo.business.bo.order;
public class DemoOrderCancelBO {
}

View File

@@ -0,0 +1,27 @@
package cn.iocoder.mall.demo.business.bo.product;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Demo 商品添加 BO
*/
@Data
@Accessors(chain = true)
public class DemoProductAddBO {
/**
* 名字
*/
private String name;
/**
* 价格
*/
private Integer price;
/**
* 库存数量
*/
private Integer quantity;
}

View File

@@ -0,0 +1,32 @@
package cn.iocoder.mall.demo.business.bo.product;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Demo 商品 BO
*/
@Data
@Accessors(chain = true)
public class DemoProductBO {
/**
* 编号
*/
private Integer id;
/**
* 名字
*/
private String name;
/**
* 价格
*/
private Integer price;
/**
* 库存数量
*/
private Integer quantity;
}

View File

@@ -0,0 +1,13 @@
package cn.iocoder.mall.demo.business.bo.product;
import cn.iocoder.common.framework.vo.PageParam;
public class DemoProductPageBO extends PageParam {
/**
* 名字,模糊搜索
*/
private String name;
}

View File

@@ -0,0 +1,29 @@
package cn.iocoder.mall.demo.business.bo.product;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* Demo 商品库存减少 BO
*/
@Data
@Accessors(chain = true)
public class DemoProductQuantityReduceBO {
/**
* 商品编号
*/
@NotNull(message = "商品编号不能为空")
private Integer id;
/**
* 减少数量
*/
@NotNull(message = "减少数量不能为空")
@Min(value = 1, message = "减少数量最小为 1")
private Integer quantity;
}

View File

@@ -0,0 +1,32 @@
package cn.iocoder.mall.demo.business.bo.product;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Demo 商品更新 BO
*/
@Data
@Accessors(chain = true)
public class DemoProductUpdateBO {
/**
* 编号
*/
private Integer id;
/**
* 名字
*/
private String name;
/**
* 价格
*/
private Integer price;
/**
* 库存数量
*/
private Integer quantity;
}

View File

@@ -0,0 +1,38 @@
package cn.iocoder.mall.demo.business.constant;
/**
* 订单 - status
*
* @author Sin
* @time 2019-03-16 14:06
*/
public enum OrderStatusEnum {
WAITING_PAYMENT(1, "等待付款"),
WAIT_SHIPMENT(2, "等待发货"),
ALREADY_SHIPMENT(3, "已发货"),
COMPLETED(4, "已完成"),
CLOSED(5, "已关闭");
/**
* 状态值
*/
private Integer value;
/**
* 状态名
*/
private String name;
OrderStatusEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}