|
@@ -8,7 +8,6 @@ import com.fjhx.entity.Material;
|
|
import com.fjhx.entity.Product;
|
|
import com.fjhx.entity.Product;
|
|
import com.fjhx.enums.ClassifyTypeEnum;
|
|
import com.fjhx.enums.ClassifyTypeEnum;
|
|
import com.fjhx.mapper.ClassifyMapper;
|
|
import com.fjhx.mapper.ClassifyMapper;
|
|
-import com.fjhx.params.ClassifyVo;
|
|
|
|
import com.fjhx.service.ClassifyService;
|
|
import com.fjhx.service.ClassifyService;
|
|
import com.fjhx.service.MaterialService;
|
|
import com.fjhx.service.MaterialService;
|
|
import com.fjhx.service.ProductService;
|
|
import com.fjhx.service.ProductService;
|
|
@@ -59,17 +58,17 @@ public class ClassifyServiceImpl extends ServiceImpl<ClassifyMapper, Classify> i
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void add(ClassifyVo classifyVo) {
|
|
|
|
|
|
+ public void add(Classify classify) {
|
|
|
|
|
|
- Assert.notEmpty(classifyVo.getType(), "分类类型不能为空");
|
|
|
|
- Assert.notEmpty(classifyVo.getName(), "分类名称不能为空");
|
|
|
|
|
|
+ Assert.notEmpty(classify.getType(), "分类类型不能为空");
|
|
|
|
+ Assert.notEmpty(classify.getName(), "分类名称不能为空");
|
|
|
|
|
|
- Long parentId = classifyVo.getParentId();
|
|
|
|
|
|
+ Long parentId = classify.getParentId();
|
|
if (parentId == null) {
|
|
if (parentId == null) {
|
|
- classifyVo.setParentId(0L);
|
|
|
|
- classifyVo.setParentIdSet(null);
|
|
|
|
|
|
+ classify.setParentId(0L);
|
|
|
|
+ classify.setParentIdSet(null);
|
|
} else if (parentId == 0L) {
|
|
} else if (parentId == 0L) {
|
|
- classifyVo.setParentIdSet(null);
|
|
|
|
|
|
+ classify.setParentIdSet(null);
|
|
} else {
|
|
} else {
|
|
// 查询父级分类
|
|
// 查询父级分类
|
|
Classify parentClassify = getById(parentId);
|
|
Classify parentClassify = getById(parentId);
|
|
@@ -77,28 +76,28 @@ public class ClassifyServiceImpl extends ServiceImpl<ClassifyMapper, Classify> i
|
|
|
|
|
|
// 赋值父级id集合
|
|
// 赋值父级id集合
|
|
String parentIdSet = parentClassify.getParentIdSet();
|
|
String parentIdSet = parentClassify.getParentIdSet();
|
|
- classifyVo.setParentIdSet(
|
|
|
|
|
|
+ classify.setParentIdSet(
|
|
(ObjectUtil.isEmpty(parentIdSet) ? "" : parentIdSet + ",") + parentId);
|
|
(ObjectUtil.isEmpty(parentIdSet) ? "" : parentIdSet + ",") + parentId);
|
|
}
|
|
}
|
|
|
|
|
|
- peerNameOnly(classifyVo.getParentId(), classifyVo.getName(), null);
|
|
|
|
- save(classifyVo);
|
|
|
|
|
|
+ peerNameOnly(classify.getParentId(), classify.getName(), null);
|
|
|
|
+ save(classify);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void edit(ClassifyVo classifyVo) {
|
|
|
|
- Assert.notEmpty(classifyVo.getId(), "分类Id不能为空");
|
|
|
|
- Assert.notEmpty(classifyVo.getParentId(), "父分类id不能为空");
|
|
|
|
- Assert.notEmpty(classifyVo.getName(), "分类名称不能为空");
|
|
|
|
|
|
+ public void edit(Classify classify) {
|
|
|
|
+ Assert.notEmpty(classify.getId(), "分类Id不能为空");
|
|
|
|
+ Assert.notEmpty(classify.getParentId(), "父分类id不能为空");
|
|
|
|
+ Assert.notEmpty(classify.getName(), "分类名称不能为空");
|
|
|
|
|
|
- peerNameOnly(classifyVo.getParentId(), classifyVo.getName(), classifyVo.getId());
|
|
|
|
- updateById(classifyVo);
|
|
|
|
|
|
+ peerNameOnly(classify.getParentId(), classify.getName(), classify.getId());
|
|
|
|
+ updateById(classify);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void delete(ClassifyVo classifyVo) {
|
|
|
|
- Long id = classifyVo.getId();
|
|
|
|
- Integer type = classifyVo.getType();
|
|
|
|
|
|
+ public void delete(Classify classify) {
|
|
|
|
+ Long id = classify.getId();
|
|
|
|
+ Integer type = classify.getType();
|
|
|
|
|
|
Assert.notEmpty(id, "分类id不能为空");
|
|
Assert.notEmpty(id, "分类id不能为空");
|
|
Assert.notEmpty(type, "分类类型不能为空");
|
|
Assert.notEmpty(type, "分类类型不能为空");
|
|
@@ -114,7 +113,7 @@ public class ClassifyServiceImpl extends ServiceImpl<ClassifyMapper, Classify> i
|
|
Assert.eqZero(relationCount, "该分类下存在物料,无法删除");
|
|
Assert.eqZero(relationCount, "该分类下存在物料,无法删除");
|
|
}
|
|
}
|
|
|
|
|
|
- removeById(classifyVo.getId());
|
|
|
|
|
|
+ removeById(classify.getId());
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|