- 修改 delete 改为 deleted统一

pull/1/head
sin 2019-03-23 12:15:39 +08:00
parent bcae55bc59
commit 7b52f050c0
9 changed files with 27 additions and 31 deletions

View File

@ -1,6 +1,6 @@
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.DeletedStatusEnum;
import cn.iocoder.common.framework.constant.SysErrorCodeEnum; import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
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;
@ -89,7 +89,7 @@ public class AdminServiceImpl implements AdminService {
.setPassword(encodePassword(adminAddDTO.getPassword())) // 加密密码 .setPassword(encodePassword(adminAddDTO.getPassword())) // 加密密码
.setStatus(AdminDO.STATUS_ENABLE); .setStatus(AdminDO.STATUS_ENABLE);
admin.setCreateTime(new Date()); admin.setCreateTime(new Date());
admin.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); admin.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
adminMapper.insert(admin); adminMapper.insert(admin);
// TODO 插入操作日志 // TODO 插入操作日志
// 返回成功 // 返回成功
@ -160,7 +160,7 @@ public class AdminServiceImpl implements AdminService {
} }
// 标记删除 AdminDO // 标记删除 AdminDO
AdminDO updateAdmin = new AdminDO().setId(updateAdminId); AdminDO updateAdmin = new AdminDO().setId(updateAdminId);
updateAdmin.setDeleted(DeleteStatusEnum.DELETE_YES.getValue()); updateAdmin.setDeleted(DeletedStatusEnum.DELETED_YES.getValue());
adminMapper.update(updateAdmin); adminMapper.update(updateAdmin);
// 标记删除 AdminRole // 标记删除 AdminRole
adminRoleMapper.updateToDeletedByAdminId(updateAdminId); adminRoleMapper.updateToDeletedByAdminId(updateAdminId);
@ -190,7 +190,7 @@ public class AdminServiceImpl implements AdminService {
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()); roleResource.setCreateTime(new Date());
roleResource.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); roleResource.setDeleted(DeletedStatusEnum.DELETED_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.constant.DeleteStatusEnum; import cn.iocoder.common.framework.constant.DeletedStatusEnum;
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;
@ -42,7 +42,7 @@ public class DataDictServiceImpl implements DataDictService {
// 保存到数据库 // 保存到数据库
DataDictDO dataDict = DataDictConvert.INSTANCE.convert(dataDictAddDTO); DataDictDO dataDict = DataDictConvert.INSTANCE.convert(dataDictAddDTO);
dataDict.setCreateTime(new Date()); dataDict.setCreateTime(new Date());
dataDict.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); dataDict.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
dataDictMapper.insert(dataDict); dataDictMapper.insert(dataDict);
// TODO 插入操作日志 // TODO 插入操作日志
// 返回成功 // 返回成功
@ -80,7 +80,7 @@ public class DataDictServiceImpl implements DataDictService {
} }
// 更新到数据库 // 更新到数据库
DataDictDO updateDataDict = new DataDictDO().setId(dataDictId); DataDictDO updateDataDict = new DataDictDO().setId(dataDictId);
updateDataDict.setDeleted(DeleteStatusEnum.DELETE_YES.getValue()); updateDataDict.setDeleted(DeletedStatusEnum.DELETED_YES.getValue());
dataDictMapper.update(updateDataDict); dataDictMapper.update(updateDataDict);
// TODO 插入操作日志 // TODO 插入操作日志
// 返回成功 // 返回成功

View File

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

View File

@ -1,7 +1,6 @@
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.DeletedStatusEnum;
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;
@ -82,7 +81,7 @@ public class RoleServiceImpl implements RoleService {
// 保存到数据库 // 保存到数据库
RoleDO role = RoleConvert.INSTANCE.convert(roleAddDTO); RoleDO role = RoleConvert.INSTANCE.convert(roleAddDTO);
role.setCreateTime(new Date()); role.setCreateTime(new Date());
role.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); role.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
roleMapper.insert(role); roleMapper.insert(role);
// TODO 插入操作日志 // TODO 插入操作日志
// 返回成功 // 返回成功
@ -113,7 +112,7 @@ public class RoleServiceImpl implements RoleService {
} }
// 更新到数据库,标记删除 // 更新到数据库,标记删除
RoleDO roleDO = new RoleDO().setId(roleId); RoleDO roleDO = new RoleDO().setId(roleId);
roleDO.setDeleted(DeleteStatusEnum.DELETE_YES.getValue()); roleDO.setDeleted(DeletedStatusEnum.DELETED_YES.getValue());
roleMapper.update(roleDO); roleMapper.update(roleDO);
// 标记删除 RoleResource // 标记删除 RoleResource
roleResourceMapper.updateToDeletedByRoleId(roleId); roleResourceMapper.updateToDeletedByRoleId(roleId);
@ -144,7 +143,7 @@ public class RoleServiceImpl implements RoleService {
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()); roleResource.setCreateTime(new Date());
roleResource.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); roleResource.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
return roleResource; return roleResource;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
roleResourceMapper.insertList(roleResources); roleResourceMapper.insertList(roleResources);

View File

@ -15,7 +15,7 @@ package cn.iocoder.common.framework.constant;
* @author Sin * @author Sin
* @time 2019-03-23 11:28 * @time 2019-03-23 11:28
*/ */
public final class ModuleErrorCodeInterval { public class ModuleErrorCodeInterval {
// order 错误码区间 [1-000-001-000 ~ 1-000-002-000] // order 错误码区间 [1-000-001-000 ~ 1-000-002-000]

View File

@ -1,8 +1,7 @@
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.DeletedStatusEnum;
import cn.iocoder.common.framework.constant.SysErrorCodeEnum; import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
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;
@ -121,7 +120,7 @@ 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()); productAttrDO.setCreateTime(new Date());
productAttrDO.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); productAttrDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
productAttrMapper.insert(productAttrDO); productAttrMapper.insert(productAttrDO);
// 返回成功 // 返回成功
return CommonResult.success(ProductAttrConvert.INSTANCE.convert(productAttrDO)); return CommonResult.success(ProductAttrConvert.INSTANCE.convert(productAttrDO));
@ -177,7 +176,7 @@ 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()); productAttrValueDO.setCreateTime(new Date());
productAttrValueDO.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); productAttrValueDO.setDeleted(DeletedStatusEnum.DELETED_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,8 +1,7 @@
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.DeletedStatusEnum;
import cn.iocoder.common.framework.constant.SysErrorCodeEnum; import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
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;
@ -50,7 +49,7 @@ 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()); productCategory.setCreateTime(new Date());
productCategory.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); productCategory.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
productCategoryMapper.insert(productCategory); productCategoryMapper.insert(productCategory);
// TODO 操作日志 // TODO 操作日志
// 返回成功 // 返回成功
@ -118,7 +117,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
// 标记删除商品分类 // 标记删除商品分类
ProductCategoryDO updateProductCategory = new ProductCategoryDO() ProductCategoryDO updateProductCategory = new ProductCategoryDO()
.setId(productCategoryId); .setId(productCategoryId);
updateProductCategory.setDeleted(DeleteStatusEnum.DELETE_YES.getValue()); updateProductCategory.setDeleted(DeletedStatusEnum.DELETED_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.constant.DeleteStatusEnum; import cn.iocoder.common.framework.constant.DeletedStatusEnum;
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;
@ -92,7 +92,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
.setPicUrls(StringUtil.join(productSpuAddDTO.getPicUrls(), ",")) .setPicUrls(StringUtil.join(productSpuAddDTO.getPicUrls(), ","))
.setSort(0); // 排序为 0 .setSort(0); // 排序为 0
spu.setCreateTime(new Date()); spu.setCreateTime(new Date());
spu.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); spu.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
initSpuFromSkus(spu, productSpuAddDTO.getSkus()); // 初始化 sku 相关信息到 spu 中 initSpuFromSkus(spu, productSpuAddDTO.getSkus()); // 初始化 sku 相关信息到 spu 中
productSpuMapper.insert(spu); productSpuMapper.insert(spu);
// 保存 Sku // 保存 Sku
@ -102,7 +102,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
.setStatus(ProductSpuConstants.SKU_STATUS_ENABLE) .setStatus(ProductSpuConstants.SKU_STATUS_ENABLE)
.setAttrs(StringUtil.join(productSkuAddDTO.getAttrs(), ",")); .setAttrs(StringUtil.join(productSkuAddDTO.getAttrs(), ","));
sku.setCreateTime(new Date()); sku.setCreateTime(new Date());
sku.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); sku.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
return sku; return sku;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
// 校验 Sku 规格 // 校验 Sku 规格
@ -165,7 +165,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
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()); insertSku.setCreateTime(new Date());
insertSku.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); insertSku.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
insertSkus.add(insertSku); insertSkus.add(insertSku);
} }
// 2、多余的删除 // 2、多余的删除

View File

@ -1,6 +1,6 @@
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.DeletedStatusEnum;
import cn.iocoder.common.framework.constant.SysErrorCodeEnum; import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
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;
@ -52,7 +52,7 @@ 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()); userDO.setCreateTime(new Date());
userDO.setDeleted(DeleteStatusEnum.DELETE_NO.getValue()); userDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
userMapper.insert(userDO); userMapper.insert(userDO);
// 插入注册信息 // 插入注册信息
createUserRegister(userDO); createUserRegister(userDO);