- 添加 DeletableDO
- 修改 DO extends
This commit is contained in:
parent
f4c7f65cb8
commit
cc223fa2b3
@ -1,13 +1,13 @@
|
||||
package cn.iocoder.mall.admin.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 管理员访问日志 DO
|
||||
*/
|
||||
public class AdminAccessLogDO extends BaseDO {
|
||||
public class AdminAccessLogDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.admin.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 管理员实体
|
||||
*/
|
||||
public class AdminDO extends BaseDO {
|
||||
public class AdminDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 账号状态 - 开启
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.admin.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* {@link AdminDO} 和 {@link RoleDO} 的关联表
|
||||
*/
|
||||
public class AdminRoleDO extends BaseDO {
|
||||
public class AdminRoleDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.admin.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 数据字典
|
||||
@ -11,7 +11,7 @@ import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
* value:1 男
|
||||
* value:2 女
|
||||
*/
|
||||
public class DataDictDO extends BaseDO {
|
||||
public class DataDictDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.iocoder.mall.admin.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 资源实体
|
||||
*/
|
||||
public class ResourceDO extends BaseDO {
|
||||
public class ResourceDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 资源类型 - 菜单
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.admin.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 角色实体
|
||||
*/
|
||||
public class RoleDO extends BaseDO {
|
||||
public class RoleDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 角色编号
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.admin.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* {@link RoleDO} 和 {@link ResourceDO} 的关联表
|
||||
*/
|
||||
public class RoleResourceDO extends BaseDO {
|
||||
public class RoleResourceDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.admin.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.admin.api.AdminService;
|
||||
@ -88,7 +88,8 @@ public class AdminServiceImpl implements AdminService {
|
||||
AdminDO admin = AdminConvert.INSTANCE.convert(adminAddDTO)
|
||||
.setPassword(encodePassword(adminAddDTO.getPassword())) // 加密密码
|
||||
.setStatus(AdminDO.STATUS_ENABLE);
|
||||
admin.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
admin.setCreateTime(new Date());
|
||||
admin.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
adminMapper.insert(admin);
|
||||
// TODO 插入操作日志
|
||||
// 返回成功
|
||||
@ -159,7 +160,7 @@ public class AdminServiceImpl implements AdminService {
|
||||
}
|
||||
// 标记删除 AdminDO
|
||||
AdminDO updateAdmin = new AdminDO().setId(updateAdminId);
|
||||
updateAdmin.setDeleted(BaseDO.DELETED_YES);
|
||||
updateAdmin.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
|
||||
adminMapper.update(updateAdmin);
|
||||
// 标记删除 AdminRole
|
||||
adminRoleMapper.updateToDeletedByAdminId(updateAdminId);
|
||||
@ -188,7 +189,8 @@ public class AdminServiceImpl implements AdminService {
|
||||
if (!roleIds.isEmpty()) {
|
||||
List<AdminRoleDO> adminRoleDOs = roleIds.stream().map(roleId -> {
|
||||
AdminRoleDO roleResource = new AdminRoleDO().setAdminId(updateAdminId).setRoleId(roleId);
|
||||
roleResource.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
roleResource.setCreateTime(new Date());
|
||||
roleResource.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
return roleResource;
|
||||
}).collect(Collectors.toList());
|
||||
adminRoleMapper.insertList(adminRoleDOs);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.admin.service;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.admin.api.DataDictService;
|
||||
@ -41,7 +41,8 @@ public class DataDictServiceImpl implements DataDictService {
|
||||
}
|
||||
// 保存到数据库
|
||||
DataDictDO dataDict = DataDictConvert.INSTANCE.convert(dataDictAddDTO);
|
||||
dataDict.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
dataDict.setCreateTime(new Date());
|
||||
dataDict.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
dataDictMapper.insert(dataDict);
|
||||
// TODO 插入操作日志
|
||||
// 返回成功
|
||||
@ -79,7 +80,7 @@ public class DataDictServiceImpl implements DataDictService {
|
||||
}
|
||||
// 更新到数据库
|
||||
DataDictDO updateDataDict = new DataDictDO().setId(dataDictId);
|
||||
updateDataDict.setDeleted(BaseDO.DELETED_YES);
|
||||
updateDataDict.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
|
||||
dataDictMapper.update(updateDataDict);
|
||||
// TODO 插入操作日志
|
||||
// 返回成功
|
||||
|
@ -1,7 +1,8 @@
|
||||
package cn.iocoder.mall.admin.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.admin.api.ResourceService;
|
||||
@ -75,7 +76,7 @@ public class ResourceServiceImpl implements ResourceService {
|
||||
resource.setHandler("/" + resource.getHandler());
|
||||
}
|
||||
resource.setCreateTime(new Date());
|
||||
resource.setDeleted(BaseDO.DELETED_NO);
|
||||
resource.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
resourceMapper.insert(resource);
|
||||
// TODO 操作日志
|
||||
// 返回成功
|
||||
@ -129,7 +130,7 @@ public class ResourceServiceImpl implements ResourceService {
|
||||
}
|
||||
// 更新到数据库
|
||||
ResourceDO resource = new ResourceDO().setId(resourceId);
|
||||
resource.setDeleted(BaseDO.DELETED_YES);
|
||||
resource.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
|
||||
resourceMapper.update(resource);
|
||||
// 删除资源关联表
|
||||
roleResourceMapper.updateToDeletedByResourceId(resourceId);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.mall.admin.service;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
@ -80,7 +81,8 @@ public class RoleServiceImpl implements RoleService {
|
||||
// TODO 芋艿,角色名是否要唯一呢?貌似一般系统都是允许的。
|
||||
// 保存到数据库
|
||||
RoleDO role = RoleConvert.INSTANCE.convert(roleAddDTO);
|
||||
role.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
role.setCreateTime(new Date());
|
||||
role.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
roleMapper.insert(role);
|
||||
// TODO 插入操作日志
|
||||
// 返回成功
|
||||
@ -111,7 +113,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
}
|
||||
// 更新到数据库,标记删除
|
||||
RoleDO roleDO = new RoleDO().setId(roleId);
|
||||
roleDO.setDeleted(RoleDO.DELETED_YES);
|
||||
roleDO.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
|
||||
roleMapper.update(roleDO);
|
||||
// 标记删除 RoleResource
|
||||
roleResourceMapper.updateToDeletedByRoleId(roleId);
|
||||
@ -141,7 +143,8 @@ public class RoleServiceImpl implements RoleService {
|
||||
if (!resourceIds.isEmpty()) {
|
||||
List<RoleResourceDO> roleResources = resourceIds.stream().map(resourceId -> {
|
||||
RoleResourceDO roleResource = new RoleResourceDO().setRoleId(roleId).setResourceId(resourceId);
|
||||
roleResource.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
roleResource.setCreateTime(new Date());
|
||||
roleResource.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
return roleResource;
|
||||
}).collect(Collectors.toList());
|
||||
roleResourceMapper.insertList(roleResources);
|
||||
|
@ -1,9 +1,9 @@
|
||||
package cn.iocoder.common.framework.constant;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* {@link BaseDO#getDeleted()} delete 状态
|
||||
* {@link DeletableDO#getDeleted()} delete 状态
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-03-22 21:15
|
||||
|
@ -8,15 +8,6 @@ import java.util.Date;
|
||||
*/
|
||||
public class BaseDO implements Serializable {
|
||||
|
||||
/**
|
||||
* 是否删除 - 是
|
||||
*/
|
||||
public static final Integer DELETED_YES = 1;
|
||||
/**
|
||||
* 是否删除 - 否
|
||||
*/
|
||||
public static final Integer DELETED_NO = 0;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ -25,10 +16,14 @@ public class BaseDO implements Serializable {
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BaseDO{" +
|
||||
"createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
@ -47,14 +42,4 @@ public class BaseDO implements Serializable {
|
||||
this.updateTime = updateTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public BaseDO setDeleted(Integer deleted) {
|
||||
this.deleted = deleted;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.common.framework.dataobject;
|
||||
|
||||
/**
|
||||
* extends BaseDO 扩展 delete 操作
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-03-22 22:03
|
||||
*/
|
||||
public class DeletableDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DeletableDO{" +
|
||||
"deleted=" + deleted +
|
||||
'}';
|
||||
}
|
||||
|
||||
public Integer getDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public DeletableDO setDeleted(Integer deleted) {
|
||||
this.deleted = deleted;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -17,22 +17,22 @@ public class OrderCreateDTO implements Serializable {
|
||||
* 收件区域编号
|
||||
*/
|
||||
@NotNull
|
||||
private String receiverAreaNo;
|
||||
private String areaNo;
|
||||
/**
|
||||
* 收件人名称
|
||||
*/
|
||||
@NotNull
|
||||
private String receiverName;
|
||||
private String name;
|
||||
/**
|
||||
* 收件手机号
|
||||
*/
|
||||
@NotNull
|
||||
private String receiverMobile;
|
||||
private String mobile;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
@NotNull
|
||||
private String receiverAddress;
|
||||
private String address;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ -48,48 +48,48 @@ public class OrderCreateDTO implements Serializable {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderCreateDTO{" +
|
||||
"receiverAreaNo='" + receiverAreaNo + '\'' +
|
||||
", receiverName='" + receiverName + '\'' +
|
||||
", receiverMobile='" + receiverMobile + '\'' +
|
||||
", receiverAddress='" + receiverAddress + '\'' +
|
||||
"areaNo='" + areaNo + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", mobile='" + mobile + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", remark='" + remark + '\'' +
|
||||
", orderItems=" + orderItems +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getReceiverAreaNo() {
|
||||
return receiverAreaNo;
|
||||
public String getAreaNo() {
|
||||
return areaNo;
|
||||
}
|
||||
|
||||
public OrderCreateDTO setReceiverAreaNo(String receiverAreaNo) {
|
||||
this.receiverAreaNo = receiverAreaNo;
|
||||
public OrderCreateDTO setAreaNo(String areaNo) {
|
||||
this.areaNo = areaNo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getReceiverName() {
|
||||
return receiverName;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public OrderCreateDTO setReceiverName(String receiverName) {
|
||||
this.receiverName = receiverName;
|
||||
public OrderCreateDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getReceiverMobile() {
|
||||
return receiverMobile;
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public OrderCreateDTO setReceiverMobile(String receiverMobile) {
|
||||
this.receiverMobile = receiverMobile;
|
||||
public OrderCreateDTO setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getReceiverAddress() {
|
||||
return receiverAddress;
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public OrderCreateDTO setReceiverAddress(String receiverAddress) {
|
||||
this.receiverAddress = receiverAddress;
|
||||
public OrderCreateDTO setAddress(String address) {
|
||||
this.address = address;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class OrderCreateItemDTO {
|
||||
* 商品编号
|
||||
*/
|
||||
@NotNull
|
||||
private String commodityId;
|
||||
private String skuId;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ -24,17 +24,17 @@ public class OrderCreateItemDTO {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderCreateItemDTO{" +
|
||||
"commodityId='" + commodityId + '\'' +
|
||||
"skuId='" + skuId + '\'' +
|
||||
", quantity=" + quantity +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getCommodityId() {
|
||||
return commodityId;
|
||||
public String getSkuId() {
|
||||
return skuId;
|
||||
}
|
||||
|
||||
public OrderCreateItemDTO setCommodityId(String commodityId) {
|
||||
this.commodityId = commodityId;
|
||||
public OrderCreateItemDTO setSkuId(String skuId) {
|
||||
this.skuId = skuId;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.mall.order.dao;
|
||||
|
||||
import cn.iocoder.mall.order.dataobject.OrderDO;
|
||||
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -10,7 +10,7 @@ import java.util.Date;
|
||||
* @author Sin
|
||||
* @time 2019-03-16 13:49
|
||||
*/
|
||||
public class OrderDO extends BaseDO {
|
||||
public class OrderDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -10,7 +10,7 @@ import java.util.Date;
|
||||
* @author Sin
|
||||
* @time 2019-03-19 19:48
|
||||
*/
|
||||
public class OrderExchangeDO extends BaseDO {
|
||||
public class OrderExchangeDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -10,7 +10,7 @@ import java.util.Date;
|
||||
* @author Sin
|
||||
* @time 2019-03-16 14:03
|
||||
*/
|
||||
public class OrderItemDO extends BaseDO {
|
||||
public class OrderItemDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.mall.order.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 订单物流信息
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -12,7 +12,7 @@ import java.util.Date;
|
||||
* @author Sin
|
||||
* @time 2019-03-19 20:48
|
||||
*/
|
||||
public class OrderLogisticsDetailDO extends BaseDO {
|
||||
public class OrderLogisticsDetailDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -10,7 +10,7 @@ import java.util.Date;
|
||||
* @author Sin
|
||||
* @time 2019-03-19 19:48
|
||||
*/
|
||||
public class OrderReturnDO extends BaseDO {
|
||||
public class OrderReturnDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号自动增长
|
||||
|
@ -51,7 +51,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
List<OrderItemDO> orderItemDOList = OrderConvert.INSTANCE.convert(orderItemDTOList);
|
||||
|
||||
// 物流信息
|
||||
orderLogisticsDO.setLogisticsNo("");
|
||||
orderLogisticsDO
|
||||
.setLogisticsNo("")
|
||||
.setCreateTime(new Date())
|
||||
.setUpdateTime(null);
|
||||
orderLogisticsMapper.insert(orderLogisticsDO);
|
||||
|
||||
// order
|
||||
@ -87,9 +90,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
.setClosingTime(null)
|
||||
.setHasReturnExchange(OrderStatusEnum.WAITING_PAYMENT.getValue())
|
||||
.setStatus(OrderStatusEnum.WAITING_PAYMENT.getValue())
|
||||
.setDeleted(DeleteStatusEnum.DELETE_NO.getValue())
|
||||
.setCreateTime(new Date())
|
||||
.setUpdateTime(new Date())
|
||||
.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
.setUpdateTime(new Date());
|
||||
|
||||
orderItemMapper.insert(orderItemDO);
|
||||
});
|
||||
|
@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -21,7 +22,7 @@ import java.util.Arrays;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = OrderApplicationTest.class)
|
||||
//@Transactional
|
||||
@Transactional
|
||||
public class OrderServiceImplTest {
|
||||
|
||||
@Autowired
|
||||
@ -31,24 +32,17 @@ public class OrderServiceImplTest {
|
||||
|
||||
@Test
|
||||
public void createOrderTest() {
|
||||
// Properties properties = System.getProperties();
|
||||
// String url = properties.getProperty("spring.datasource.url");
|
||||
// System.err.println(url);
|
||||
|
||||
String url = environment.getProperty("spring.datasource.url");
|
||||
System.err.println(url);
|
||||
|
||||
|
||||
OrderCreateItemDTO orderCreateItemDTO
|
||||
= new OrderCreateItemDTO()
|
||||
.setCommodityId("CID_001")
|
||||
.setSkuId("CID_001")
|
||||
.setQuantity(1);
|
||||
|
||||
orderService.createOrder(new OrderCreateDTO()
|
||||
orderService.createOrder(
|
||||
new OrderCreateDTO()
|
||||
.setRemark("")
|
||||
.setReceiverMobile("13301926050")
|
||||
.setReceiverAddress("深圳市福田区")
|
||||
.setReceiverAreaNo("1000100")
|
||||
.setMobile("13301926050")
|
||||
.setAddress("深圳市福田区")
|
||||
.setAreaNo("1000100")
|
||||
.setOrderItems(Arrays.asList(orderCreateItemDTO)));
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.pay.biz.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 支付应用(业务线)DO
|
||||
*/
|
||||
public class PayAppDO extends BaseDO {
|
||||
public class PayAppDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 应用编号
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.iocoder.mall.pay.biz.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 支付交易 DO
|
||||
*/
|
||||
public class PayTransactionDO extends BaseDO {
|
||||
public class PayTransactionDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.pay.biz.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 交易扩展表
|
||||
*/
|
||||
public class PayTransactionExtensionDO extends BaseDO {
|
||||
public class PayTransactionExtensionDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.iocoder.mall.pay.biz.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 支付交易通知 App 的日志 DO
|
||||
*
|
||||
* 通过该表,记录通知 App 时,产生的日志
|
||||
*/
|
||||
public class PayTransactionNotifyLogDO extends BaseDO {
|
||||
public class PayTransactionNotifyLogDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 日志编号,自增
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.pay.biz.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.pay.biz.service.PayServiceImpl;
|
||||
|
||||
import java.util.Date;
|
||||
@ -8,7 +8,7 @@ import java.util.Date;
|
||||
/**
|
||||
* 支付交易通知 App 的任务 DO
|
||||
*/
|
||||
public class PayTransactionNotifyTaskDO extends BaseDO {
|
||||
public class PayTransactionNotifyTaskDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 通知频率,单位为秒。
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* Product 规格
|
||||
*/
|
||||
public class ProductAttrDO extends BaseDO {
|
||||
public class ProductAttrDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 规格编号
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* Product 规格值
|
||||
*/
|
||||
public class ProductAttrValueDO extends BaseDO {
|
||||
public class ProductAttrValueDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 规格值编号
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 商品分类
|
||||
*/
|
||||
public class ProductCategoryDO extends BaseDO {
|
||||
public class ProductCategoryDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 分类编号
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 商品 SKU
|
||||
*/
|
||||
public class ProductSkuDO extends BaseDO {
|
||||
public class ProductSkuDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* sku 编号
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 商品 SPU
|
||||
*/
|
||||
public class ProductSpuDO extends BaseDO {
|
||||
public class ProductSpuDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* SPU 编号
|
||||
|
@ -1,7 +1,8 @@
|
||||
package cn.iocoder.mall.product.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.ProductAttrService;
|
||||
@ -119,7 +120,8 @@ public class ProductAttrServiceImpl implements ProductAttrService {
|
||||
// 插入到数据库
|
||||
ProductAttrDO productAttrDO = ProductAttrConvert.INSTANCE.convert(productAttrAddDTO)
|
||||
.setStatus(ProductAttrConstants.ATTR_STATUS_ENABLE);
|
||||
productAttrDO.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
productAttrDO.setCreateTime(new Date());
|
||||
productAttrDO.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
productAttrMapper.insert(productAttrDO);
|
||||
// 返回成功
|
||||
return CommonResult.success(ProductAttrConvert.INSTANCE.convert(productAttrDO));
|
||||
@ -174,7 +176,8 @@ public class ProductAttrServiceImpl implements ProductAttrService {
|
||||
// 插入到数据库
|
||||
ProductAttrValueDO productAttrValueDO = ProductAttrConvert.INSTANCE.convert(productAttrValueAddDTO)
|
||||
.setStatus(ProductAttrConstants.ATTR_VALUE_STATUS_ENABLE);
|
||||
productAttrValueDO.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
productAttrValueDO.setCreateTime(new Date());
|
||||
productAttrValueDO.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
productAttrValueMapper.insert(productAttrValueDO);
|
||||
// 返回成功
|
||||
return CommonResult.success(ProductAttrConvert.INSTANCE.convert2(productAttrValueDO));
|
||||
|
@ -1,7 +1,8 @@
|
||||
package cn.iocoder.mall.product.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.ProductCategoryService;
|
||||
@ -48,7 +49,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
|
||||
// 保存到数据库
|
||||
ProductCategoryDO productCategory = ProductCategoryConvert.INSTANCE.convert(productCategoryAddDTO)
|
||||
.setStatus(ProductCategoryConstants.STATUS_ENABLE);
|
||||
productCategory.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
productCategory.setCreateTime(new Date());
|
||||
productCategory.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
productCategoryMapper.insert(productCategory);
|
||||
// TODO 操作日志
|
||||
// 返回成功
|
||||
@ -116,7 +118,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
|
||||
// 标记删除商品分类
|
||||
ProductCategoryDO updateProductCategory = new ProductCategoryDO()
|
||||
.setId(productCategoryId);
|
||||
updateProductCategory.setDeleted(BaseDO.DELETED_YES);
|
||||
updateProductCategory.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
|
||||
productCategoryMapper.update(updateProductCategory);
|
||||
// TODO 操作日志
|
||||
return CommonResult.success(true);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.service;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.StringUtil;
|
||||
@ -91,7 +91,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
||||
ProductSpuDO spu = ProductSpuConvert.INSTANCE.convert(productSpuAddDTO)
|
||||
.setPicUrls(StringUtil.join(productSpuAddDTO.getPicUrls(), ","))
|
||||
.setSort(0); // 排序为 0
|
||||
spu.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
spu.setCreateTime(new Date());
|
||||
spu.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
initSpuFromSkus(spu, productSpuAddDTO.getSkus()); // 初始化 sku 相关信息到 spu 中
|
||||
productSpuMapper.insert(spu);
|
||||
// 保存 Sku
|
||||
@ -100,7 +101,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
||||
.setSpuId(spu.getId())
|
||||
.setStatus(ProductSpuConstants.SKU_STATUS_ENABLE)
|
||||
.setAttrs(StringUtil.join(productSkuAddDTO.getAttrs(), ","));
|
||||
sku.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
sku.setCreateTime(new Date());
|
||||
sku.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
return sku;
|
||||
}).collect(Collectors.toList());
|
||||
// 校验 Sku 规格
|
||||
@ -162,7 +164,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
||||
// 1、找不到,进行插入
|
||||
ProductSkuDO insertSku = ProductSpuConvert.INSTANCE.convert(skuUpdateDTO)
|
||||
.setSpuId(productSpuUpdateDTO.getId()).setStatus(ProductSpuConstants.SKU_STATUS_ENABLE).setAttrs(StringUtil.join(skuUpdateDTO.getAttrs(), ","));
|
||||
insertSku.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
insertSku.setCreateTime(new Date());
|
||||
insertSku.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
insertSkus.add(insertSku);
|
||||
}
|
||||
// 2、多余的,删除
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.iocoder.mall.user.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户访问日志 DO
|
||||
*/
|
||||
public class UserAccessLogDO extends BaseDO {
|
||||
public class UserAccessLogDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.iocoder.mall.user.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* 用户实体,存储用户基本数据。
|
||||
*
|
||||
* idx_mobile 唯一索引
|
||||
*/
|
||||
public class UserDO extends BaseDO {
|
||||
public class UserDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.user.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.ValidationUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
@ -51,7 +51,8 @@ public class UserServiceImpl implements UserService {
|
||||
}
|
||||
// 创建用户
|
||||
UserDO userDO = new UserDO().setMobile(mobile).setStatus(UserConstants.STATUS_ENABLE);
|
||||
userDO.setCreateTime(new Date()).setDeleted(BaseDO.DELETED_NO);
|
||||
userDO.setCreateTime(new Date());
|
||||
userDO.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||
userMapper.insert(userDO);
|
||||
// 插入注册信息
|
||||
createUserRegister(userDO);
|
||||
|
Loading…
Reference in New Issue
Block a user