1、前端icon以图标显示

2、属性分组查出分类名称显示出来
pull/254/head
xjs 4 years ago
parent a15ed1f2d1
commit 627af3e26f

@ -40,8 +40,13 @@
<el-table-column prop="attrGroupName" header-align="center" align="center" label="组名"></el-table-column>
<el-table-column prop="sort" header-align="center" align="center" label="排序"></el-table-column>
<el-table-column prop="descript" header-align="center" align="center" label="描述"></el-table-column>
<el-table-column prop="icon" header-align="center" align="center" label="组图标"></el-table-column>
<el-table-column prop="catelogId" header-align="center" align="center" label="所属分类id"></el-table-column>
<el-table-column prop="icon" header-align="center" align="center" label="组图标">
<template slot-scope="scope">
<svg-icon :icon-class="scope.row.icon" />
</template>
</el-table-column>
<el-table-column prop="catelogId" header-align="center" align="center" label="分类ID"></el-table-column>
<el-table-column prop="categoryName" header-align="center" align="center" label="分类名称"></el-table-column>
<el-table-column
fixed="right"
header-align="center"

@ -56,7 +56,11 @@
<el-tag v-else></el-tag>
</template>
</el-table-column>
<el-table-column prop="icon" header-align="center" align="center" label="图标"></el-table-column>
<el-table-column prop="icon" header-align="center" align="center" label="图标">
<template slot-scope="scope">
<svg-icon :icon-class="scope.row.icon" />
</template>
</el-table-column>
<el-table-column prop="valueSelect" header-align="center" align="center" label="可选值">
<template slot-scope="scope">
<el-tooltip placement="top">

@ -15,8 +15,6 @@ import java.util.Map;
*/
public interface AttrGroupService extends IService<AttrGroupEntity> {
PageUtils queryPage(Map<String, Object> params);
/**
*
* @param params

@ -1,11 +1,9 @@
package com.xjs.mall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.product.entity.CategoryEntity;
import java.util.List;
import java.util.Map;
/**
*
@ -16,8 +14,6 @@ import java.util.Map;
*/
public interface CategoryService extends IService<CategoryEntity> {
PageUtils queryPage(Map<String, Object> params);
/**
*
* @return list

@ -1,34 +1,33 @@
package com.xjs.mall.product.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjs.mall.product.dao.AttrGroupDao;
import com.xjs.mall.product.entity.AttrGroupEntity;
import com.xjs.mall.product.entity.CategoryEntity;
import com.xjs.mall.product.service.AttrGroupService;
import com.xjs.mall.product.service.CategoryService;
import com.xjs.mall.product.vo.AttrGroupResponseVo;
import com.xjs.utils.PageUtils;
import com.xjs.utils.Query;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service("attrGroupService")
@Transactional
public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupDao, AttrGroupEntity> implements AttrGroupService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<AttrGroupEntity> page = this.page(
new Query<AttrGroupEntity>().getPage(params),
new QueryWrapper<>()
);
return new PageUtils(page);
}
@Autowired
private CategoryService categoryService;
@Override
public PageUtils queryPage(Map<String, Object> params, Long categoryId) {
@ -46,15 +45,35 @@ public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupDao, AttrGroupEnt
if (categoryId == 0) {
IPage<AttrGroupEntity> page = this.page(new Query<AttrGroupEntity>().getPage(params),
wrapper);
return new PageUtils(page);
List<AttrGroupResponseVo> responseVoList = this.setList(page.getRecords());
PageUtils pageUtils = new PageUtils(page);
pageUtils.setList(responseVoList);
return pageUtils;
} else {
wrapper.eq(AttrGroupEntity::getCatelogId, categoryId);
IPage<AttrGroupEntity> page = this.page(new Query<AttrGroupEntity>().getPage(params),
wrapper);
return new PageUtils(page);
List<AttrGroupResponseVo> responseVoList = this.setList(page.getRecords());
PageUtils pageUtils = new PageUtils(page);
pageUtils.setList(responseVoList);
return pageUtils;
}
}
private List<AttrGroupResponseVo> setList(List<AttrGroupEntity> records) {
return records.stream().map(attrGroupEntity -> {
AttrGroupResponseVo attrGroupResponseVo = new AttrGroupResponseVo();
BeanUtils.copyProperties(attrGroupEntity, attrGroupResponseVo);
//获取分类实体类主要为了获取分类名称给vo
CategoryEntity categoryEntity = categoryService.getById(attrGroupEntity.getCatelogId());
attrGroupResponseVo.setCategoryName(categoryEntity.getName());
return attrGroupResponseVo;
}).collect(Collectors.toList());
}
}

@ -1,14 +1,10 @@
package com.xjs.mall.product.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjs.mall.product.dao.CategoryDao;
import com.xjs.mall.product.entity.CategoryEntity;
import com.xjs.mall.product.service.CategoryBrandRelationService;
import com.xjs.mall.product.service.CategoryService;
import com.xjs.utils.PageUtils;
import com.xjs.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -28,15 +24,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
@Autowired
private CategoryBrandRelationService categoryBrandRelationService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<CategoryEntity> page = this.page(
new Query<CategoryEntity>().getPage(params),
new QueryWrapper<>()
);
return new PageUtils(page);
}
@Override
public List<CategoryEntity> listWithTree() {

@ -0,0 +1,46 @@
package com.xjs.mall.product.vo;
import lombok.Data;
import java.util.List;
/**
* AttrGroupVo
* @author xiejs
* @since 2022-03-17
*/
@Data
public class AttrGroupResponseVo {
private Long attrGroupId;
/**
*
*/
private String attrGroupName;
/**
*
*/
private Integer sort;
/**
*
*/
private String descript;
/**
*
*/
private String icon;
/**
* id
*/
private Long catelogId;
/**
* id
*/
private List<String> catelogPath;
/**
*
*/
private String categoryName;
}
Loading…
Cancel
Save