import { FieldInfo } from 'model-util-base'
import { ConditionUtil, ConditionUtilImpl, FieldUtil, TableUtilImpl, IdType, JoinTable, SubTable } from 'model-util'
import { Container, Singleton } from 'typescript-ioc' 
import { Ad_position } from '../models/index' 

import {Ad_position_styleMU} from './Ad_position_style' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-04-19 14:33
 */
interface Ad_positionCU extends ConditionUtil<Ad_positionCU>{
    ID:FieldUtil<Ad_positionCU>;
    NAME:FieldUtil<Ad_positionCU>;
    TYPE:FieldUtil<Ad_positionCU>;
    STATUS:FieldUtil<Ad_positionCU>;
    CREATE_TIME:FieldUtil<Ad_positionCU>;
    CREATOR:FieldUtil<Ad_positionCU>;
    UPDATE_TIME:FieldUtil<Ad_positionCU>;
    UPDATOR:FieldUtil<Ad_positionCU>;
    DESCIRPTION:FieldUtil<Ad_positionCU>;
}

class Ad_positionCUImpl extends ConditionUtilImpl<Ad_positionCUImpl> implements Ad_positionCU{ 
    newInstance(): Ad_positionCUImpl {
        return new Ad_positionCUImpl();
    } 
    get ID(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('ID','id','主键ID', this);
    }
    get NAME(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('NAME','name','广告位名称', this);
    }
    get TYPE(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('TYPE','type','广告位类型：0，banner', this);
    }
    get STATUS(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('STATUS','status','状态：0，启用；1，删除', this);
    }
    get CREATE_TIME(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('CREATE_TIME','createTime','', this);
    }
    get CREATOR(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('CREATOR','creator','创建者', this);
    }
    get UPDATE_TIME(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','', this);
    }
    get UPDATOR(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('UPDATOR','updator','更新者', this);
    }
    get DESCIRPTION(): FieldUtil<Ad_positionCU>{  
        return new FieldUtil('DESCIRPTION','descirption','描述', this);
    }
}

@Singleton 
class Ad_positionMU extends TableUtilImpl<Ad_positionCU,Ad_position>{ 
    tableName  = 'ad_position';
    tableFields  = ['id','name','type','status','create_time','creator','update_time','updator','descirption'];
    modelFields  = ['id','name','type','status','createTime','creator','updateTime','updator','descirption'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [{
            name: 'ad_position_style',
            parentIdFields: [Ad_positionMU.ID],
            foreignKeyFields: [Ad_position_styleMU.AD_POSITION_ID],
            getTableUtil: ()=>{
                return Container.get(Ad_position_styleMU);
            }
        } as SubTable

];

    createConditionUtil(): Ad_positionCU {
        return new Ad_positionCUImpl();
    }   

    static get ID(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('ID','id','主键ID', new Ad_positionCUImpl());
    }
    static get NAME(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('NAME','name','广告位名称', new Ad_positionCUImpl());
    }
    static get TYPE(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('TYPE','type','广告位类型：0，banner', new Ad_positionCUImpl());
    }
    static get STATUS(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('STATUS','status','状态：0，启用；1，删除', new Ad_positionCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','', new Ad_positionCUImpl());
    }
    static get CREATOR(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('CREATOR','creator','创建者', new Ad_positionCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','', new Ad_positionCUImpl());
    }
    static get UPDATOR(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('UPDATOR','updator','更新者', new Ad_positionCUImpl());
    }
    static get DESCIRPTION(): FieldUtil<Ad_positionCU>{ 
        return new FieldUtil('DESCIRPTION','descirption','描述', new Ad_positionCUImpl());
    }

    get ID(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.ID;
    }
    get NAME(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.NAME;
    }
    get TYPE(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.TYPE;
    }
    get STATUS(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.STATUS;
    }
    get CREATE_TIME(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.CREATE_TIME;
    }
    get CREATOR(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.CREATOR;
    }
    get UPDATE_TIME(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.UPDATE_TIME;
    }
    get UPDATOR(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.UPDATOR;
    }
    get DESCIRPTION(): FieldUtil<Ad_positionCU>{ 
        return Ad_positionMU.DESCIRPTION;
    }
}
export {Ad_positionMU, Ad_positionCU}
