后管-线上课、资源:选择分类、部门递归查询该子类、子部门数据

This commit is contained in:
wsw
2024-05-30 14:44:03 +08:00
parent 8beae72101
commit eb02def070
11 changed files with 165 additions and 69 deletions

View File

@@ -56,4 +56,6 @@ public interface CategoryService extends IService<Category> {
Map<Integer, String> id2name();
Long total();
List<Category> getChildCategorysByParentId(Integer parentId);
}

View File

@@ -68,4 +68,6 @@ public interface DepartmentService extends IService<Department> {
Integer createWithChainList(List<String> ou);
Department findByName(String name, Integer parentId);
List<Department> getChildDepartmentsByParentId(Integer parentId);
}

View File

@@ -224,4 +224,13 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category>
public Long total() {
return count();
}
@Override
public List<Category> getChildCategorysByParentId(Integer parentId) {
return list(
query().getWrapper()
.eq("parent_id", parentId)
.or()
.likeRight("parent_chain", parentId + ","));
}
}

View File

@@ -293,4 +293,13 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
public Department findByName(String name, Integer parentId) {
return getOne(query().getWrapper().eq("name", name).eq("parent_id", parentId));
}
@Override
public List<Department> getChildDepartmentsByParentId(Integer parentId) {
return list(
query().getWrapper()
.eq("parent_id", parentId)
.or()
.likeRight("parent_chain", parentId + ","));
}
}

View File

@@ -17,6 +17,8 @@ package xyz.playedu.common.types.paginate;
import lombok.Data;
import java.util.List;
/**
* @Author 杭州白书科技有限公司
*
@@ -27,9 +29,9 @@ public class CoursePaginateFiler {
private String title;
private String depIds;
private List<Integer> depIds;
private String categoryIds;
private List<Integer> categoryIds;
private Integer isRequired;

View File

@@ -17,6 +17,8 @@ package xyz.playedu.common.types.paginate;
import lombok.Data;
import java.util.List;
/**
* @Author 杭州白书科技有限公司
*
@@ -35,7 +37,7 @@ public class ResourcePaginateFilter {
private String sortAlgo;
private String categoryIds;
private List<Integer> categoryIds;
private String type;