package com.kiisoo.ic.store.controller;

import com.kiisoo.ic.common.BaseController;
import com.kiisoo.ic.store.service.PoiSellerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 *  导购
 */
@Controller
@RequestMapping("/poi/seller")
@Slf4j
public class PoiStoreStaffController extends BaseController {

    @Autowired
    private PoiSellerService poiSellerService;

    /**
     * 获取用户管辖的导购信息
     * @return
     */
    @ResponseBody
    @PostMapping("/user/seller")
    public Map<String,Object> getSellerData(@RequestParam("userId")long userId, Long shopId, Long regionId, Long companyId){
        try {
            return data(poiSellerService.getAllSeller(regionId, shopId, userId, companyId));
        }catch (Exception e){
            log.error("查找用户管辖的导购",e);
            return fail();
        }
    }

}
