package shop.alien.gateway.mapper;

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

/**
 * 用户
 */
@Mapper
public interface LifeUserGatewayMapper extends BaseMapper<LifeUser> {

    /**
     * 查询已逻辑删除且已注销的用户（绕过 {@link LifeUser#deleteFlag} 的 TableLogic 过滤）。
     */
    @Select("SELECT * FROM life_user WHERE user_phone = #{phoneNum} AND delete_flag = 1 AND logout_flag = 1 LIMIT 1")
    LifeUser selectCancelledDeletedByPhone(@Param("phoneNum") String phoneNum);

}