修改常量

This commit is contained in:
YY
2025-06-27 15:45:39 +08:00
parent f0bb3c6256
commit 5f9ba2eed8
2 changed files with 14 additions and 4 deletions

View File

@ -53,4 +53,14 @@ public interface CoscoCategoryConstant {
* 最高级 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;
}

View File

@ -67,7 +67,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
coscoCategory.setId(PropertyUtils.getSnowflakeId());
if (!coscoCategory.getParentId().equals(CoscoCategoryConstant.LEVEL_TOP)) {
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);
}
coscoCategory.setAncestors(coscoCategory1.getAncestors() + "," + coscoCategory.getId());
@ -87,7 +87,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
@Override
public int updateCoscoCategory(CoscoCategory coscoCategory) {
coscoCategory.setUpdateTime(new Date());
coscoCategory.setUpdateBy("1");
coscoCategory.setUpdateBy(SupplierUserConstant.USER_NAME);
return coscoCategoryMapper.updateCoscoCategory(coscoCategory);
}
@ -136,7 +136,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
* 获取全部上级部门id
*/
List<String> deptIds = new ArrayList<>();
deptIds.add("dep01");
deptIds.add(SupplierUserConstant.DEPT_ID);
coscoCategory.setDeptIds(deptIds);
return selectCategoryTree(coscoCategory);
}
@ -154,7 +154,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
private List<CoscoCategoryVO> buildTree(List<CoscoCategoryVO> categories) {
// 获取所有顶级节点 (parentId = "0")
List<CoscoCategoryVO> rootNodes = categories.stream()
.filter(c -> "0".equals(c.getParentId()))
.filter(c -> CoscoCategoryConstant.LEVEL_TOP.equals(c.getParentId()))
.map(this::convertToTreeDto)
.collect(Collectors.toList());