diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 2dd7d33b..84be6859 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -15,6 +15,7 @@ import io.renren.modules.resource.dao.ResourceDao; import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.entity.AttrEntity; import io.renren.modules.resource.entity.ResourceEntity; +import io.renren.modules.resource.entity.ResourceEntityDelFlag; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resourceCar.dao.ResourceCarDao; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; @@ -72,13 +73,8 @@ public class ResourceServiceImpl extends CrudServiceImpl attrEntities = dto.getInfoList(); attrEntities.forEach(item -> { - item.setDelFlag(0); + item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); item.setDataResourceId(resourceID); attrDao.insert(item); }); @@ -130,7 +126,7 @@ public class ResourceServiceImpl extends CrudServiceImpl attrEntities = dto.getInfoList(); attrEntities.forEach(item -> { - item.setDelFlag(0); + item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); attrDao.insert(item); }); } @@ -144,7 +140,7 @@ public class ResourceServiceImpl extends CrudServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq("data_resource_id", id) - .eq("del_flag", 0); + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); List attrEntities = attrDao.selectList(wrapper); resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe? return resourceDTO; @@ -189,7 +185,7 @@ public class ResourceServiceImpl extends CrudServiceImpl selectAttrsByResourceId(Long resourceId) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("data_resource_id", resourceId) - .eq("del_flag", 0) + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()) .orderByDesc("attr_type"); return attrDao.selectList(wrapper); } @@ -212,7 +208,7 @@ public class ResourceServiceImpl extends CrudServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("create_date") .eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")) - .eq("del_flag", 0); + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); IPage entityIPage = resourceDao.selectPage(page, queryWrapper); return entityIPage; @@ -225,7 +221,7 @@ public class ResourceServiceImpl extends CrudServiceImpl resourceDTOS = resourceDao.selectMostPopular(selectMap); page.setRecords(resourceDTOS); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("del_flag", 0).eq("type", jsonObject.getString("type")); + queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).eq("type", jsonObject.getString("type")); Integer count = resourceDao.selectCount(queryWrapper); page.setTotal(count); return page; @@ -239,7 +235,7 @@ public class ResourceServiceImpl extends CrudServiceImpl updateWrapper = new UpdateWrapper<>(); updateWrapper.lambda() .eq(ResourceEntity::getId, resourceEntity.getId()) - .eq(ResourceEntity::getDelFlag, 0); + .eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag()); resourceDao.update(entity, updateWrapper); }