- 添加 DeletableDO

- 修改 DO extends
This commit is contained in:
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; package cn.iocoder.mall.admin.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
import java.util.Date; import java.util.Date;
/** /**
* 管理员访问日志 DO * 管理员访问日志 DO
*/ */
public class AdminAccessLogDO extends BaseDO { public class AdminAccessLogDO extends DeletableDO {
/** /**
* 编号 * 编号

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.admin.dataobject; 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; package cn.iocoder.mall.admin.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* {@link AdminDO} {@link RoleDO} 的关联表 * {@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; 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 * value1
* value2 * value2
*/ */
public class DataDictDO extends BaseDO { public class DataDictDO extends DeletableDO {
/** /**
* 编号 * 编号

View File

@ -1,13 +1,13 @@
package cn.iocoder.mall.admin.dataobject; package cn.iocoder.mall.admin.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
import java.util.Date; 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; 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; package cn.iocoder.mall.admin.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* {@link RoleDO} {@link ResourceDO} 的关联表 * {@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; 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.constant.SysErrorCodeEnum;
import cn.iocoder.common.framework.dataobject.BaseDO;
import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.admin.api.AdminService; import cn.iocoder.mall.admin.api.AdminService;
@ -88,7 +88,8 @@ public class AdminServiceImpl implements AdminService {
AdminDO admin = AdminConvert.INSTANCE.convert(adminAddDTO) AdminDO admin = AdminConvert.INSTANCE.convert(adminAddDTO)
.setPassword(encodePassword(adminAddDTO.getPassword())) // 加密密码 .setPassword(encodePassword(adminAddDTO.getPassword())) // 加密密码
.setStatus(AdminDO.STATUS_ENABLE); .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); adminMapper.insert(admin);
// TODO 插入操作日志 // TODO 插入操作日志
// 返回成功 // 返回成功
@ -159,7 +160,7 @@ public class AdminServiceImpl implements AdminService {
} }
// 标记删除 AdminDO // 标记删除 AdminDO
AdminDO updateAdmin = new AdminDO().setId(updateAdminId); AdminDO updateAdmin = new AdminDO().setId(updateAdminId);
updateAdmin.setDeleted(BaseDO.DELETED_YES); updateAdmin.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
adminMapper.update(updateAdmin); adminMapper.update(updateAdmin);
// 标记删除 AdminRole // 标记删除 AdminRole
adminRoleMapper.updateToDeletedByAdminId(updateAdminId); adminRoleMapper.updateToDeletedByAdminId(updateAdminId);
@ -188,7 +189,8 @@ public class AdminServiceImpl implements AdminService {
if (!roleIds.isEmpty()) { if (!roleIds.isEmpty()) {
List<AdminRoleDO> adminRoleDOs = roleIds.stream().map(roleId -> { List<AdminRoleDO> adminRoleDOs = roleIds.stream().map(roleId -> {
AdminRoleDO roleResource = new AdminRoleDO().setAdminId(updateAdminId).setRoleId(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; return roleResource;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
adminRoleMapper.insertList(adminRoleDOs); adminRoleMapper.insertList(adminRoleDOs);

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.admin.service; 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.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.admin.api.DataDictService; import cn.iocoder.mall.admin.api.DataDictService;
@ -41,7 +41,8 @@ public class DataDictServiceImpl implements DataDictService {
} }
// 保存到数据库 // 保存到数据库
DataDictDO dataDict = DataDictConvert.INSTANCE.convert(dataDictAddDTO); 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); dataDictMapper.insert(dataDict);
// TODO 插入操作日志 // TODO 插入操作日志
// 返回成功 // 返回成功
@ -79,7 +80,7 @@ public class DataDictServiceImpl implements DataDictService {
} }
// 更新到数据库 // 更新到数据库
DataDictDO updateDataDict = new DataDictDO().setId(dataDictId); DataDictDO updateDataDict = new DataDictDO().setId(dataDictId);
updateDataDict.setDeleted(BaseDO.DELETED_YES); updateDataDict.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
dataDictMapper.update(updateDataDict); dataDictMapper.update(updateDataDict);
// TODO 插入操作日志 // TODO 插入操作日志
// 返回成功 // 返回成功

View File

@ -1,7 +1,8 @@
package cn.iocoder.mall.admin.service; 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.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.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.admin.api.ResourceService; import cn.iocoder.mall.admin.api.ResourceService;
@ -75,7 +76,7 @@ public class ResourceServiceImpl implements ResourceService {
resource.setHandler("/" + resource.getHandler()); resource.setHandler("/" + resource.getHandler());
} }
resource.setCreateTime(new Date()); resource.setCreateTime(new Date());
resource.setDeleted(BaseDO.DELETED_NO); resource.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
resourceMapper.insert(resource); resourceMapper.insert(resource);
// TODO 操作日志 // TODO 操作日志
// 返回成功 // 返回成功
@ -129,7 +130,7 @@ public class ResourceServiceImpl implements ResourceService {
} }
// 更新到数据库 // 更新到数据库
ResourceDO resource = new ResourceDO().setId(resourceId); ResourceDO resource = new ResourceDO().setId(resourceId);
resource.setDeleted(BaseDO.DELETED_YES); resource.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
resourceMapper.update(resource); resourceMapper.update(resource);
// 删除资源关联表 // 删除资源关联表
roleResourceMapper.updateToDeletedByResourceId(resourceId); roleResourceMapper.updateToDeletedByResourceId(resourceId);

View File

@ -1,6 +1,7 @@
package cn.iocoder.mall.admin.service; 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.CollectionUtil;
import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
@ -80,7 +81,8 @@ public class RoleServiceImpl implements RoleService {
// TODO 芋艿角色名是否要唯一呢貌似一般系统都是允许的 // TODO 芋艿角色名是否要唯一呢貌似一般系统都是允许的
// 保存到数据库 // 保存到数据库
RoleDO role = RoleConvert.INSTANCE.convert(roleAddDTO); 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); roleMapper.insert(role);
// TODO 插入操作日志 // TODO 插入操作日志
// 返回成功 // 返回成功
@ -111,7 +113,7 @@ public class RoleServiceImpl implements RoleService {
} }
// 更新到数据库标记删除 // 更新到数据库标记删除
RoleDO roleDO = new RoleDO().setId(roleId); RoleDO roleDO = new RoleDO().setId(roleId);
roleDO.setDeleted(RoleDO.DELETED_YES); roleDO.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
roleMapper.update(roleDO); roleMapper.update(roleDO);
// 标记删除 RoleResource // 标记删除 RoleResource
roleResourceMapper.updateToDeletedByRoleId(roleId); roleResourceMapper.updateToDeletedByRoleId(roleId);
@ -141,7 +143,8 @@ public class RoleServiceImpl implements RoleService {
if (!resourceIds.isEmpty()) { if (!resourceIds.isEmpty()) {
List<RoleResourceDO> roleResources = resourceIds.stream().map(resourceId -> { List<RoleResourceDO> roleResources = resourceIds.stream().map(resourceId -> {
RoleResourceDO roleResource = new RoleResourceDO().setRoleId(roleId).setResourceId(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; return roleResource;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
roleResourceMapper.insertList(roleResources); roleResourceMapper.insertList(roleResources);

View File

@ -1,9 +1,9 @@
package cn.iocoder.common.framework.constant; 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 * @author Sin
* @time 2019-03-22 21:15 * @time 2019-03-22 21:15

View File

@ -8,15 +8,6 @@ import java.util.Date;
*/ */
public class BaseDO implements Serializable { 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 Date updateTime;
/**
* 是否删除 @Override
*/ public String toString() {
private Integer deleted; return "BaseDO{" +
"createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
@ -47,14 +42,4 @@ public class BaseDO implements Serializable {
this.updateTime = updateTime; this.updateTime = updateTime;
return this; 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 @NotNull
private String receiverAreaNo; private String areaNo;
/** /**
* 收件人名称 * 收件人名称
*/ */
@NotNull @NotNull
private String receiverName; private String name;
/** /**
* 收件手机号 * 收件手机号
*/ */
@NotNull @NotNull
private String receiverMobile; private String mobile;
/** /**
* 收件详细地址 * 收件详细地址
*/ */
@NotNull @NotNull
private String receiverAddress; private String address;
/** /**
* 备注 * 备注
*/ */
@ -48,48 +48,48 @@ public class OrderCreateDTO implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "OrderCreateDTO{" + return "OrderCreateDTO{" +
"receiverAreaNo='" + receiverAreaNo + '\'' + "areaNo='" + areaNo + '\'' +
", receiverName='" + receiverName + '\'' + ", name='" + name + '\'' +
", receiverMobile='" + receiverMobile + '\'' + ", mobile='" + mobile + '\'' +
", receiverAddress='" + receiverAddress + '\'' + ", address='" + address + '\'' +
", remark='" + remark + '\'' + ", remark='" + remark + '\'' +
", orderItems=" + orderItems + ", orderItems=" + orderItems +
'}'; '}';
} }
public String getReceiverAreaNo() { public String getAreaNo() {
return receiverAreaNo; return areaNo;
} }
public OrderCreateDTO setReceiverAreaNo(String receiverAreaNo) { public OrderCreateDTO setAreaNo(String areaNo) {
this.receiverAreaNo = receiverAreaNo; this.areaNo = areaNo;
return this; return this;
} }
public String getReceiverName() { public String getName() {
return receiverName; return name;
} }
public OrderCreateDTO setReceiverName(String receiverName) { public OrderCreateDTO setName(String name) {
this.receiverName = receiverName; this.name = name;
return this; return this;
} }
public String getReceiverMobile() { public String getMobile() {
return receiverMobile; return mobile;
} }
public OrderCreateDTO setReceiverMobile(String receiverMobile) { public OrderCreateDTO setMobile(String mobile) {
this.receiverMobile = receiverMobile; this.mobile = mobile;
return this; return this;
} }
public String getReceiverAddress() { public String getAddress() {
return receiverAddress; return address;
} }
public OrderCreateDTO setReceiverAddress(String receiverAddress) { public OrderCreateDTO setAddress(String address) {
this.receiverAddress = receiverAddress; this.address = address;
return this; return this;
} }

View File

@ -13,7 +13,7 @@ public class OrderCreateItemDTO {
* 商品编号 * 商品编号
*/ */
@NotNull @NotNull
private String commodityId; private String skuId;
/** /**
* 数量 * 数量
*/ */
@ -24,17 +24,17 @@ public class OrderCreateItemDTO {
@Override @Override
public String toString() { public String toString() {
return "OrderCreateItemDTO{" + return "OrderCreateItemDTO{" +
"commodityId='" + commodityId + '\'' + "skuId='" + skuId + '\'' +
", quantity=" + quantity + ", quantity=" + quantity +
'}'; '}';
} }
public String getCommodityId() { public String getSkuId() {
return commodityId; return skuId;
} }
public OrderCreateItemDTO setCommodityId(String commodityId) { public OrderCreateItemDTO setSkuId(String skuId) {
this.commodityId = commodityId; this.skuId = skuId;
return this; return this;
} }

View File

@ -1,6 +1,5 @@
package cn.iocoder.mall.order.dao; package cn.iocoder.mall.order.dao;
import cn.iocoder.mall.order.dataobject.OrderDO;
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO; import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
import java.util.Date; import java.util.Date;
@ -10,7 +10,7 @@ import java.util.Date;
* @author Sin * @author Sin
* @time 2019-03-16 13:49 * @time 2019-03-16 13:49
*/ */
public class OrderDO extends BaseDO { public class OrderDO extends DeletableDO {
/** /**
* id * id

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
import java.util.Date; import java.util.Date;
@ -10,7 +10,7 @@ import java.util.Date;
* @author Sin * @author Sin
* @time 2019-03-19 19:48 * @time 2019-03-19 19:48
*/ */
public class OrderExchangeDO extends BaseDO { public class OrderExchangeDO extends DeletableDO {
/** /**
* id * id

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
import java.util.Date; import java.util.Date;
@ -10,7 +10,7 @@ import java.util.Date;
* @author Sin * @author Sin
* @time 2019-03-16 14:03 * @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; package cn.iocoder.mall.order.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; 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; package cn.iocoder.mall.order.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
import java.util.Date; import java.util.Date;
@ -12,7 +12,7 @@ import java.util.Date;
* @author Sin * @author Sin
* @time 2019-03-19 20:48 * @time 2019-03-19 20:48
*/ */
public class OrderLogisticsDetailDO extends BaseDO { public class OrderLogisticsDetailDO extends DeletableDO {
/** /**
* id * id

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
import java.util.Date; import java.util.Date;
@ -10,7 +10,7 @@ import java.util.Date;
* @author Sin * @author Sin
* @time 2019-03-19 19:48 * @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); List<OrderItemDO> orderItemDOList = OrderConvert.INSTANCE.convert(orderItemDTOList);
// 物流信息 // 物流信息
orderLogisticsDO.setLogisticsNo(""); orderLogisticsDO
.setLogisticsNo("")
.setCreateTime(new Date())
.setUpdateTime(null);
orderLogisticsMapper.insert(orderLogisticsDO); orderLogisticsMapper.insert(orderLogisticsDO);
// order // order
@ -87,9 +90,9 @@ public class OrderServiceImpl implements OrderService {
.setClosingTime(null) .setClosingTime(null)
.setHasReturnExchange(OrderStatusEnum.WAITING_PAYMENT.getValue()) .setHasReturnExchange(OrderStatusEnum.WAITING_PAYMENT.getValue())
.setStatus(OrderStatusEnum.WAITING_PAYMENT.getValue()) .setStatus(OrderStatusEnum.WAITING_PAYMENT.getValue())
.setDeleted(DeleteStatusEnum.DELETE_NO.getValue())
.setCreateTime(new Date()) .setCreateTime(new Date())
.setUpdateTime(new Date()) .setUpdateTime(new Date());
.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
orderItemMapper.insert(orderItemDO); 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.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.Arrays;
@ -21,7 +22,7 @@ import java.util.Arrays;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = OrderApplicationTest.class) @SpringBootTest(classes = OrderApplicationTest.class)
//@Transactional @Transactional
public class OrderServiceImplTest { public class OrderServiceImplTest {
@Autowired @Autowired
@ -31,24 +32,17 @@ public class OrderServiceImplTest {
@Test @Test
public void createOrderTest() { 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 OrderCreateItemDTO orderCreateItemDTO
= new OrderCreateItemDTO() = new OrderCreateItemDTO()
.setCommodityId("CID_001") .setSkuId("CID_001")
.setQuantity(1); .setQuantity(1);
orderService.createOrder(new OrderCreateDTO() orderService.createOrder(
new OrderCreateDTO()
.setRemark("") .setRemark("")
.setReceiverMobile("13301926050") .setMobile("13301926050")
.setReceiverAddress("深圳市福田区") .setAddress("深圳市福田区")
.setReceiverAreaNo("1000100") .setAreaNo("1000100")
.setOrderItems(Arrays.asList(orderCreateItemDTO))); .setOrderItems(Arrays.asList(orderCreateItemDTO)));
} }
} }

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.pay.biz.dataobject; package cn.iocoder.mall.pay.biz.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* 支付应用业务线DO * 支付应用业务线DO
*/ */
public class PayAppDO extends BaseDO { public class PayAppDO extends DeletableDO {
/** /**
* 应用编号 * 应用编号

View File

@ -1,13 +1,13 @@
package cn.iocoder.mall.pay.biz.dataobject; 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; import java.util.Date;
/** /**
* 支付交易 DO * 支付交易 DO
*/ */
public class PayTransactionDO extends BaseDO { public class PayTransactionDO extends DeletableDO {
/** /**
* 编号自增 * 编号自增

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.pay.biz.dataobject; 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; package cn.iocoder.mall.pay.biz.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* 支付交易通知 App 的日志 DO * 支付交易通知 App 的日志 DO
* *
* 通过该表记录通知 App 产生的日志 * 通过该表记录通知 App 产生的日志
*/ */
public class PayTransactionNotifyLogDO extends BaseDO { public class PayTransactionNotifyLogDO extends DeletableDO {
/** /**
* 日志编号自增 * 日志编号自增

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.pay.biz.dataobject; 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 cn.iocoder.mall.pay.biz.service.PayServiceImpl;
import java.util.Date; import java.util.Date;
@ -8,7 +8,7 @@ import java.util.Date;
/** /**
* 支付交易通知 App 的任务 DO * 支付交易通知 App 的任务 DO
*/ */
public class PayTransactionNotifyTaskDO extends BaseDO { public class PayTransactionNotifyTaskDO extends DeletableDO {
/** /**
* 通知频率单位为秒 * 通知频率单位为秒

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.product.dataobject; package cn.iocoder.mall.product.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* Product 规格 * Product 规格
*/ */
public class ProductAttrDO extends BaseDO { public class ProductAttrDO extends DeletableDO {
/** /**
* 规格编号 * 规格编号

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.product.dataobject; package cn.iocoder.mall.product.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* Product 规格值 * Product 规格值
*/ */
public class ProductAttrValueDO extends BaseDO { public class ProductAttrValueDO extends DeletableDO {
/** /**
* 规格值编号 * 规格值编号

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.product.dataobject; 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; package cn.iocoder.mall.product.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* 商品 SKU * 商品 SKU
*/ */
public class ProductSkuDO extends BaseDO { public class ProductSkuDO extends DeletableDO {
/** /**
* sku 编号 * sku 编号

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.product.dataobject; package cn.iocoder.mall.product.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* 商品 SPU * 商品 SPU
*/ */
public class ProductSpuDO extends BaseDO { public class ProductSpuDO extends DeletableDO {
/** /**
* SPU 编号 * SPU 编号

View File

@ -1,7 +1,8 @@
package cn.iocoder.mall.product.service; 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.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.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.product.api.ProductAttrService; import cn.iocoder.mall.product.api.ProductAttrService;
@ -119,7 +120,8 @@ public class ProductAttrServiceImpl implements ProductAttrService {
// 插入到数据库 // 插入到数据库
ProductAttrDO productAttrDO = ProductAttrConvert.INSTANCE.convert(productAttrAddDTO) ProductAttrDO productAttrDO = ProductAttrConvert.INSTANCE.convert(productAttrAddDTO)
.setStatus(ProductAttrConstants.ATTR_STATUS_ENABLE); .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); productAttrMapper.insert(productAttrDO);
// 返回成功 // 返回成功
return CommonResult.success(ProductAttrConvert.INSTANCE.convert(productAttrDO)); return CommonResult.success(ProductAttrConvert.INSTANCE.convert(productAttrDO));
@ -174,7 +176,8 @@ public class ProductAttrServiceImpl implements ProductAttrService {
// 插入到数据库 // 插入到数据库
ProductAttrValueDO productAttrValueDO = ProductAttrConvert.INSTANCE.convert(productAttrValueAddDTO) ProductAttrValueDO productAttrValueDO = ProductAttrConvert.INSTANCE.convert(productAttrValueAddDTO)
.setStatus(ProductAttrConstants.ATTR_VALUE_STATUS_ENABLE); .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); productAttrValueMapper.insert(productAttrValueDO);
// 返回成功 // 返回成功
return CommonResult.success(ProductAttrConvert.INSTANCE.convert2(productAttrValueDO)); return CommonResult.success(ProductAttrConvert.INSTANCE.convert2(productAttrValueDO));

View File

@ -1,7 +1,8 @@
package cn.iocoder.mall.product.service; 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.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.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.product.api.ProductCategoryService; import cn.iocoder.mall.product.api.ProductCategoryService;
@ -48,7 +49,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
// 保存到数据库 // 保存到数据库
ProductCategoryDO productCategory = ProductCategoryConvert.INSTANCE.convert(productCategoryAddDTO) ProductCategoryDO productCategory = ProductCategoryConvert.INSTANCE.convert(productCategoryAddDTO)
.setStatus(ProductCategoryConstants.STATUS_ENABLE); .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); productCategoryMapper.insert(productCategory);
// TODO 操作日志 // TODO 操作日志
// 返回成功 // 返回成功
@ -116,7 +118,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
// 标记删除商品分类 // 标记删除商品分类
ProductCategoryDO updateProductCategory = new ProductCategoryDO() ProductCategoryDO updateProductCategory = new ProductCategoryDO()
.setId(productCategoryId); .setId(productCategoryId);
updateProductCategory.setDeleted(BaseDO.DELETED_YES); updateProductCategory.setDeleted(DeleteStatusEnum.DELETE_YES.getValue());
productCategoryMapper.update(updateProductCategory); productCategoryMapper.update(updateProductCategory);
// TODO 操作日志 // TODO 操作日志
return CommonResult.success(true); return CommonResult.success(true);

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.product.service; 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.CollectionUtil;
import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.util.StringUtil; import cn.iocoder.common.framework.util.StringUtil;
@ -91,7 +91,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
ProductSpuDO spu = ProductSpuConvert.INSTANCE.convert(productSpuAddDTO) ProductSpuDO spu = ProductSpuConvert.INSTANCE.convert(productSpuAddDTO)
.setPicUrls(StringUtil.join(productSpuAddDTO.getPicUrls(), ",")) .setPicUrls(StringUtil.join(productSpuAddDTO.getPicUrls(), ","))
.setSort(0); // 排序为 0 .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 initSpuFromSkus(spu, productSpuAddDTO.getSkus()); // 初始化 sku 相关信息到 spu
productSpuMapper.insert(spu); productSpuMapper.insert(spu);
// 保存 Sku // 保存 Sku
@ -100,7 +101,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
.setSpuId(spu.getId()) .setSpuId(spu.getId())
.setStatus(ProductSpuConstants.SKU_STATUS_ENABLE) .setStatus(ProductSpuConstants.SKU_STATUS_ENABLE)
.setAttrs(StringUtil.join(productSkuAddDTO.getAttrs(), ",")); .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; return sku;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
// 校验 Sku 规格 // 校验 Sku 规格
@ -162,7 +164,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
// 1找不到进行插入 // 1找不到进行插入
ProductSkuDO insertSku = ProductSpuConvert.INSTANCE.convert(skuUpdateDTO) ProductSkuDO insertSku = ProductSpuConvert.INSTANCE.convert(skuUpdateDTO)
.setSpuId(productSpuUpdateDTO.getId()).setStatus(ProductSpuConstants.SKU_STATUS_ENABLE).setAttrs(StringUtil.join(skuUpdateDTO.getAttrs(), ",")); .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); insertSkus.add(insertSku);
} }
// 2多余的删除 // 2多余的删除

View File

@ -1,13 +1,13 @@
package cn.iocoder.mall.user.dataobject; package cn.iocoder.mall.user.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
import java.util.Date; import java.util.Date;
/** /**
* 用户访问日志 DO * 用户访问日志 DO
*/ */
public class UserAccessLogDO extends BaseDO { public class UserAccessLogDO extends DeletableDO {
/** /**
* 编号 * 编号

View File

@ -1,13 +1,13 @@
package cn.iocoder.mall.user.dataobject; package cn.iocoder.mall.user.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* 用户实体存储用户基本数据 * 用户实体存储用户基本数据
* *
* idx_mobile 唯一索引 * idx_mobile 唯一索引
*/ */
public class UserDO extends BaseDO { public class UserDO extends DeletableDO {
/** /**
* 用户编号 * 用户编号

View File

@ -1,7 +1,7 @@
package cn.iocoder.mall.user.service; 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.constant.SysErrorCodeEnum;
import cn.iocoder.common.framework.dataobject.BaseDO;
import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.ServiceExceptionUtil;
import cn.iocoder.common.framework.util.ValidationUtil; import cn.iocoder.common.framework.util.ValidationUtil;
import cn.iocoder.common.framework.vo.CommonResult; 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 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); userMapper.insert(userDO);
// 插入注册信息 // 插入注册信息
createUserRegister(userDO); createUserRegister(userDO);