package com.gree.mall.manager.logic.report;

import com.gree.mall.manager.bean.admin.AdminWebsitBean;
import com.gree.mall.manager.bean.offline.WebsitBean;
import com.gree.mall.manager.bean.offline.ZoneBean;
import com.gree.mall.manager.commonmapper.CustomOfflineMapper;
import com.gree.mall.manager.plus.service.WebsitZoneService;
import com.gree.mall.manager.utils.CommonUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Service
@Slf4j
public class OfflineZoneLogic {
    @Autowired
    private CustomOfflineMapper customOfflineMapper;

    public List<WebsitBean> websit(HttpServletRequest request){
        AdminWebsitBean adminWebsitBean = CommonUtils.getAdminUser(request);
        if(adminWebsitBean.getType() !=0){
            return customOfflineMapper.queryWebsitAllList();
        }else{
            return customOfflineMapper.queryWebsitList(adminWebsitBean.getAdminUserId());
        }

    }

    public List<ZoneBean> zone(HttpServletRequest request){

        AdminWebsitBean adminWebsitBean = CommonUtils.getAdminUser(request);
        if(adminWebsitBean.getType() !=0){
            return customOfflineMapper.queryZoneAllList();
        }else{
            return customOfflineMapper.queryZoneList(adminWebsitBean.getAdminUserId());

        }
    }



}
