From cc223fa2b3acdbdeb93fdfc6608f98a4be51b0ee Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Fri, 22 Mar 2019 22:22:33 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=B7=BB=E5=8A=A0=20DeletableDO=20-=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20DO=20extends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/dataobject/AdminAccessLogDO.java | 4 +- .../mall/admin/dataobject/AdminDO.java | 4 +- .../mall/admin/dataobject/AdminRoleDO.java | 4 +- .../mall/admin/dataobject/DataDictDO.java | 4 +- .../mall/admin/dataobject/ResourceDO.java | 4 +- .../iocoder/mall/admin/dataobject/RoleDO.java | 4 +- .../mall/admin/dataobject/RoleResourceDO.java | 4 +- .../mall/admin/service/AdminServiceImpl.java | 10 ++-- .../admin/service/DataDictServiceImpl.java | 7 +-- .../admin/service/ResourceServiceImpl.java | 7 +-- .../mall/admin/service/RoleServiceImpl.java | 11 +++-- .../framework/constant/DeleteStatusEnum.java | 4 +- .../common/framework/dataobject/BaseDO.java | 31 ++++-------- .../framework/dataobject/DeletableDO.java | 31 ++++++++++++ .../mall/order/api/dto/OrderCreateDTO.java | 48 +++++++++---------- .../order/api/dto/OrderCreateItemDTO.java | 12 ++--- .../mall/order/dao/OrderLogisticsMapper.java | 1 - .../mall/order/dataobject/OrderDO.java | 4 +- .../order/dataobject/OrderExchangeDO.java | 4 +- .../mall/order/dataobject/OrderItemDO.java | 4 +- .../order/dataobject/OrderLogisticsDO.java | 1 + .../dataobject/OrderLogisticsDetailDO.java | 4 +- .../mall/order/dataobject/OrderReturnDO.java | 4 +- .../mall/order/service/OrderServiceImpl.java | 9 ++-- .../order/service/OrderServiceImplTest.java | 22 ++++----- .../mall/pay/biz/dataobject/PayAppDO.java | 4 +- .../pay/biz/dataobject/PayTransactionDO.java | 4 +- .../dataobject/PayTransactionExtensionDO.java | 4 +- .../dataobject/PayTransactionNotifyLogDO.java | 4 +- .../PayTransactionNotifyTaskDO.java | 4 +- .../product/dataobject/ProductAttrDO.java | 4 +- .../dataobject/ProductAttrValueDO.java | 4 +- .../product/dataobject/ProductCategoryDO.java | 4 +- .../mall/product/dataobject/ProductSkuDO.java | 4 +- .../mall/product/dataobject/ProductSpuDO.java | 4 +- .../service/ProductAttrServiceImpl.java | 9 ++-- .../service/ProductCategoryServiceImpl.java | 8 ++-- .../service/ProductSpuServiceImpl.java | 11 +++-- .../mall/user/dataobject/UserAccessLogDO.java | 4 +- .../iocoder/mall/user/dataobject/UserDO.java | 4 +- .../mall/user/service/UserServiceImpl.java | 5 +- 41 files changed, 176 insertions(+), 147 deletions(-) create mode 100644 common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/DeletableDO.java diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminAccessLogDO.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminAccessLogDO.java index 93221788c..8c84f9702 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminAccessLogDO.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminAccessLogDO.java @@ -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 { /** * 编号 diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminDO.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminDO.java index 2ef36bbcb..adfb1242f 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminDO.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminDO.java @@ -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 { /** * 账号状态 - 开启 diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminRoleDO.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminRoleDO.java index dc841ce97..c7aa3342a 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminRoleDO.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminRoleDO.java @@ -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 { /** * 编号 diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/DataDictDO.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/DataDictDO.java index ba2e78f8e..fa0002bd8 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/DataDictDO.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/DataDictDO.java @@ -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 { /** * 编号 diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/ResourceDO.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/ResourceDO.java index 79c887add..2875e9a81 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/ResourceDO.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/ResourceDO.java @@ -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 { /** * 资源类型 - 菜单 diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/RoleDO.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/RoleDO.java index b124e2c83..c35392184 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/RoleDO.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/RoleDO.java @@ -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 { /** * 角色编号 diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/RoleResourceDO.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/RoleResourceDO.java index 09f77d475..584664193 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/RoleResourceDO.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/RoleResourceDO.java @@ -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 { /** * 编号 diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/AdminServiceImpl.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/AdminServiceImpl.java index d39066614..55eef8715 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/AdminServiceImpl.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/AdminServiceImpl.java @@ -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 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); diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java index 42fe01a57..0b809cf3e 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java @@ -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 插入操作日志 // 返回成功 diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java index fa1772e23..b01edbc7c 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java @@ -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); diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/RoleServiceImpl.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/RoleServiceImpl.java index 0edc7f2e1..237e2ad91 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/RoleServiceImpl.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/RoleServiceImpl.java @@ -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 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); diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/constant/DeleteStatusEnum.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/constant/DeleteStatusEnum.java index 672846855..5c8ec2737 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/constant/DeleteStatusEnum.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/constant/DeleteStatusEnum.java @@ -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 diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/BaseDO.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/BaseDO.java index 4629484f2..4f6882629 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/BaseDO.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/BaseDO.java @@ -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; - } - } \ No newline at end of file diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/DeletableDO.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/DeletableDO.java new file mode 100644 index 000000000..ce006b925 --- /dev/null +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/DeletableDO.java @@ -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; + } +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java index c1c769367..60916a31b 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java @@ -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; } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateItemDTO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateItemDTO.java index 717523d44..da9323dbd 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateItemDTO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateItemDTO.java @@ -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; } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderLogisticsMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderLogisticsMapper.java index b72e6dc88..dd1737824 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderLogisticsMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderLogisticsMapper.java @@ -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; diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderDO.java index a318766dd..3928738dd 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderDO.java @@ -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 diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderExchangeDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderExchangeDO.java index bc22e0ff2..afa1120aa 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderExchangeDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderExchangeDO.java @@ -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 diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderItemDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderItemDO.java index 70dae0cdb..d39a97651 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderItemDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderItemDO.java @@ -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 { /** * 编号 diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDO.java index fc4cffd65..4fcc7d564 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDO.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.order.dataobject; import cn.iocoder.common.framework.dataobject.BaseDO; +import cn.iocoder.common.framework.dataobject.DeletableDO; /** * 订单物流信息 diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDetailDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDetailDO.java index 0e3bf4795..63da16075 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDetailDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDetailDO.java @@ -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 diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderReturnDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderReturnDO.java index 7a0088f75..fad77ce6f 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderReturnDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderReturnDO.java @@ -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 { /** * 编号自动增长 diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/service/OrderServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/service/OrderServiceImpl.java index 5a8d66266..0df86cf79 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/service/OrderServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/service/OrderServiceImpl.java @@ -51,7 +51,10 @@ public class OrderServiceImpl implements OrderService { List 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); }); diff --git a/order/order-service-impl/src/test/java/cn/iocoder/mall/order/service/OrderServiceImplTest.java b/order/order-service-impl/src/test/java/cn/iocoder/mall/order/service/OrderServiceImplTest.java index 6cbc1753f..9c406b2b4 100644 --- a/order/order-service-impl/src/test/java/cn/iocoder/mall/order/service/OrderServiceImplTest.java +++ b/order/order-service-impl/src/test/java/cn/iocoder/mall/order/service/OrderServiceImplTest.java @@ -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))); } } diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayAppDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayAppDO.java index ffe97c920..f7d062791 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayAppDO.java +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayAppDO.java @@ -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 { /** * 应用编号 diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionDO.java index 96603fe33..81cd56a12 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionDO.java +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionDO.java @@ -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 { /** * 编号,自增 diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionExtensionDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionExtensionDO.java index 7699df12d..c25ee8ea5 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionExtensionDO.java +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionExtensionDO.java @@ -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 { /** * 编号,自增 diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionNotifyLogDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionNotifyLogDO.java index e348c30ce..341b5d22c 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionNotifyLogDO.java +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionNotifyLogDO.java @@ -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 { /** * 日志编号,自增 diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionNotifyTaskDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionNotifyTaskDO.java index 9aebb9be4..531606221 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionNotifyTaskDO.java +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionNotifyTaskDO.java @@ -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 { /** * 通知频率,单位为秒。 diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java index b5007912b..4d42aa986 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java @@ -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 { /** * 规格编号 diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java index a9a2576c7..ba9f0a747 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java @@ -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 { /** * 规格值编号 diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java index 65c022816..c31a53254 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java @@ -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 { /** * 分类编号 diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java index 8ab2d4c4b..60543167d 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java @@ -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 编号 diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java index 2f2f5c0c6..073e6168d 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java @@ -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 编号 diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java index 49b4bb66a..7b3fb17ae 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java @@ -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)); diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java index 6ac41e459..ccbb7d9af 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java @@ -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); diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java index 603ca6f47..0e9ae58c2 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java @@ -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、多余的,删除 diff --git a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/dataobject/UserAccessLogDO.java b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/dataobject/UserAccessLogDO.java index 4c10fa920..94db1da25 100644 --- a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/dataobject/UserAccessLogDO.java +++ b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/dataobject/UserAccessLogDO.java @@ -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 { /** * 编号 diff --git a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/dataobject/UserDO.java b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/dataobject/UserDO.java index c79feec97..b82e06957 100644 --- a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/dataobject/UserDO.java +++ b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/dataobject/UserDO.java @@ -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 { /** * 用户编号 diff --git a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/service/UserServiceImpl.java b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/service/UserServiceImpl.java index 19a8e08a5..9f46fbcd1 100644 --- a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/service/UserServiceImpl.java +++ b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/service/UserServiceImpl.java @@ -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);