|
|
|
@ -201,6 +201,10 @@ public class AttrServiceImpl extends ServiceImpl<AttrDao, AttrEntity> implements
|
|
|
|
|
return attr.getAttrId();
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
if (attrIds==null || attrIds.size()==0) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查找返回同一组属性
|
|
|
|
|
Collection<AttrEntity> attrEntities = this.listByIds(attrIds);
|
|
|
|
|
|
|
|
|
@ -208,4 +212,52 @@ public class AttrServiceImpl extends ServiceImpl<AttrDao, AttrEntity> implements
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* @Description: 获取当前分组没有关联的所有属性
|
|
|
|
|
* @param:
|
|
|
|
|
* @return:
|
|
|
|
|
* @Author:
|
|
|
|
|
* @date:
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public PageUtils getNoRelationAttr(Map<String, Object> params, Long attrgroupId) {
|
|
|
|
|
//当前分组只能获取自己所属的分类里面所有属性
|
|
|
|
|
AttrGroupEntity attrGroupEntity = attrGroupDao.selectById(attrgroupId);
|
|
|
|
|
//获取分类id
|
|
|
|
|
Long catelogId = attrGroupEntity.getCatelogId();
|
|
|
|
|
//筛选出其他分组
|
|
|
|
|
List<AttrGroupEntity> groupEntities = attrGroupDao.selectList(
|
|
|
|
|
new QueryWrapper<AttrGroupEntity>().eq("catelog_id", catelogId).ne("attr_group_id", attrgroupId));
|
|
|
|
|
List<Long> collect = groupEntities.stream().map((entity) -> {
|
|
|
|
|
return entity.getAttrGroupId();
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
//这些分组的属性
|
|
|
|
|
List<AttrAttrgroupRelationEntity> relationEntities = RelationDao.selectList(
|
|
|
|
|
new QueryWrapper<AttrAttrgroupRelationEntity>().in("attr_group_id", collect));
|
|
|
|
|
List<Long> attrIds = relationEntities.stream().map((entity) -> {
|
|
|
|
|
return entity.getAttrId();
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//从当前分类的所有属性中移除这些属性
|
|
|
|
|
//条件
|
|
|
|
|
QueryWrapper<AttrEntity> queryWrapper = new QueryWrapper<AttrEntity>().eq("catelog_id", catelogId).eq(
|
|
|
|
|
"attr_type",ProductConstant.AttrEnum.ATTR_TYPE_BASE.getCode() );
|
|
|
|
|
//关键字查找
|
|
|
|
|
String key = (String) params.get("key");
|
|
|
|
|
if (!StringUtils.isNullOrEmpty(key)) {
|
|
|
|
|
queryWrapper.and((wrapper)->{
|
|
|
|
|
wrapper.eq("attr_id", key).or().like("attr_name", key);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (attrIds !=null && attrIds.size() > 0) {
|
|
|
|
|
queryWrapper.notIn("attr_id", attrIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//分页查询
|
|
|
|
|
IPage<AttrEntity> page = this.page(new Query<AttrEntity>().getPage(params), queryWrapper);
|
|
|
|
|
PageUtils pageUtils = new PageUtils(page);
|
|
|
|
|
return pageUtils;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|