CommentListDirective.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:SelfSoftShop 作者:
@SuppressWarnings("unchecked")
public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
    String goodsId = DirectiveUtil.getStringParameter(GOODS_ID_PARAMETER_NAME, params);
    Integer count = DirectiveUtil.getIntegerParameter(COUNT_PARAMETER_NAME, params);

    Goods goods = null;
    if (StringUtils.isNotEmpty(goodsId)) {
        goods = goodsService.load(goodsId);
    }
    List<Comment> commentList = commentService.getCommentList(goods, count);

    if (body != null && commentList != null) {
        if (loopVars.length > 0) {
            loopVars[0] = ObjectWrapper.BEANS_WRAPPER.wrap(commentList);
        }
        body.render(env.getOut());
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号