| | |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } |
| | | |
| | | // 二级分类 |
| | | Tag secTag = tagService.selectOne(new EntityWrapper<Tag>().eq("memo", tag.getItemClassId())); |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | | nodeUtils.executePath(priTag.getId()); |
| | | if (secTag == null) { |
| | | secTag = new Tag( |
| | | null, // 编号 |
| | | tag.getName(), // 名称 |
| | | priTag.getId(), // 父级 |
| | | priTag.getName(), // 父级名称 |
| | | nodeUtils.path.toString(), // 关联路径 |
| | | nodeUtils.pathName.toString(), // 关联路径名 |
| | | 0, // 类型 |
| | | null, // 负责人 |
| | | null, // 图片 |
| | | null, // 简要描述 |
| | | null, // 数量 |
| | | 2, // 等级 |
| | | null, // 排序 |
| | | 1, // 状态 |
| | | now, // 添加时间 |
| | | null, // 添加人员 |
| | | now, // 修改时间 |
| | | null, // 修改人员 |
| | | tag.getItemClassId() // 备注 |
| | | ); |
| | | if (tagMapper.insert(secTag) == 0) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | }else { |
| | | secTag.setName(tag.getName()); |
| | | secTag.setParentId(priTag.getId()); |
| | | secTag.setParentName(priTag.getName()); |
| | | secTag.setPath(nodeUtils.path.toString()); |
| | | secTag.setPathName(nodeUtils.pathName.toString()); |
| | | if (tagMapper.updateById(secTag) == 0) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | |
| | | List<Tag> tags = tagService.selectList(new EntityWrapper<Tag>().eq("parent_id", secTag.getId())); |
| | | if (!Cools.isEmpty(tags)) { |
| | | for (Tag tag1 : tags) { |
| | | tag1.setPath(nodeUtils.path.toString()+","+secTag.getId()); |
| | | tag1.setPathName(nodeUtils.pathName.toString()+","+secTag.getName()); |
| | | if (tagMapper.updateById(tag1) == 0) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |