/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.discount.platform.controller;

import com.yami.shop.discount.comment.model.DiscountProd;
import com.yami.shop.discount.comment.service.DiscountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 *
 * @author lgh on 2018/11/21.
 */
@RestController
@RequestMapping("/platform/discountProd")
public class DiscountProdController {

    @Autowired
    private DiscountService discountService;


    /**
	 * 获取信息
	 */
	@GetMapping("/info/{discountId}")
	public ResponseEntity<List<DiscountProd>> info(@PathVariable("discountId") Long discountId){

		List<DiscountProd> discountProds = discountService.getDiscountAndItemAndProdById(discountId).getDiscountProds();
		return ResponseEntity.ok(discountProds);
	}

}
