更新
This commit is contained in:
parent
745d8a0dce
commit
06b65f40f6
@ -302,26 +302,32 @@ public class CmsCategoryServiceImpl extends ServiceImpl<CmsCategoryMapper, CmsCa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TreeVo> getLeavesCategoryTree() {
|
public List<TreeVo> getLeavesCategoryTree() {
|
||||||
List<CmsCategory> cmsCategories = baseMapper.selectList(new QueryWrapper<CmsCategory>());
|
List<CmsCategory> cmsCategories = baseMapper.selectList(new QueryWrapper<>());
|
||||||
List<CmsCategory> cmsCategories1 = buildCategoryTree(cmsCategories);
|
List<CmsCategory> cmsCategories1 = buildCategoryTree(cmsCategories);
|
||||||
List<TreeVo> treeVos = new ArrayList<>();
|
List<TreeVo> treeVos = new ArrayList<>();
|
||||||
|
|
||||||
for (CmsCategory cmsCategory : cmsCategories1) {
|
for (CmsCategory cmsCategory : cmsCategories1) {
|
||||||
TreeVo treeVo = new TreeVo();
|
TreeVo treeVo = new TreeVo();
|
||||||
treeVo.setLabel(cmsCategory.getCategoryName());
|
treeVo.setLabel(cmsCategory.getCategoryName());
|
||||||
treeVo.setValue(cmsCategory.getId().toString());
|
treeVo.setValue(cmsCategory.getId().toString());
|
||||||
List<TreeVo> children = new ArrayList<>();
|
List<TreeVo> children = new ArrayList<>();
|
||||||
cmsCategory.getChildren().forEach(cmsCategory1 -> {
|
|
||||||
TreeVo treeVo1 = new TreeVo();
|
if (cmsCategory.getChildren() != null && !cmsCategory.getChildren().isEmpty()) {
|
||||||
treeVo1.setLabel(cmsCategory1.getCategoryName());
|
for (CmsCategory cmsCategory1 : cmsCategory.getChildren()) {
|
||||||
treeVo1.setValue(cmsCategory1.getId().toString());
|
TreeVo treeVo1 = new TreeVo();
|
||||||
children.add(treeVo1);
|
treeVo1.setLabel(cmsCategory1.getCategoryName());
|
||||||
});
|
treeVo1.setValue(cmsCategory1.getId().toString());
|
||||||
|
children.add(treeVo1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
treeVo.setChildren(children);
|
treeVo.setChildren(children);
|
||||||
treeVos.add(treeVo);
|
treeVos.add(treeVo); // 确保即使没有子分类,也要添加进去
|
||||||
}
|
}
|
||||||
return treeVos;
|
return treeVos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将栏目列表转换为树形结构
|
* 将栏目列表转换为树形结构
|
||||||
*
|
*
|
||||||
|
|||||||
@ -120,5 +120,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertBatchDictData">
|
||||||
|
insert into sys_dict_data(
|
||||||
|
dict_sort,
|
||||||
|
dict_label,
|
||||||
|
dict_value,
|
||||||
|
dict_type,
|
||||||
|
create_time
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="dictDatas" item="dictData" separator=",">
|
||||||
|
(
|
||||||
|
<if test="dictData.dictSort != null">#{dictData.dictSort},</if>
|
||||||
|
<if test="dictData.dictLabel != null and dictData.dictLabel != ''">#{dictData.dictLabel},</if>
|
||||||
|
<if test="dictData.dictValue != null and dictData.dictValue != ''">#{dictData.dictValue},</if>
|
||||||
|
<if test="dictData.dictType != null and dictData.dictType != ''">#{dictData.dictType},</if>
|
||||||
|
<if test="dictData.cssClass != null and dictData.cssClass != ''">#{dictData.cssClass},</if>
|
||||||
|
<if test="dictData.listClass != null and dictData.listClass != ''">#{dictData.listClass},</if>
|
||||||
|
<if test="dictData.isDefault != null and dictData.isDefault != ''">#{dictData.isDefault},</if>
|
||||||
|
<if test="dictData.status != null">#{dictData.status},</if>
|
||||||
|
<if test="dictData.remark != null and dictData.remark != ''">#{dictData.remark},</if>
|
||||||
|
<if test="dictData.createBy != null and dictData.createBy != ''">#{dictData.createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -384,6 +384,7 @@ export default {
|
|||||||
getContentById(contentId) {
|
getContentById(contentId) {
|
||||||
getContent(contentId).then(res => {
|
getContent(contentId).then(res => {
|
||||||
this.form = res.data
|
this.form = res.data
|
||||||
|
this.form.selectCategoryId = this.form.categoryId
|
||||||
this.listLeavesCategory(this.form.categoryId)
|
this.listLeavesCategory(this.form.categoryId)
|
||||||
this.isType = this.form.contentType
|
this.isType = this.form.contentType
|
||||||
this.linkType = this.form.linkType
|
this.linkType = this.form.linkType
|
||||||
|
|||||||
@ -357,7 +357,7 @@ export default {
|
|||||||
|
|
||||||
.about-conts .about-conts-item1 {
|
.about-conts .about-conts-item1 {
|
||||||
padding: 30px 2%;
|
padding: 30px 2%;
|
||||||
width: 76%;
|
width: 84%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
z-index: 999 !important;
|
z-index: 999 !important;
|
||||||
|
|||||||
@ -206,7 +206,7 @@ export default {
|
|||||||
getCategoryByParentId(this.routeParam.categoryId).then(res => {
|
getCategoryByParentId(this.routeParam.categoryId).then(res => {
|
||||||
this.nav = res.data
|
this.nav = res.data
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.categoryId = this.nav[1].id
|
this.categoryId = this.nav[this.currentActive].id
|
||||||
})
|
})
|
||||||
if (this.currentActive != 0) {
|
if (this.currentActive != 0) {
|
||||||
this.getContentDetail()
|
this.getContentDetail()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user