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_info_material } from '../models/index' 

import {Ad_infoMU} from './Ad_info' 
import {Ad_materialMU} from './Ad_material' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-04-13 11:55
 */
interface Ad_info_materialCU extends ConditionUtil<Ad_info_materialCU>{
    AD_INFO_ID:FieldUtil<Ad_info_materialCU>;
    AD_MATERIAL_ID:FieldUtil<Ad_info_materialCU>;
    DEL_FLAG:FieldUtil<Ad_info_materialCU>;
}

class Ad_info_materialCUImpl extends ConditionUtilImpl<Ad_info_materialCUImpl> implements Ad_info_materialCU{ 
    newInstance(): Ad_info_materialCUImpl {
        return new Ad_info_materialCUImpl();
    } 
    get AD_INFO_ID(): FieldUtil<Ad_info_materialCU>{  
        return new FieldUtil('AD_INFO_ID','adInfoId','', this);
    }
    get AD_MATERIAL_ID(): FieldUtil<Ad_info_materialCU>{  
        return new FieldUtil('AD_MATERIAL_ID','adMaterialId','', this);
    }
    get DEL_FLAG(): FieldUtil<Ad_info_materialCU>{  
        return new FieldUtil('DEL_FLAG','delFlag','是否删除：0，否；1，是', this);
    }
}

@Singleton 
class Ad_info_materialMU extends TableUtilImpl<Ad_info_materialCU,Ad_info_material>{ 
    tableName  = 'ad_info_material';
    tableFields  = ['ad_info_id','ad_material_id','del_flag'];
    modelFields  = ['adInfoId','adMaterialId','delFlag'];
    modelIdFields  = ['adInfoId','adMaterialId'];
    tableIdFields  = ['ad_info_id','ad_material_id'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [{
            name: 'ad_info',
            parentIdFields: [Ad_info_materialMU.AD_INFO_ID],
            foreignKeyFields: [Ad_infoMU.ID],
            getTableUtil: ()=>{
                return Container.get(Ad_infoMU);
            }
        } as SubTable

        ,{
            name: 'ad_material',
            parentIdFields: [Ad_info_materialMU.AD_MATERIAL_ID],
            foreignKeyFields: [Ad_materialMU.ID],
            getTableUtil: ()=>{
                return Container.get(Ad_materialMU);
            }
        } as SubTable

];

    createConditionUtil(): Ad_info_materialCU {
        return new Ad_info_materialCUImpl();
    }   

    static get AD_INFO_ID(): FieldUtil<Ad_info_materialCU>{ 
        return new FieldUtil('AD_INFO_ID','adInfoId','', new Ad_info_materialCUImpl());
    }
    static get AD_MATERIAL_ID(): FieldUtil<Ad_info_materialCU>{ 
        return new FieldUtil('AD_MATERIAL_ID','adMaterialId','', new Ad_info_materialCUImpl());
    }
    static get DEL_FLAG(): FieldUtil<Ad_info_materialCU>{ 
        return new FieldUtil('DEL_FLAG','delFlag','是否删除：0，否；1，是', new Ad_info_materialCUImpl());
    }

    get AD_INFO_ID(): FieldUtil<Ad_info_materialCU>{ 
        return Ad_info_materialMU.AD_INFO_ID;
    }
    get AD_MATERIAL_ID(): FieldUtil<Ad_info_materialCU>{ 
        return Ad_info_materialMU.AD_MATERIAL_ID;
    }
    get DEL_FLAG(): FieldUtil<Ad_info_materialCU>{ 
        return Ad_info_materialMU.DEL_FLAG;
    }
}
export {Ad_info_materialMU, Ad_info_materialCU}
