package shop.alien.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.StoreUser;

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

/**
 * <p>
 * 门店用户 Mapper 接口
 * </p>
 *
 * @author ssk
 * @since 2024-12-11
 */
public interface StoreUserMapper extends BaseMapper<StoreUser> {

    @Select("SELECT\n" +
            "\t`user`.phone,\n" +
            "\t`user`.id,\n" +
            "\tinfo.store_name as storeName,\n" +
            "\timg.img_url as imgUrl \n" +
            "FROM\n" +
            "\tstore_user AS `user`\n" +
            "\tLEFT JOIN store_info AS info ON `user`.store_id = info.id\n" +
            "\tLEFT JOIN store_img AS img ON img.store_id = info.id \n" +
            "WHERE\n" +
            "\t`user`.phone IN (${userPhones}) \n" +
            "\tAND `user`.delete_flag = 0 \n" +
            "\tAND img.img_type = 10")
    List<Map<String,Object>> selectStore(@Param("userPhones") String userPhones);

    StoreUser getRemoveUser(@Param("id") String id);
}
