document
API test

获取属性的详细信息

GET
http://localhost:88/api/product/attr/info/:attrId

Request Parameters

parameter
type
description
required
attrId
long
示例:7
required

Response Parameters

parameter
type
description
required
msg
string
示例:success
required
code
int
示例:0
required
attr
object
数据字典
required
attrId
int
示例:7
required
attrName
string
示例:入网型号
required
searchType
int
示例:0
required
valueType
int
示例:0
required
icon
string
示例:xxx
required
valueSelect
string
示例:A2217;C3J;以官网信息为准
required
attrType
int
示例:1
required
enable
int
示例:1
required
catelogId
int
示例:225
required
showDesc
int
示例:0
required
attrGroupId
int
示例:1
required
catelogName
object
示例:null
required
groupName
object
示例:null
required
catelogPath
array
数据列表
required

Description or Example

# 核心代码 ```java @RequestMapping("/info/{attrId}") // @RequiresPermissions("product:attr:info") public R info(@PathVariable("attrId") Long attrId){ AttrRespVO attrRespVO = attrService.getDetailById(attrId); return R.ok().put("attr", attrRespVO); } ``` ```java @Override public AttrRespVO getDetailById(Long attrId) { // 查询基本信息 AttrEntity attrEntity = this.getById(attrId); AttrRespVO attrRespVO = new AttrRespVO(); // 封装 BeanUtils.copyProperties(attrEntity, attrRespVO); // 通过属性ID找属性分组ID LambdaQueryWrapper<AttrAttrgroupRelationEntity> wp = new LambdaQueryWrapper<>(); wp.eq(AttrAttrgroupRelationEntity::getAttrId, attrEntity.getAttrId()); AttrAttrgroupRelationEntity relation = relationService.getOne(wp); // 有关联信息才找 if (relation != null) attrRespVO.setAttrGroupId(relation.getAttrGroupId()); // 查询路径 ArrayDeque<Long> path = new ArrayDeque<>(); categoryService.getCategoryPath(attrEntity.getCatelogId(), path); return attrRespVO.setCatelogPath(path.toArray(new Long[0])); } ```