|
@@ -32,6 +32,7 @@ public class ProductClassifyServiceImpl extends ServiceImpl<ProductClassifyMappe
|
|
|
|
|
|
List<ProductClassify> list = lambdaQuery()
|
|
List<ProductClassify> list = lambdaQuery()
|
|
.select(ProductClassify::getId, ProductClassify::getName, ProductClassify::getParentId)
|
|
.select(ProductClassify::getId, ProductClassify::getName, ProductClassify::getParentId)
|
|
|
|
+ .eq(ProductClassify::getDefinition, productClassify.getDefinition())
|
|
.like(ObjectUtil.isNotEmpty(name), ProductClassify::getName, name)
|
|
.like(ObjectUtil.isNotEmpty(name), ProductClassify::getName, name)
|
|
.list();
|
|
.list();
|
|
|
|
|
|
@@ -60,14 +61,14 @@ public class ProductClassifyServiceImpl extends ServiceImpl<ProductClassifyMappe
|
|
productClassifyDto.setParentIdSet((ObjectUtil.isEmpty(parentIdSet) ? "" : parentIdSet + ",") + parentId);
|
|
productClassifyDto.setParentIdSet((ObjectUtil.isEmpty(parentIdSet) ? "" : parentIdSet + ",") + parentId);
|
|
}
|
|
}
|
|
|
|
|
|
- peerNameOnly(productClassifyDto.getParentId(), productClassifyDto.getName(), null);
|
|
|
|
|
|
+ peerNameOnly(productClassifyDto.getDefinition(), productClassifyDto.getParentId(), productClassifyDto.getName(), null);
|
|
|
|
|
|
this.save(productClassifyDto);
|
|
this.save(productClassifyDto);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void edit(ProductClassifyDto productClassifyDto) {
|
|
public void edit(ProductClassifyDto productClassifyDto) {
|
|
- peerNameOnly(productClassifyDto.getParentId(), productClassifyDto.getName(), productClassifyDto.getId());
|
|
|
|
|
|
+ peerNameOnly(productClassifyDto.getDefinition(), productClassifyDto.getParentId(), productClassifyDto.getName(), productClassifyDto.getId());
|
|
this.updateById(productClassifyDto);
|
|
this.updateById(productClassifyDto);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -79,11 +80,12 @@ public class ProductClassifyServiceImpl extends ServiceImpl<ProductClassifyMappe
|
|
/**
|
|
/**
|
|
* 保证同级名称不重复
|
|
* 保证同级名称不重复
|
|
*/
|
|
*/
|
|
- private void peerNameOnly(Long parentId, String classifyName, Long excludeId) {
|
|
|
|
|
|
+ private void peerNameOnly(Integer type, Long parentId, String classifyName, Long excludeId) {
|
|
|
|
|
|
Long count = lambdaQuery()
|
|
Long count = lambdaQuery()
|
|
.eq(ProductClassify::getParentId, parentId)
|
|
.eq(ProductClassify::getParentId, parentId)
|
|
.eq(ProductClassify::getName, classifyName)
|
|
.eq(ProductClassify::getName, classifyName)
|
|
|
|
+ .eq(ProductClassify::getDefinition, type)
|
|
.ne(ObjectUtil.isNotEmpty(excludeId), ProductClassify::getId, excludeId)
|
|
.ne(ObjectUtil.isNotEmpty(excludeId), ProductClassify::getId, excludeId)
|
|
.count();
|
|
.count();
|
|
|
|
|