|
|
@ -27,6 +27,7 @@ import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.TreeUtils; |
|
|
|
import com.elink.esua.epdc.dto.category.CategoryDTO; |
|
|
|
import com.elink.esua.epdc.modules.category.dao.CategoryDao; |
|
|
|
import com.elink.esua.epdc.modules.category.entity.CategoryEntity; |
|
|
@ -54,7 +55,10 @@ public class CategoryServiceImpl extends BaseServiceImpl<CategoryDao, CategoryEn |
|
|
|
@Override |
|
|
|
public List<CategoryDTO> list(Map<String, Object> params) { |
|
|
|
List<CategoryEntity> entityList = baseDao.getList(params); |
|
|
|
return ConvertUtils.sourceToTarget(entityList, CategoryDTO.class); |
|
|
|
|
|
|
|
List<CategoryDTO> dtoList = ConvertUtils.sourceToTarget(entityList, CategoryDTO.class); |
|
|
|
|
|
|
|
return TreeUtils.build(dtoList); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -150,6 +154,7 @@ public class CategoryServiceImpl extends BaseServiceImpl<CategoryDao, CategoryEn |
|
|
|
wrapper.eq("category_code", dto.getCategoryCode()); |
|
|
|
Long id = dto.getId(); |
|
|
|
wrapper.ne(id!=null, "id", dto.getId()); |
|
|
|
wrapper.eq("del_flag","0"); |
|
|
|
return baseDao.selectCount(wrapper); |
|
|
|
} |
|
|
|
|
|
|
@ -194,14 +199,17 @@ public class CategoryServiceImpl extends BaseServiceImpl<CategoryDao, CategoryEn |
|
|
|
if (subList.size() > 1) { |
|
|
|
throw new RenException(ErrorCode.DEPT_SUB_DELETE_ERROR); |
|
|
|
} |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(new Long[]{id})); |
|
|
|
|
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
logicDelete(new Long[]{id}, CategoryEntity.class); |
|
|
|
//logicDelete(new Long[]{id}, CategoryEntity.class);
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Long> getSubCategoryIdList(Long id) { |
|
|
|
List<Long> subCategoryIdList = baseDao.getSubCategoryIdList("%" + id + "%"); |
|
|
|
subCategoryIdList.add(id); |
|
|
|
return subCategoryIdList; |
|
|
|
} |
|
|
|
} |
|
|
|