后台系统平台属性规格参数修改功能完成

develop
ddyd 2 weeks ago
parent 3752e7e8d0
commit 708a4954bd

@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.Map;
import com.bookstore.bookmall.product.vo.AttrRespVo;
import com.bookstore.bookmall.product.vo.AttrVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -57,8 +58,10 @@ public class AttrController {
@RequestMapping("/info/{attrId}")
//@RequiresPermissions("product:attr:info")
public R info(@PathVariable("attrId") Long attrId){
AttrEntity attr = attrService.getById(attrId);
return R.ok().put("attr", attr);
//AttrEntity attr = attrService.getById(attrId);
AttrRespVo attrRespVo = attrService.getAttrInfo(attrId);
return R.ok().put("attr", attrRespVo);
}
/**

@ -1,6 +1,7 @@
package com.bookstore.bookmall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bookstore.bookmall.product.vo.AttrRespVo;
import com.bookstore.bookmall.product.vo.AttrVo;
import com.bookstore.common.utils.PageUtils;
import com.bookstore.bookmall.product.entity.AttrEntity;
@ -22,6 +23,8 @@ public interface AttrService extends IService<AttrEntity> {
PageUtils queryBasePage(Map<String, Object> params, Long cateLogId);
AttrRespVo getAttrInfo(Long attrId);
}

@ -9,6 +9,7 @@ import com.bookstore.bookmall.product.entity.AttrAttrgroupRelationEntity;
import com.bookstore.bookmall.product.entity.AttrGroupEntity;
import com.bookstore.bookmall.product.entity.CategoryEntity;
import com.bookstore.bookmall.product.service.AttrAttrgroupRelationService;
import com.bookstore.bookmall.product.service.CategoryService;
import com.bookstore.bookmall.product.vo.AttrRespVo;
import com.bookstore.bookmall.product.vo.AttrVo;
import com.mysql.cj.util.StringUtils;
@ -43,6 +44,8 @@ public class AttrServiceImpl extends ServiceImpl<AttrDao, AttrEntity> implements
CategoryDao categoryDao;
@Autowired
AttrGroupDao attrGroupDao;
@Autowired
CategoryService categoryService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
@ -112,6 +115,39 @@ public class AttrServiceImpl extends ServiceImpl<AttrDao, AttrEntity> implements
return pageUtils;
}
@Override
public AttrRespVo getAttrInfo(Long attrId) {
// log.info("进入service");
// log.info("查询属性attrId: {}", attrId);
AttrRespVo respVo = new AttrRespVo();
AttrEntity attrEntity = this.getById(attrId);
//设置分组id
BeanUtils.copyProperties(attrEntity, respVo);
// log.info("beanutilzhengchang");
AttrAttrgroupRelationEntity RelationEntity = RelationDao.selectOne(
new QueryWrapper<AttrAttrgroupRelationEntity>().eq("attr_id",attrId));
if (RelationEntity!=null) {
// log.info("查询属性relation正常");
respVo.setAttrGroupId(RelationEntity.getAttrGroupId());
AttrGroupEntity attrGroupEntity = attrGroupDao.selectById(RelationEntity.getAttrGroupId());
if (attrGroupEntity!=null) {
respVo.setGroupName(attrGroupEntity.getAttrGroupName());
}
}
// log.info("设置分组");
//设置分类信息
Long catelogId = attrEntity.getCatelogId();
Long[] catelogPath = categoryService.findCatelogPath(catelogId);
respVo.setCatelogPath(catelogPath);
CategoryEntity categoryEntity = categoryDao.selectById(catelogId);
if (categoryEntity != null) {
respVo.setCatelogName(categoryEntity.getName());
}
// log.info("设置分类");
return respVo;
}
}

@ -10,4 +10,6 @@ public class AttrRespVo extends AttrVo{
private String catelogName;
private String groupName;
private Long[] catelogPath;
}

Loading…
Cancel
Save