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

import {DevopsNginxConfMU} from './DevopsNginxConf' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-03-25 16:54
 */
interface DevopsTemplateCU extends ConditionUtil<DevopsTemplateCU>{
    ID:FieldUtil<DevopsTemplateCU>;
    TEMPLATE_NAME:FieldUtil<DevopsTemplateCU>;
    UPGRADE_TIME:FieldUtil<DevopsTemplateCU>;
    TEMPLATE_DESC:FieldUtil<DevopsTemplateCU>;
    BUSINESS_AREA:FieldUtil<DevopsTemplateCU>;
    BUSINESS_GROUP:FieldUtil<DevopsTemplateCU>;
    NGINX_CONF_ID:FieldUtil<DevopsTemplateCU>;
    CREATE_TIME:FieldUtil<DevopsTemplateCU>;
    UPDATE_TIME:FieldUtil<DevopsTemplateCU>;
    CREATE_USER_ID:FieldUtil<DevopsTemplateCU>;
    UPDATE_USER_ID:FieldUtil<DevopsTemplateCU>;
}

class DevopsTemplateCUImpl extends ConditionUtilImpl<DevopsTemplateCUImpl> implements DevopsTemplateCU{ 
    newInstance(): DevopsTemplateCUImpl {
        return new DevopsTemplateCUImpl();
    } 
    get ID(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('ID','id','主键', this);
    }
    get TEMPLATE_NAME(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('TEMPLATE_NAME','templateName','模板名称', this);
    }
    get UPGRADE_TIME(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('UPGRADE_TIME','upgradeTime','升级时间（0-夜间升级，1-白天升级）', this);
    }
    get TEMPLATE_DESC(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('TEMPLATE_DESC','templateDesc','任务描述', this);
    }
    get BUSINESS_AREA(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('BUSINESS_AREA','businessArea','分区', this);
    }
    get BUSINESS_GROUP(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('BUSINESS_GROUP','businessGroup','所属项目组', this);
    }
    get NGINX_CONF_ID(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('NGINX_CONF_ID','nginxConfId','Nginx模板id', this);
    }
    get CREATE_TIME(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('CREATE_TIME','createTime','创建时间', this);
    }
    get UPDATE_TIME(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', this);
    }
    get CREATE_USER_ID(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('CREATE_USER_ID','createUserId','创建人id', this);
    }
    get UPDATE_USER_ID(): FieldUtil<DevopsTemplateCU>{  
        return new FieldUtil('UPDATE_USER_ID','updateUserId','修改人id', this);
    }
    get NGINX_CONF_NAME(): FieldInfo{  
        return new FieldInfo('nginxConfName','模板名称');
    }
}

@Singleton 
class DevopsTemplateMU extends TableUtilImpl<DevopsTemplateCU,DevopsTemplate>{ 
    tableName  = 'devops_template';
    tableFields  = ['id','template_name','upgrade_time','template_desc','business_area','business_group','nginx_conf_id','create_time','update_time','create_user_id','update_user_id'];
    modelFields  = ['id','templateName','upgradeTime','templateDesc','businessArea','businessGroup','nginxConfId','createTime','updateTime','createUserId','updateUserId','nginxConfName'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: true,
            foreignKeyFields: [DevopsTemplateMU.NGINX_CONF_ID],
            joinIdFields: [DevopsNginxConfMU.ID],
            getTableUtil: ()=>{
                return Container.get(DevopsNginxConfMU);
            },
            fields: [
                {
                    fieldUtil: DevopsNginxConfMU.NAME,
                    alias: 'nginxConfName'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): DevopsTemplateCU {
        return new DevopsTemplateCUImpl();
    }   

    static get ID(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('ID','id','主键', new DevopsTemplateCUImpl());
    }
    static get TEMPLATE_NAME(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('TEMPLATE_NAME','templateName','模板名称', new DevopsTemplateCUImpl());
    }
    static get UPGRADE_TIME(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('UPGRADE_TIME','upgradeTime','升级时间（0-夜间升级，1-白天升级）', new DevopsTemplateCUImpl());
    }
    static get TEMPLATE_DESC(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('TEMPLATE_DESC','templateDesc','任务描述', new DevopsTemplateCUImpl());
    }
    static get BUSINESS_AREA(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('BUSINESS_AREA','businessArea','分区', new DevopsTemplateCUImpl());
    }
    static get BUSINESS_GROUP(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('BUSINESS_GROUP','businessGroup','所属项目组', new DevopsTemplateCUImpl());
    }
    static get NGINX_CONF_ID(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('NGINX_CONF_ID','nginxConfId','Nginx模板id', new DevopsTemplateCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','创建时间', new DevopsTemplateCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', new DevopsTemplateCUImpl());
    }
    static get CREATE_USER_ID(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('CREATE_USER_ID','createUserId','创建人id', new DevopsTemplateCUImpl());
    }
    static get UPDATE_USER_ID(): FieldUtil<DevopsTemplateCU>{ 
        return new FieldUtil('UPDATE_USER_ID','updateUserId','修改人id', new DevopsTemplateCUImpl());
    }
    static get NGINX_CONF_NAME(): FieldInfo{  
        return new FieldInfo('nginxConfName','模板名称');
    }

    get ID(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.ID;
    }
    get TEMPLATE_NAME(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.TEMPLATE_NAME;
    }
    get UPGRADE_TIME(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.UPGRADE_TIME;
    }
    get TEMPLATE_DESC(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.TEMPLATE_DESC;
    }
    get BUSINESS_AREA(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.BUSINESS_AREA;
    }
    get BUSINESS_GROUP(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.BUSINESS_GROUP;
    }
    get NGINX_CONF_ID(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.NGINX_CONF_ID;
    }
    get CREATE_TIME(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.UPDATE_TIME;
    }
    get CREATE_USER_ID(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.CREATE_USER_ID;
    }
    get UPDATE_USER_ID(): FieldUtil<DevopsTemplateCU>{ 
        return DevopsTemplateMU.UPDATE_USER_ID;
    }
    get NGINX_CONF_NAME(): FieldInfo{  
        return DevopsTemplateMU.NGINX_CONF_NAME;
    }
}
export {DevopsTemplateMU, DevopsTemplateCU}
