#include "problemrectstandingbook.h"
#include "ui_problemrectstandingbook.h"

#include <QSqlQuery>
#include <QDebug>

ProblemRectStandingBook::ProblemRectStandingBook(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ProblemRectStandingBook)
{
    ui->setupUi(this);
    searchComName();
}

ProblemRectStandingBook::~ProblemRectStandingBook()
{
    delete ui;
}

void ProblemRectStandingBook::searchComName()
{
    QSqlQuery query;
    QString sql = QString("select id,name,code from company_info");
    if(query.exec(sql)){
        qDebug()<<"size:"<<query.numRowsAffected();
        while(query.next()){
            int id = query.value(0).toInt();
            QString name = query.value(1).toString();
            QString code = query.value(2).toString();
            qDebug()<<"com select:"<<id<<name;
            m_comInfo[name] = id;
            //m_comCode[name] = code;
            ui->comboBox_company->addItem(name);
        }
    }
}