package service

import (
	"pure/global"
	"pure/model"
)

func GetSellerStoreInfo(uuid string) (err error, res model.SellerStoreInfo) {
	err = global.MG_DB.Model(&model.SellerStore{}).Select("store_no,type,email,create_by").Where("create_by = ?", uuid).First(&res).Error
	return
}

func getSellerStoreInfoMap(uuids []string) (err error, res map[string]model.SellerStoreInfo) {
	var list []model.SellerStoreInfo
	err = global.MG_DB.Model(&model.SellerStore{}).Select("store_no,type,email,create_by").Where("create_by IN (?)", uuids).Find(&list).Error
	if err != nil {
		return
	}
	res = make(map[string]model.SellerStoreInfo)
	for i := 0; i < len(list); i++ {
		res[list[i].CreateBy] = list[i]
	}
	return
}