提交 7995eefd authored 作者: 吴德鹏's avatar 吴德鹏

属性管理

上级 65258e78
......@@ -150,49 +150,52 @@ public class AttributesController {
AttributesVo attrNames = new AttributesVo();
attrNames.setId(attr.getId());
attrNames.setAttrName(attr.getAttrName());
List<AttributesDescEntity> descs = attributesDescService.queryByAttrId(attr.getId());
List<AttributesDescVo> attributesVos = new ArrayList<>();
descs.forEach(desc -> {
AttributesDescVo descVo = new AttributesDescVo();
String attrValue = desc.getAttrValue();
String attrDesc = desc.getAttrDesc();
descVo.setAttrDescId(desc.getAttrDescId());
descVo.setAttrValue(attrValue + "(" + attrDesc + ")");
attributesVos.add(descVo);
});
attrNames.setDescList(attributesVos);
// List<AttributesDescEntity> descs = attributesDescService.queryByAttrId(attr.getId());
//
// List<AttributesDescVo> attributesVos = new ArrayList<>();
// descs.forEach(desc -> {
// AttributesDescVo descVo = new AttributesDescVo();
// String attrValue = desc.getAttrValue();
// String attrDesc = desc.getAttrDesc();
// descVo.setAttrDescId(desc.getAttrDescId());
// descVo.setAttrValue(attrValue + "(" + attrDesc + ")");
// attributesVos.add(descVo);
// });
//
// attrNames.setDescList(attributesVos);
attrNameList.add(attrNames);
});
return R.ok().put("list", attrNameList);
}
// /**
// * 属性值
// *
// * @param id 属性Id
// * @return url(../attributes/queryAttrDescs?id=2)
// */
// @RequestMapping("/queryAttrDescs")
// @ResponseBody
// @IgnoreAuth
// public R queryAttrDescs(@RequestParam("id") String id) {
// if (StringUtils.isBlank(id)) {
// return R.error("id不能为空!");
// }
// List<String> attrDescList = new ArrayList<>();
// List<AttributesDescEntity> descs = attributesDescService.queryByAttrId(id);
//
// descs.forEach(desc -> {
// String attrValue = desc.getAttrValue();
// String attrDesc = desc.getAttrDesc();
// attrDescList.add(attrValue + "(" + attrDesc + ")");
// });
//
// return R.ok().put("list", attrDescList);
// }
/**
* 属性值
*
* @param id 属性Id
* @return url(../attributes/queryAttrDescs?id=2)
*/
@RequestMapping("/queryAttrDescs")
@ResponseBody
@IgnoreAuth
public R queryAttrDescs(@RequestParam("id") String id) {
if (StringUtils.isBlank(id)) {
return R.error("id不能为空!");
}
List<AttributesDescEntity> descs = attributesDescService.queryByAttrId(id);
List<AttributesDescVo> attributesVos = new ArrayList<>();
descs.forEach(desc -> {
AttributesDescVo descVo = new AttributesDescVo();
String attrValue = desc.getAttrValue();
String attrDesc = desc.getAttrDesc();
descVo.setAttrDescId(desc.getAttrDescId());
descVo.setAttrValue(attrValue + "(" + attrDesc + ")");
attributesVos.add(descVo);
});
return R.ok().put("list", attributesVos);
}
/**
* 新版商品属性(整合旧版数据)
......
......@@ -14,5 +14,5 @@ import java.util.List;
public class AttributesVo {
private String id;
private String attrName;
private List<AttributesDescVo> descList;
// private List<AttributesDescVo> descList;
}
......@@ -36,7 +36,7 @@
`create_time`,
`update_time`
from attributes_desc
where attr_id = #{id}
where attr_desc_id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.AttributesDescEntity">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论