package com.winsun.controller;
import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.mapper.SchoolMapper;
import com.winsun.mapper.SchoolPackageMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * @Author xuede
 * @Date 2020/3/10 10:16
 * @Version 1.0
 */
@Slf4j
@RestController
public class StartSelectController {

    @Autowired
    private  SchoolMapper schoolMapper;

    @RequestMapping("/findStartData")
    public ResponseData<Map<String, Object>> findStartData(@RequestParam("id") String id){
        if (StringUtils.isEmpty(id)){
            return ResponseData.error("请输入合伙人id");
        }
        List<Map<String, Object>> mapList = schoolMapper.getuserToSchool(id);
        if (CollectionUtils.isEmpty(mapList)){
            return ResponseData.error("没有查询相关的合伙人id的信息");
        }
        Map<String, Object> map = mapList.get(0);
        return ResponseData.success(map);
    }
}
