package com.cpxt.biz.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cpxt.biz.domain.BizDriver;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 司机Mapper接口
 * 
 * @author YIN
 * @date 2024-12-16
 */
@Mapper
public interface BizDriverMapper extends BaseMapper<BizDriver>
{
    @Select("select * from biz_driver where user_id = ${userId} and status = 1")
    BizDriver selectByUserId(Long userId);

    @Select("select name from biz_driver where status = 1")
    List<String> selectDriverName();

    @Update("create table ${tableName} as select * from biz_driver_state_temp")
    void createTable(String tableName);

    @Update("ALTER TABLE ${tableName} MODIFY COLUMN id INT NOT NULL AUTO_INCREMENT")
    void addPrimaryKey(String tableName);

    @Update("ALTER TABLE ${tableName} ADD PRIMARY KEY (id)")
    void setAutoIncrement(String tableName);
}
