import {ModelConditionUtil, ModelConditionUtilImpl, FieldUtil, TableUtilImpl, IdType, BasicFieldUtil, JoinTable, SubTable } 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 SysUser{
    /**
    * ID
    * @type { string }
    */
    id?: string;
    /**
    * 姓名
    * @type { string }
    */
    name?: string;
}
interface SysUserMCU extends ModelConditionUtil<SysUserMCU>{
    ID:FieldUtil<SysUserMCU>;
    NAME:FieldUtil<SysUserMCU>;
}

class SysUserMCUImpl extends ModelConditionUtilImpl<SysUserMCUImpl> implements SysUserMCU{ 
    newInstance(): SysUserMCUImpl {
        return new SysUserMCUImpl();
    } 
    get ID(): FieldUtil<SysUserMCU>{  
        return new FieldUtil('ID','id','ID', this);
    }
    get NAME(): FieldUtil<SysUserMCU>{  
        return new FieldUtil('NAME','name','姓名', this);
    }
}

@Singleton 
class SysUserMU extends TableUtilImpl<SysUserMCU,SysUser>{ 
    tableName  = 'sys_user_demo';
    tableFields  = ['id','name'];
    modelFields  = ['id','name'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [];

    constructor() {
        super(Container.get(Knex));
    }
    createModelConditionUtil(): SysUserMCU {
        return new SysUserMCUImpl();
    }   

    static get ID(): FieldUtil<SysUserMCU>{ 
        return new FieldUtil('ID','id','ID', new SysUserMCUImpl());
    }
    static get NAME(): FieldUtil<SysUserMCU>{ 
        return new FieldUtil('NAME','name','姓名', new SysUserMCUImpl());
    }

    get ID(): FieldUtil<SysUserMCU>{ 
        return SysUserMU.ID;
    }
    get NAME(): FieldUtil<SysUserMCU>{ 
        return SysUserMU.NAME;
    }
}
export {SysUserMCU, SysUserMCUImpl, SysUser, SysUserMU}
