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

import {AdStyleMU} from './AdStyle' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-04-20 13:55
 */
interface AdPositionStyleCU extends ConditionUtil<AdPositionStyleCU>{
    AD_POSITION_ID:FieldUtil<AdPositionStyleCU>;
    AD_STYLE_ID:FieldUtil<AdPositionStyleCU>;
    DEL_FLAG:FieldUtil<AdPositionStyleCU>;
}

class AdPositionStyleCUImpl extends ConditionUtilImpl<AdPositionStyleCUImpl> implements AdPositionStyleCU{ 
    newInstance(): AdPositionStyleCUImpl {
        return new AdPositionStyleCUImpl();
    } 
    get AD_POSITION_ID(): FieldUtil<AdPositionStyleCU>{  
        return new FieldUtil('AD_POSITION_ID','adPositionId','广告位置表id', this);
    }
    get AD_STYLE_ID(): FieldUtil<AdPositionStyleCU>{  
        return new FieldUtil('AD_STYLE_ID','adStyleId','广告样式表id', this);
    }
    get DEL_FLAG(): FieldUtil<AdPositionStyleCU>{  
        return new FieldUtil('DEL_FLAG','delFlag','是否删除：0，否；1，是', this);
    }
    get ID(): FieldInfo{  
        return new FieldInfo('id','主键id');
    }
    get AD_POSTION_TYPE(): FieldInfo{  
        return new FieldInfo('adPostionType','广告位类型');
    }
    get WIDTH(): FieldInfo{  
        return new FieldInfo('width','宽度（单位像素）');
    }
    get HEIGHT(): FieldInfo{  
        return new FieldInfo('height','高度（单位像素）');
    }
    get TYPE(): FieldInfo{  
        return new FieldInfo('type','类型：0，单图');
    }
    get STATUS(): FieldInfo{  
        return new FieldInfo('status','状态：0，启用；1，删除');
    }
    get CREATE_TIME(): FieldInfo{  
        return new FieldInfo('createTime','');
    }
    get CREATOR(): FieldInfo{  
        return new FieldInfo('creator','');
    }
    get UPDATE_TIME(): FieldInfo{  
        return new FieldInfo('updateTime','');
    }
    get UPDATOR(): FieldInfo{  
        return new FieldInfo('updator','');
    }
}

@Singleton 
class AdPositionStyleMU extends TableUtilImpl<AdPositionStyleCU,AdPositionStyle>{ 
    tableName  = 'ad_position_style';
    tableFields  = ['ad_position_id','ad_style_id','del_flag'];
    modelFields  = ['adPositionId','adStyleId','delFlag','id','adPostionType','width','height','type','status','createTime','creator','updateTime','updator'];
    modelIdFields  = ['adPositionId','adStyleId'];
    tableIdFields  = ['ad_position_id','ad_style_id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: false,
            foreignKeyFields: [AdPositionStyleMU.AD_STYLE_ID],
            joinIdFields: [AdStyleMU.ID],
            getTableUtil: ()=>{
                return Container.get(AdStyleMU);
            },
            fields: [
                {
                    fieldUtil: AdStyleMU.ID,
                    alias: 'id'
                }
                ,{
                    fieldUtil: AdStyleMU.AD_POSTION_TYPE,
                    alias: 'adPostionType'
                }
                ,{
                    fieldUtil: AdStyleMU.WIDTH,
                    alias: 'width'
                }
                ,{
                    fieldUtil: AdStyleMU.HEIGHT,
                    alias: 'height'
                }
                ,{
                    fieldUtil: AdStyleMU.TYPE,
                    alias: 'type'
                }
                ,{
                    fieldUtil: AdStyleMU.STATUS,
                    alias: 'status'
                }
                ,{
                    fieldUtil: AdStyleMU.CREATE_TIME,
                    alias: 'createTime'
                }
                ,{
                    fieldUtil: AdStyleMU.CREATOR,
                    alias: 'creator'
                }
                ,{
                    fieldUtil: AdStyleMU.UPDATE_TIME,
                    alias: 'updateTime'
                }
                ,{
                    fieldUtil: AdStyleMU.UPDATOR,
                    alias: 'updator'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): AdPositionStyleCU {
        return new AdPositionStyleCUImpl();
    }   

    static get AD_POSITION_ID(): FieldUtil<AdPositionStyleCU>{ 
        return new FieldUtil('AD_POSITION_ID','adPositionId','广告位置表id', new AdPositionStyleCUImpl());
    }
    static get AD_STYLE_ID(): FieldUtil<AdPositionStyleCU>{ 
        return new FieldUtil('AD_STYLE_ID','adStyleId','广告样式表id', new AdPositionStyleCUImpl());
    }
    static get DEL_FLAG(): FieldUtil<AdPositionStyleCU>{ 
        return new FieldUtil('DEL_FLAG','delFlag','是否删除：0，否；1，是', new AdPositionStyleCUImpl());
    }
    static get ID(): FieldInfo{  
        return new FieldInfo('id','主键id');
    }
    static get AD_POSTION_TYPE(): FieldInfo{  
        return new FieldInfo('adPostionType','广告位类型');
    }
    static get WIDTH(): FieldInfo{  
        return new FieldInfo('width','宽度（单位像素）');
    }
    static get HEIGHT(): FieldInfo{  
        return new FieldInfo('height','高度（单位像素）');
    }
    static get TYPE(): FieldInfo{  
        return new FieldInfo('type','类型：0，单图');
    }
    static get STATUS(): FieldInfo{  
        return new FieldInfo('status','状态：0，启用；1，删除');
    }
    static get CREATE_TIME(): FieldInfo{  
        return new FieldInfo('createTime','');
    }
    static get CREATOR(): FieldInfo{  
        return new FieldInfo('creator','');
    }
    static get UPDATE_TIME(): FieldInfo{  
        return new FieldInfo('updateTime','');
    }
    static get UPDATOR(): FieldInfo{  
        return new FieldInfo('updator','');
    }

    get AD_POSITION_ID(): FieldUtil<AdPositionStyleCU>{ 
        return AdPositionStyleMU.AD_POSITION_ID;
    }
    get AD_STYLE_ID(): FieldUtil<AdPositionStyleCU>{ 
        return AdPositionStyleMU.AD_STYLE_ID;
    }
    get DEL_FLAG(): FieldUtil<AdPositionStyleCU>{ 
        return AdPositionStyleMU.DEL_FLAG;
    }
    get ID(): FieldInfo{  
        return AdPositionStyleMU.ID;
    }
    get AD_POSTION_TYPE(): FieldInfo{  
        return AdPositionStyleMU.AD_POSTION_TYPE;
    }
    get WIDTH(): FieldInfo{  
        return AdPositionStyleMU.WIDTH;
    }
    get HEIGHT(): FieldInfo{  
        return AdPositionStyleMU.HEIGHT;
    }
    get TYPE(): FieldInfo{  
        return AdPositionStyleMU.TYPE;
    }
    get STATUS(): FieldInfo{  
        return AdPositionStyleMU.STATUS;
    }
    get CREATE_TIME(): FieldInfo{  
        return AdPositionStyleMU.CREATE_TIME;
    }
    get CREATOR(): FieldInfo{  
        return AdPositionStyleMU.CREATOR;
    }
    get UPDATE_TIME(): FieldInfo{  
        return AdPositionStyleMU.UPDATE_TIME;
    }
    get UPDATOR(): FieldInfo{  
        return AdPositionStyleMU.UPDATOR;
    }
}
export {AdPositionStyleMU, AdPositionStyleCU}
