package com.kmall.api.api;

import com.kmall.api.annotation.LoginUser;
import com.kmall.api.entity.GoodsCrashVo;
import com.kmall.api.entity.UserVo;
import com.kmall.api.service.ApiGoodsCrashService;
import com.kmall.api.util.ApiBaseAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * API搭配减价管理
 *
 * @author Scott
 * @email
 * @date 2017-03-23 15:31
 */
@RestController
@RequestMapping("/api/goodscrash")
public class ApiGoodsCrashController extends ApiBaseAction {
    @Autowired
    private ApiGoodsCrashService apiGoodsCrashService;

    /**
     * 获取优惠券列表
     */
    @GetMapping("list")
    public Object list(@LoginUser UserVo loginUser, Long goodsId) {

        Map param = new HashMap();
        param.put("goods_id", goodsId);
        List<GoodsCrashVo> crashVos = apiGoodsCrashService.queryList(param);
        return toResponsSuccess(crashVos);
    }
}
