import {ModelUtil, ModelUtilImpl, ConditionUtil, ConditionUtilImpl, FieldUtil } from 'model-util'
import {Container, Singleton} from 'typescript-ioc' 
import { TestSqlModel } from '../models/index' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2020-10-16 11:27
 */
interface TestSqlModelCU extends ConditionUtil<TestSqlModelCU>{
    CODE:FieldUtil<TestSqlModelCU>;
    FILED1:FieldUtil<TestSqlModelCU>;
}

class TestSqlModelCUImpl extends ConditionUtilImpl<TestSqlModelCUImpl> implements TestSqlModelCU{ 
    newInstance(): TestSqlModelCUImpl {
        return new TestSqlModelCUImpl();
    } 
    get CODE(): FieldUtil<TestSqlModelCU>{  
        return new FieldUtil('CODE','code','code', this);
    }
    get FILED1(): FieldUtil<TestSqlModelCU>{  
        return new FieldUtil('FILED1','filed1','filed1', this);
    }
}

@Singleton
class TestSqlModelMU extends ModelUtilImpl<TestSqlModelCU,TestSqlModel>{ 
    joinTables = [];
    selectSQL ='select code,  concat(?,  code) as filed1 from user';
    tableFields  = ['code','filed1'];
    modelFields  = ['code','filed1'];

    createConditionUtil(): TestSqlModelCU {
        return new TestSqlModelCUImpl();
    }   

    static get CODE(): FieldUtil<TestSqlModelCU>{ 
        return new FieldUtil('CODE','code','code', new TestSqlModelCUImpl());
    }
    static get FILED1(): FieldUtil<TestSqlModelCU>{ 
        return new FieldUtil('FILED1','filed1','filed1', new TestSqlModelCUImpl());
    }

    get CODE(): FieldUtil<TestSqlModelCU>{ 
        return TestSqlModelMU.CODE;
    }
    get FILED1(): FieldUtil<TestSqlModelCU>{ 
        return TestSqlModelMU.FILED1;
    }
}
export {TestSqlModelMU, TestSqlModelCU}
