#pragma once

#include "DataFields.h"

namespace DMCar
{
    const string TABLENAME = "car";
    const string FID_ID = "id";
    const string FID_USER_ID = "user_id";
    const string FID_FRAME_NUM = "frame_no";
    const string FID_CAR_NUM = "car_no";
    const string FID_BRAND = "brand";
    const string FID_FACTORY = "factory";
    const string FID_MODEL = "model";
    const string FID_RANGE = "range";
    const string FID_PRODUCT_DATE = "product_date";
    const string FID_BUY_DATE = "buy_time";
    const string FID_BATTERY_MODEL = "battery_model";
    const string FID_CREATE_TIME = "create_time";
    const string FID_BATT_CODE = "batt_code";
}

class DaoCar
{
public:

    // ************************************************************************************************
    // 车辆信息管理
    static bool insert_car(DataFields& fields);
    // 更新车辆信息，更新条件：id
    static bool update_car(DataFields& fields);

    /**
    * 分页查询设备信息
    * @param: pageinfo 分页信息
    * @param: result 查询的结果数据集
    */
    static bool query_car_page(PageInfo& pageinfo, vector<DataFields>& result);
    static bool query_car_by_userid(string userid, vector<DataFields>& result);
    static bool query_car_by_carnum(string carnum, vector<DataFields>& result);
};