package com.younike.admin;

import com.younike.common.core.controller.BaseController;
import com.younike.common.core.domain.AjaxResult;
import com.younike.common.core.page.TableDataInfo;
import com.younike.system.domain.vo.GoodsCommentVo;
import com.younike.system.param.CommentQueryParam;
import com.younike.system.service.IGoodsCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 会员订单Controller
 *
 * @author zulu.chen
 * @date 2022-01-11
 */
@Api("会员订单接口")
@RestController
@RequestMapping("/admin/comment")
public class AdminCommentController extends BaseController {

    @Autowired
    private IGoodsCommentService goodsCommentService;

    /**
     * 查询会员订单列表
     */
    @ApiOperation("查询会员评价列表")
    @PreAuthorize("@ss.hasPermi('admin:comment:list')")
    @GetMapping("/commentList")
    public TableDataInfo list(CommentQueryParam param) {
        startPage();
        List<GoodsCommentVo> list = goodsCommentService.commentList(param);
        return getDataTable(list);
    }


    @ApiOperation("查询会员订单列表")
    @PreAuthorize("@ss.hasPermi('admin:comment:delete')")
    @DeleteMapping("/{commentId}")
    public AjaxResult deleteComment(@PathVariable("commentId") Long commentId) {
        return toAjax(goodsCommentService.deleteGoodsCommentByCommontId(commentId));
    }

}
