admin 管理员组文章数量: 887018
2023年12月17日发(作者:html中id和class的区别)
2.3.2. Service
@Servicepublic class ItemServiceImplimplements ItemService {
@Autowiredprivate TbItemMapperitemMapper;@Autowiredprivate TbItemDescMapperitemDescMapper;@Autowiredprivate TbItemParamItemMapperitemParamItemMapper;/** * 根据id取商品信息 *
Title: getItemById
*Description:
* @param id * @return * @throws Exception * @see rvice#getItemById() */@Overridepublic TbItem getItemById(Longid) throws Exception {TbItem tbItem = ByPrimaryKey(id);return tbItem;}/** * 根据id取商品描述 *
Title: getItemDescById
*Description:
* @param id * @return * @throws Exception * @see rvice#getItemDescById() */@Overridepublic TbItemDesc getItemDescById(Longid) throws Exception {TbItemDesc itemDesc = ByPrimaryKey(id);return itemDesc;}/** * 根据商品id取规格参数 *
Title: getItemParamById
*Description:
* @param id * @return * @throws Exception * @see rvice#getItemParamById() */@Overridepublic TbItemParamItem getItemParamById(Longid) throws Exception {TbItemParamItemExample example = new TbItemParamItemExample();Criteria criteria =Criteria();mIdEqualTo(id);List}
2.3.3. Controller
private String ITEMS_ITEMDESC_URL;@Value("${ITEMS_ITEMPARAM_URL}")private String ITEMS_ITEMPARAM_URL;
@Overridepublic Item getItemById(Longid) throws Exception {// 查询商品信息String result = (REST_BASE_URL +ITEMS_ITEM_URL + id);// 转换成java对象TaotaoResult taotaoResult = ToPojo(result,);Item item =null;if (tus() == 200) {item = (Item)a();}
return item;}
@Overridepublic TbItemDesc geTbItemDescById(Longid) throws Exception {// 查询商品信息String result = (REST_BASE_URL +ITEMS_ITEMDESC_URL + id);// 转换成java对象TaotaoResult taotaoResult = ToPojo(result, );TbItemDesc itemDesc = null;if (tus() == 200) {itemDesc = (TbItemDesc) a();}
return itemDesc;}
@Overridepublic String geTbItemParamItemById(Longid) throws Exception {// 查询商品信息String result = (REST_BASE_URL +ITEMS_ITEMPARAM_URL + id);// 转换成java对象TaotaoResult taotaoResult = ToPojo(result, );String resultHtml = "";if (tus() == 200) {try {TbItemParamItem itemParamItem = (TbItemParamItem)a();//取规格参数信息String paramData = amData();//把规格参数转换成java对象List
版权声明:本文标题:商城项目实战32:商品详情页实现 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1702817974h432033.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论