| | |
| | | */ |
| | | package org.springblade.modules.category.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.node.TreeIntegerNode; |
| | | import org.springblade.common.utils.NodeTreeUtil; |
| | | import org.springblade.modules.category.dto.CategoryDTO; |
| | | import org.springblade.modules.category.entity.CategoryEntity; |
| | | import org.springblade.modules.category.excel.CategoryExcel; |
| | | import org.springblade.modules.category.vo.CategoryVO; |
| | | import org.springblade.modules.category.mapper.CategoryMapper; |
| | | import org.springblade.modules.category.service.ICategoryService; |
| | |
| | | node.setChildren(null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 标签导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | public void importCategory(List<CategoryExcel> data, Boolean isCovered) { |
| | | for (CategoryExcel categoryExcel : data) { |
| | | // 查询是否已存在 |
| | | QueryWrapper<CategoryEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("category_no",categoryExcel.getCategoryNo()).eq("is_deleted",0); |
| | | CategoryEntity one = getOne(wrapper); |
| | | if (null==one){ |
| | | // 新增 |
| | | CategoryEntity categoryEntity = new CategoryEntity(); |
| | | categoryEntity.setCategoryNo(categoryExcel.getCategoryNo()); |
| | | categoryEntity.setCategoryName(categoryExcel.getCategoryName()); |
| | | categoryEntity.setLevel(categoryExcel.getLevel()); |
| | | categoryEntity.setIsDeleted(0); |
| | | categoryEntity.setParentNo(categoryExcel.getCategoryNo().substring(0,4)); |
| | | categoryEntity.setDescription(categoryExcel.getDescription()); |
| | | categoryEntity.setRemark(categoryExcel.getRemark()); |
| | | // 新增 |
| | | save(categoryEntity); |
| | | } |
| | | } |
| | | } |
| | | } |