bug:前端不发送请求
p84 关于pubsub、publish报错,无法发送查询品牌信息的请求:
解决办法:
1、npm install --save pubsub-js
2、在src下的main.js中引用:
① import PubSub from 'pubsub-js'
② Vue.prototype.PubSub = PubSub
前端页面没有回显,请拷贝商城项目的前端源码!大坑
商品维护-发布商品-基本信息
/**
* 14、获取分类关联的品牌
* /product/categorybrandrelation/brands/list
* @param catId 分类id
* @return
*/
@GetMapping("/brands/list")
public R relationBrandsList(@RequestParam(value = "catId",required = true)Long catId){
List<BrandEntity> vos = categoryBrandRelationService.getBrandsByCatId(catId);
List<BrandVo> collect = vos.stream().map((item) -> {
BrandVo brandVo = new BrandVo();
brandVo.setBrandId(item.getBrandId());
brandVo.setBrandName(item.getName());
return brandVo;
}).collect(Collectors.toList());
return R.ok().put("data",collect);
}
/**
* 14、获取分类关联的品牌
* @param catId
* @return
*/
@Override
public List<BrandEntity> getBrandsByCatId(Long catId) {
List<CategoryBrandRelationEntity> catelogId = relationDao.selectList(new QueryWrapper<CategoryBrandRelationEntity>().eq("catelog_id", catId));
List<BrandEntity> collect = catelogId.stream().map(item -> {
Long brandId = item.getBrandId();
BrandEntity byId = brandService.getById(brandId);
return byId;
}).collect(Collectors.toList());
return collect;
}
bug:2024-06-01 20:02:23.857 ERROR 27288 --- [io-13000-exec-5] .l.p.e.liyumallExceptionControllerAdvice : 程序抛出异常null
解决办法:把数据库中的品牌删除,在页面当中重新添加品牌!!!
bug