分类选择

This commit is contained in:
zhujunjieit 2019-01-23 00:09:16 +08:00
parent 5b6fc219e3
commit 5e8e5d1bc7
2 changed files with 10 additions and 4 deletions

View File

@ -67,11 +67,17 @@ public class CmsController {
Long parentId = new Long( parentIds.split( "," )[2] );
courseCategory.setParentId( parentId );
courseCategories2 = trainCourseCategoryService.selectCategoryList( courseCategory );
map.put( "selectCategoryId1",parentId);
}
if (StrUtil.isNotBlank( parentIds ) && parentIds.split( "," ).length >= 4) {//三级分类
Long parentId = new Long( parentIds.split( "," )[3] );
courseCategory.setParentId( parentId );
courseCategories3 = trainCourseCategoryService.selectCategoryList( courseCategory );
//当前选中的分类id
map.put( "selectCategoryId2",parentId);
Long parentId1 = new Long( parentIds.split( "," )[2] );
map.put( "selectCategoryId1",parentId1);
}
if (StrUtil.isNotBlank( parentIds )) {
trainCourseVO.setTrainCourseCategoryId( new Integer( parentIds.split( "," )[parentIds.split( "," ).length - 1] ) );

View File

@ -203,12 +203,12 @@
<li field="classid"><span>选择分类:</span>
<a th:href="@{/web}" th:class="${#strings.isEmpty(selectCategoryId)}?'curr':''">不限</a>
<a th:each="category:${courseCategories1}" th:href="@{'/web?parentIds='+${category.parentIds}+','+${category.id}}" th:text="${category.name}"
th:class="${category.id}==${selectCategoryId}?'curr':''"></a>
th:class="${category.id==selectCategoryId||category.id==selectCategoryId1}?'curr':''"></a>
</li>
<li field="classid"><span>选择分类:</span>
<a th:if="${#lists.size(courseCategories3)}>0" th:href="@{'/web?parentIds='+${courseCategories2[0].parentIds}}">不限</a>
<a th:if="${#lists.size(courseCategories3)}==0" th:href="@{'/web'}">不限</a>
<a th:each="category:${courseCategories2}" th:href="@{'/web?parentIds='+${category.parentIds}+','+${category.id}}" th:text="${category.name}" th:class="${category.id}==${selectCategoryId}?'curr':''"></a>
<a th:if="${#lists.size(courseCategories2)}>0" th:href="@{'/web?parentIds='+${courseCategories2[0].parentIds}}">不限</a>
<a th:if="${#lists.size(courseCategories2)}==0" th:href="@{'/web'}">不限</a>
<a th:each="category:${courseCategories2}" th:href="@{'/web?parentIds='+${category.parentIds}+','+${category.id}}" th:text="${category.name}" th:class="${category.id==selectCategoryId||category.id==selectCategoryId2}?'curr':''"></a>
</li>
<li field="classid"><span>选择分类:</span>