import {ModelUtil, ModelUtilImpl, ModelConditionUtil, ModelConditionUtilImpl, FieldUtil } from 'model-util'
import {Container, Singleton} from 'typescript-ioc' 
import * as Knex from 'knex' 


/**
 * @author Keytop midend auto generate
 * @version 1.0
 * @date 2020-06-02 13:51
 */
interface ModelVersionView{
    /**
    * app_id
    * @type { string }
    */
    appId?: string;
    /**
    * code
    * @type { string }
    */
    code?: string;
    /**
    * create_time
    * @type { Date }
    */
    createTime?: Date;
    /**
    * major
    * @type { number }
    */
    major?: number;
    /**
    * minor
    * @type { number }
    */
    minor?: number;
    /**
    * pid
    * @type { string }
    */
    pid?: string;
    /**
    * released
    * @type { boolean }
    */
    released?: boolean;
    /**
    * service_center_id
    * @type { string }
    */
    serviceCenterId?: string;
    /**
    * update_time
    * @type { Date }
    */
    updateTime?: Date;
    /**
    * version_no
    * @type { string }
    */
    versionNo?: string;
}
interface ModelVersionViewMCU extends ModelConditionUtil<ModelVersionViewMCU>{
    APP_ID:FieldUtil<ModelVersionViewMCU>;
    CODE:FieldUtil<ModelVersionViewMCU>;
    CREATE_TIME:FieldUtil<ModelVersionViewMCU>;
    MAJOR:FieldUtil<ModelVersionViewMCU>;
    MINOR:FieldUtil<ModelVersionViewMCU>;
    PID:FieldUtil<ModelVersionViewMCU>;
    RELEASED:FieldUtil<ModelVersionViewMCU>;
    SERVICE_CENTER_ID:FieldUtil<ModelVersionViewMCU>;
    UPDATE_TIME:FieldUtil<ModelVersionViewMCU>;
    VERSION_NO:FieldUtil<ModelVersionViewMCU>;
}

class ModelVersionViewMCUImpl extends ModelConditionUtilImpl<ModelVersionViewMCUImpl> implements ModelVersionViewMCU{ 
    newInstance(): ModelVersionViewMCUImpl {
        return new ModelVersionViewMCUImpl();
    } 
    get APP_ID(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('APP_ID','appId','app_id', this);
    }
    get CODE(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('CODE','code','code', this);
    }
    get CREATE_TIME(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('CREATE_TIME','createTime','create_time', this);
    }
    get MAJOR(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('MAJOR','major','major', this);
    }
    get MINOR(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('MINOR','minor','minor', this);
    }
    get PID(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('PID','pid','pid', this);
    }
    get RELEASED(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('RELEASED','released','released', this);
    }
    get SERVICE_CENTER_ID(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('SERVICE_CENTER_ID','serviceCenterId','service_center_id', this);
    }
    get UPDATE_TIME(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','update_time', this);
    }
    get VERSION_NO(): FieldUtil<ModelVersionViewMCU>{  
        return new FieldUtil('VERSION_NO','versionNo','version_no', this);
    }
}

@Singleton
class ModelVersionViewMU extends ModelUtilImpl<ModelVersionViewMCU,ModelVersionView>{ 
    joinTables = [];
    selectSQL ='select a.version_no,a.released,a.major,minor,b.service_center_id,b.app_id,b.pid,b.code,b.create_time,b.update_time from bm_version a,bm_model_project b where a.bm_project_id = b.id';
    modelFields  = ['appId','code','createTime','major','minor','pid','released','serviceCenterId','updateTime','versionNo'];


    constructor(){
        super(Container.get(Knex));
    }

    createModelConditionUtil(): ModelVersionViewMCU {
        return new ModelVersionViewMCUImpl();
    }   

    static get APP_ID(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('APP_ID','appId','app_id', new ModelVersionViewMCUImpl());
    }
    static get CODE(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('CODE','code','code', new ModelVersionViewMCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','create_time', new ModelVersionViewMCUImpl());
    }
    static get MAJOR(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('MAJOR','major','major', new ModelVersionViewMCUImpl());
    }
    static get MINOR(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('MINOR','minor','minor', new ModelVersionViewMCUImpl());
    }
    static get PID(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('PID','pid','pid', new ModelVersionViewMCUImpl());
    }
    static get RELEASED(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('RELEASED','released','released', new ModelVersionViewMCUImpl());
    }
    static get SERVICE_CENTER_ID(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('SERVICE_CENTER_ID','serviceCenterId','service_center_id', new ModelVersionViewMCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','update_time', new ModelVersionViewMCUImpl());
    }
    static get VERSION_NO(): FieldUtil<ModelVersionViewMCU>{ 
        return new FieldUtil('VERSION_NO','versionNo','version_no', new ModelVersionViewMCUImpl());
    }

    get APP_ID(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.APP_ID;
    }
    get CODE(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.CODE;
    }
    get CREATE_TIME(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.CREATE_TIME;
    }
    get MAJOR(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.MAJOR;
    }
    get MINOR(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.MINOR;
    }
    get PID(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.PID;
    }
    get RELEASED(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.RELEASED;
    }
    get SERVICE_CENTER_ID(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.SERVICE_CENTER_ID;
    }
    get UPDATE_TIME(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.UPDATE_TIME;
    }
    get VERSION_NO(): FieldUtil<ModelVersionViewMCU>{ 
        return ModelVersionViewMU.VERSION_NO;
    }
}
export {ModelVersionViewMCU, ModelVersionViewMCUImpl, ModelVersionView, ModelVersionViewMU}
