<div class="news"><span>${goods.caption}</span></div>
<div class="fl price"><i>¥</i><em>${goods.price}</em><span>降价通知</span></div>
<div class="intro-detail"><!-- 商品详情 --> ${goodsDesc.introduction}</div>
<div id="two" class="tab-pane"><p>${goodsDesc.packageList}</p></div>
<div id="three" class="tab-pane"><p>${goodsDesc.saleService}</p></div>
<#--图片列表 -->
<#assign imageList=goodsDesc.itemImages?eval />
<!--默认第一个预览-->
<div id="preview" class="spec-preview">
<span class="jqzoom">
<#if (imageList?size>0)>
<img jqimg="${imageList[0].url}" src="${imageList[0].url}" width="400px" height="400px" />
</#if>
</span>
</div>
<!--下方的缩略图--><div class="spec-scroll">
<div class="items">
<ul>
<#list imageList as item>
<li><img src="${item.url}" bimg="${item.url}" /></li>
</#list>
</ul>
</div>
</div>
<#--扩展属性列表 -->
<#assign customAttributeList=goodsDesc.customAttributeItems?eval />
<#list customAttributeList as item>
<#if item.value??>
<li>${item.text} :${item.value}</li>
</#if>
</#list>
<#--规格列表 -->
<#assign specificationList=goodsDesc.specificationItems?eval />
<#list specificationList as specification>
<dl>
<dt>
<div class="fl title">
<i>${specification.attributeName}</i>
</div>
</dt>
<#list specification.attributeValue as item>
<dd><a href="javascript:;" >${item}</a></dd>
</#list>
</dl>
</#list>
@Service
public class ItemPageServiceImpl implements ItemPageService {
@Autowired
private FreeMarkerConfig freeMarkerConfig;
@Autowired
private TbGoodsMapper goodsMapper;
@Autowired
private TbGoodsDescMapper goodsDescMapper;
@Autowired
private TbItemCatMapper itemCatMapper;
@Override
public boolean genItemHtml(Long goodsId){
try {
Configuration configuration = freeMarkerConfig.getConfiguration(); Template template = configuration.getTemplate("item.ftl");
Map dataModel=new HashMap<>();
//1.加载商品表数据
TbGoods goods = goodsMapper.selectByPrimaryKey(goodsId); dataModel.put("goods", goods);
//2.加载商品扩展表数据
TbGoodsDesc goodsDesc = goodsDescMapper.selectByPrimaryKey(goodsId); dataModel.put("goodsDesc", goodsDesc);
//3.商品分类String itemCat1 =
itemCatMapper.selectByPrimaryKey(goods.getCategory1Id()).getName();
String itemCat2 = itemCatMapper.selectByPrimaryKey(goods.getCategory2Id()).getName();
String itemCat3 = itemCatMapper.selectByPrimaryKey(goods.getCategory3Id()).getName();
dataModel.put("itemCat1", itemCat1);
dataModel.put("itemCat2", itemCat2); dataModel.put("itemCat3", itemCat3);
Writer out=new FileWriter("d:\\item\\"+goodsId+".html"); template.process(dataModel, out);
out.close();
return true;
} catch (Exception e) {
// TODO Auto-generated catch block e.printStackTrace();
return false;
}
}
}
<ul class="sui-breadcrumb">
<li><a href="#">${itemCat1}</a></li>
<li><a href="#">${itemCat2}</a></li>
<li><a href="#">${itemCat3}</a></li>
</ul>
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |