- 添加 DeletableDO

- 修改 DO extends
pull/1/head
sin 2019-03-22 22:22:33 +08:00
parent f4c7f65cb8
commit cc223fa2b3
41 changed files with 176 additions and 147 deletions

View File

@ -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 {
/**
*

View File

@ -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 {
/**
* -

View File

@ -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 {
/**
*

View File

@ -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;
* value1
* value2
*/
public class DataDictDO extends BaseDO {
public class DataDictDO extends DeletableDO {
/**
*

View File

@ -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 {
/**
* -

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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);

View File

@ -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 插入操作日志
// 返回成功

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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 {
/**
*

View File

@ -1,6 +1,7 @@
package cn.iocoder.mall.order.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO;
import cn.iocoder.common.framework.dataobject.DeletableDO;
/**
*

View File

@ -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

View File

@ -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 {
/**
*

View File

@ -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);
});

View File

@ -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)));
}
}

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -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);

View File

@ -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、多余的删除

View File

@ -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 {
/**
*

View File

@ -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 {
/**
*

View File

@ -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);