修改常量
This commit is contained in:
@ -53,4 +53,14 @@ public interface CoscoCategoryConstant {
|
|||||||
* 最高级 0
|
* 最高级 0
|
||||||
*/
|
*/
|
||||||
public static final String LEVEL_TOP = "0";
|
public static final String LEVEL_TOP = "0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 类型(0.分类、1.品类)
|
||||||
|
* */
|
||||||
|
public static final Long CATEGORY_TYPE_CATEGORY = 0L;
|
||||||
|
/**
|
||||||
|
* * 类型(0.分类、1.品类)
|
||||||
|
* */
|
||||||
|
public static final Long CATEGORY_TYPE_CATEGORY_TYPE = 1L;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
|||||||
coscoCategory.setId(PropertyUtils.getSnowflakeId());
|
coscoCategory.setId(PropertyUtils.getSnowflakeId());
|
||||||
if (!coscoCategory.getParentId().equals(CoscoCategoryConstant.LEVEL_TOP)) {
|
if (!coscoCategory.getParentId().equals(CoscoCategoryConstant.LEVEL_TOP)) {
|
||||||
CoscoCategory coscoCategory1 = coscoCategoryMapper.selectCoscoCategoryById(coscoCategory.getParentId());
|
CoscoCategory coscoCategory1 = coscoCategoryMapper.selectCoscoCategoryById(coscoCategory.getParentId());
|
||||||
if (coscoCategory1.getType().equals(1L)) {
|
if (coscoCategory1.getType().equals(CoscoCategoryConstant.CATEGORY_TYPE_CATEGORY_TYPE)) {
|
||||||
throw new RuntimeException(ErrorMessageConstant.ENABLE_DISABLE_TEMPLATE_NOT_MODIFY);
|
throw new RuntimeException(ErrorMessageConstant.ENABLE_DISABLE_TEMPLATE_NOT_MODIFY);
|
||||||
}
|
}
|
||||||
coscoCategory.setAncestors(coscoCategory1.getAncestors() + "," + coscoCategory.getId());
|
coscoCategory.setAncestors(coscoCategory1.getAncestors() + "," + coscoCategory.getId());
|
||||||
@ -87,7 +87,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
|||||||
@Override
|
@Override
|
||||||
public int updateCoscoCategory(CoscoCategory coscoCategory) {
|
public int updateCoscoCategory(CoscoCategory coscoCategory) {
|
||||||
coscoCategory.setUpdateTime(new Date());
|
coscoCategory.setUpdateTime(new Date());
|
||||||
coscoCategory.setUpdateBy("1");
|
coscoCategory.setUpdateBy(SupplierUserConstant.USER_NAME);
|
||||||
return coscoCategoryMapper.updateCoscoCategory(coscoCategory);
|
return coscoCategoryMapper.updateCoscoCategory(coscoCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
|||||||
* 获取全部上级部门id
|
* 获取全部上级部门id
|
||||||
*/
|
*/
|
||||||
List<String> deptIds = new ArrayList<>();
|
List<String> deptIds = new ArrayList<>();
|
||||||
deptIds.add("dep01");
|
deptIds.add(SupplierUserConstant.DEPT_ID);
|
||||||
coscoCategory.setDeptIds(deptIds);
|
coscoCategory.setDeptIds(deptIds);
|
||||||
return selectCategoryTree(coscoCategory);
|
return selectCategoryTree(coscoCategory);
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
|||||||
private List<CoscoCategoryVO> buildTree(List<CoscoCategoryVO> categories) {
|
private List<CoscoCategoryVO> buildTree(List<CoscoCategoryVO> categories) {
|
||||||
// 获取所有顶级节点 (parentId = "0")
|
// 获取所有顶级节点 (parentId = "0")
|
||||||
List<CoscoCategoryVO> rootNodes = categories.stream()
|
List<CoscoCategoryVO> rootNodes = categories.stream()
|
||||||
.filter(c -> "0".equals(c.getParentId()))
|
.filter(c -> CoscoCategoryConstant.LEVEL_TOP.equals(c.getParentId()))
|
||||||
.map(this::convertToTreeDto)
|
.map(this::convertToTreeDto)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user