...
This commit is contained in:
parent
a00007992a
commit
49bf48472a
|
@ -15,6 +15,7 @@ import io.renren.modules.resource.dao.ResourceDao;
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.renren.modules.resource.entity.AttrEntity;
|
import io.renren.modules.resource.entity.AttrEntity;
|
||||||
import io.renren.modules.resource.entity.ResourceEntity;
|
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.resource.service.ResourceService;
|
||||||
import io.renren.modules.resourceCar.dao.ResourceCarDao;
|
import io.renren.modules.resourceCar.dao.ResourceCarDao;
|
||||||
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
|
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
|
||||||
|
@ -72,13 +73,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// wrapper.eq("type", params.get("type").toString())
|
|
||||||
// .like(StringUtils.isNotBlank(params.get("name").toString()),"name", params.get("name").toString())
|
|
||||||
// .orderByDesc("create_date")
|
|
||||||
// .eq(StringUtils.isNotBlank(params.get("creator").toString()),"creator", params.get("creator").toString())
|
|
||||||
// .eq("del_flag", 0);
|
|
||||||
wrapper.orderByDesc("create_date");
|
wrapper.orderByDesc("create_date");
|
||||||
if (!params.containsKey("creator")) {
|
if (!params.containsKey("creator")) { // 创建者查询时
|
||||||
wrapper.eq("del_flag", params.get("del_flag") == null ? 0 : Integer.valueOf(params.get("del_flag").toString()));
|
wrapper.eq("del_flag", params.get("del_flag") == null ? 0 : Integer.valueOf(params.get("del_flag").toString()));
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
|
@ -92,7 +88,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
Long resourceID = IdWorker.getId(resourceEntity);
|
Long resourceID = IdWorker.getId(resourceEntity);
|
||||||
resourceEntity.setId(resourceID);
|
resourceEntity.setId(resourceID);
|
||||||
if (dto.getDelFlag() == null) {
|
if (dto.getDelFlag() == null) {
|
||||||
resourceEntity.setDelFlag(0);
|
resourceEntity.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
|
||||||
}
|
}
|
||||||
resourceDao.insert(resourceEntity);
|
resourceDao.insert(resourceEntity);
|
||||||
|
|
||||||
|
@ -100,7 +96,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
|
|
||||||
List<AttrEntity> attrEntities = dto.getInfoList();
|
List<AttrEntity> attrEntities = dto.getInfoList();
|
||||||
attrEntities.forEach(item -> {
|
attrEntities.forEach(item -> {
|
||||||
item.setDelFlag(0);
|
item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
|
||||||
item.setDataResourceId(resourceID);
|
item.setDataResourceId(resourceID);
|
||||||
attrDao.insert(item);
|
attrDao.insert(item);
|
||||||
});
|
});
|
||||||
|
@ -130,7 +126,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
attrDao.delete4Resource(list);
|
attrDao.delete4Resource(list);
|
||||||
List<AttrEntity> attrEntities = dto.getInfoList();
|
List<AttrEntity> attrEntities = dto.getInfoList();
|
||||||
attrEntities.forEach(item -> {
|
attrEntities.forEach(item -> {
|
||||||
item.setDelFlag(0);
|
item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
|
||||||
attrDao.insert(item);
|
attrDao.insert(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -144,7 +140,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
}
|
}
|
||||||
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq("data_resource_id", id)
|
wrapper.eq("data_resource_id", id)
|
||||||
.eq("del_flag", 0);
|
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
|
||||||
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
|
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
|
||||||
resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe?
|
resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe?
|
||||||
return resourceDTO;
|
return resourceDTO;
|
||||||
|
@ -189,7 +185,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
public List<AttrEntity> selectAttrsByResourceId(Long resourceId) {
|
public List<AttrEntity> selectAttrsByResourceId(Long resourceId) {
|
||||||
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq("data_resource_id", resourceId)
|
wrapper.eq("data_resource_id", resourceId)
|
||||||
.eq("del_flag", 0)
|
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
|
||||||
.orderByDesc("attr_type");
|
.orderByDesc("attr_type");
|
||||||
return attrDao.selectList(wrapper);
|
return attrDao.selectList(wrapper);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +208,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.orderByDesc("create_date")
|
queryWrapper.orderByDesc("create_date")
|
||||||
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
|
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
|
||||||
.eq("del_flag", 0);
|
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
|
||||||
IPage<ResourceEntity> entityIPage = resourceDao.selectPage(page, queryWrapper);
|
IPage<ResourceEntity> entityIPage = resourceDao.selectPage(page, queryWrapper);
|
||||||
return entityIPage;
|
return entityIPage;
|
||||||
|
|
||||||
|
@ -225,7 +221,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
List<ResourceDTO> resourceDTOS = resourceDao.selectMostPopular(selectMap);
|
List<ResourceDTO> resourceDTOS = resourceDao.selectMostPopular(selectMap);
|
||||||
page.setRecords(resourceDTOS);
|
page.setRecords(resourceDTOS);
|
||||||
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ResourceEntity> 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);
|
Integer count = resourceDao.selectCount(queryWrapper);
|
||||||
page.setTotal(count);
|
page.setTotal(count);
|
||||||
return page;
|
return page;
|
||||||
|
@ -239,7 +235,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
UpdateWrapper<ResourceEntity> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<ResourceEntity> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.lambda()
|
updateWrapper.lambda()
|
||||||
.eq(ResourceEntity::getId, resourceEntity.getId())
|
.eq(ResourceEntity::getId, resourceEntity.getId())
|
||||||
.eq(ResourceEntity::getDelFlag, 0);
|
.eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
|
||||||
resourceDao.update(entity, updateWrapper);
|
resourceDao.update(entity, updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue