package com.kiisoo.ic.promotion.controller;

import com.kiisoo.ic.activity.entity.PmnPromotionSrc;
import com.kiisoo.ic.common.BaseController;
import com.kiisoo.ic.promotion.service.PromotionSrcService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Description: 推广源管理c
 * @Auther: yaoyao.zhu
 * @Date: 2020/5/22
 * @Version: v1
 */
@Controller
@RequestMapping("/promotion")
@Slf4j
@ApiModel("推广源管理")
public class PromotionSrcController extends BaseController {


    @Autowired
    private PromotionSrcService promotionSrcService;

    @ApiModelProperty(value = "通过查询店铺推广导购信息", required = true)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "instanceId", value = "活动id", dataType = "int", paramType = "form"),
            @ApiImplicitParam(name = "storeId", value = "店铺id", dataType = "int", paramType = "form"),
            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "form"),
            @ApiImplicitParam(name = "pageSize", value = "分页size", dataType = "int", paramType = "form"),
    })
    @RequestMapping(value = "/list/staff", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> staff(@RequestParam(value = "instanceId") Long instanceId,
                                     @RequestParam(value = "storeId") Long storeId,
                                     @RequestParam("pageNum") int pageNum,
                                     @RequestParam("pageSize") int pageSize) {
        try {
            Map<String, Object> map = promotionSrcService.listStaff(instanceId, storeId, pageNum, pageSize);
            return data(map);
        } catch (Exception e) {
            log.error("查询失败", e);
            return fail();
        }

    }


}
