#include "xwholestocks.h"

XWholeStocks::XWholeStocks(QObject *parent) : QObject(parent)
{

}

XWholeStocks::~XWholeStocks()
{

}

QString XWholeStocks::toInsertSql(_WholeStocksParam stock)
{
//    QString sql = QString("insert into wholeStocks (code, name, tradeDay,open,close,differRange,BLEMIND2,differRangeP20,differRangeP60,isSTStock,isSTXStock,listDate,tradeDaysP,volumn,amount,BLEMINDCODE2,freeFloatMv,mvByCSRC,avgVolumeP20) "
//                                           "VALUES ('%1', '%2', '%3',%4,%5,%6,'%7',%8,%9,%10,%11,'%12',%13,%14,%15,'%16',%17,%18,%19);")
//            .arg(stock.code)
//            .arg(stock.name)
//            .arg(stock.tradeDay)
//            .arg(stock.open)
//            .arg(stock.close)
//            .arg(stock.differRange)
//            .arg(stock.BLEMIND2)
//            .arg(stock.differRangeP20)
//            .arg(stock.differRangeP60)
//            .arg(stock.isSTStock)
//            .arg(stock.isSTXStock)
//            .arg(stock.listDate)
//            .arg(stock.tradeDaysP)
//            .arg(stock.volumn)
//            .arg(stock.amount)
//            .arg(stock.BLEMINDCODE2)
//            .arg(stock.freeFloatMv)
//            .arg(stock.mvByCSRC)
//            .arg(stock.avgVolumeP20);
    QString sql = QString("insert into wholeStocks (code, name, tradeDay,open,close,differRange,BLEMIND2,differRangeP20,differRangeP60,isSTStock,isSTXStock,listDate,tradeDaysP,volumn,amount,BLEMINDCODE2,freeFloatMv,mvByCSRC,avgVolumeP20) "
                                           "SELECT  '%1', '%2', '%3',%4,%5,%6,'%7',%8,%9,%10,%11,'%12',%13,%14,%15,'%16',%17,%18,%19 from DUAL where not exists(select code from wholeStocks where code = '%1' and tradeDay = '%3' and open = %4);")
            .arg(stock.code)
            .arg(stock.name)
            .arg(stock.tradeDay)
            .arg(stock.open)
            .arg(stock.close)
            .arg(stock.differRange)
            .arg(stock.BLEMIND2)
            .arg(stock.differRangeP20)
            .arg(stock.differRangeP60)
            .arg(stock.isSTStock)
            .arg(stock.isSTXStock)
            .arg(stock.listDate)
            .arg(stock.tradeDaysP)
            .arg(stock.volumn)
            .arg(stock.amount)
            .arg(stock.BLEMINDCODE2)
            .arg(stock.freeFloatMv)
            .arg(stock.mvByCSRC)
            .arg(stock.avgVolumeP20);
    return sql;
}

QString XWholeStocks::toDeleteSql()
{
    return "";
}

QString XWholeStocks::toQuerySql()
{
    return "";
}

QString XWholeStocks::toUpdateSql()
{
    return "";
}
