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

import {DevopsTemplateMU} from './DevopsTemplate' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-02-20 18:04
 */
interface DevopsTaskCU extends ConditionUtil<DevopsTaskCU>{
    ID:FieldUtil<DevopsTaskCU>;
    TASK_NAME:FieldUtil<DevopsTaskCU>;
    TEMPLATE_ID:FieldUtil<DevopsTaskCU>;
    TIMING_TASK:FieldUtil<DevopsTaskCU>;
    SKIP_NGINX:FieldUtil<DevopsTaskCU>;
    BUSINESS_AREA:FieldUtil<DevopsTaskCU>;
    BUSINESS_GROUP:FieldUtil<DevopsTaskCU>;
    OPERATOR_USER_ID:FieldUtil<DevopsTaskCU>;
    PLAN_TIME:FieldUtil<DevopsTaskCU>;
    RUN_STATE:FieldUtil<DevopsTaskCU>;
    TASK_DESC:FieldUtil<DevopsTaskCU>;
    CREATE_USER_ID:FieldUtil<DevopsTaskCU>;
    UPDATE_USER_ID:FieldUtil<DevopsTaskCU>;
    CREATE_TIME:FieldUtil<DevopsTaskCU>;
    UPDATE_TIME:FieldUtil<DevopsTaskCU>;
}

class DevopsTaskCUImpl extends ConditionUtilImpl<DevopsTaskCUImpl> implements DevopsTaskCU{ 
    newInstance(): DevopsTaskCUImpl {
        return new DevopsTaskCUImpl();
    } 
    get ID(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('ID','id','主键', this);
    }
    get TASK_NAME(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('TASK_NAME','taskName','任务名称', this);
    }
    get TEMPLATE_ID(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('TEMPLATE_ID','templateId','模板id', this);
    }
    get TIMING_TASK(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('TIMING_TASK','timingTask','是否定时任务（0-是；1-不是）', this);
    }
    get SKIP_NGINX(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('SKIP_NGINX','skipNginx','跳过Nginx（0-跳过；1-不跳过）', this);
    }
    get BUSINESS_AREA(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('BUSINESS_AREA','businessArea','分区', this);
    }
    get BUSINESS_GROUP(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('BUSINESS_GROUP','businessGroup','所属项目组', this);
    }
    get OPERATOR_USER_ID(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('OPERATOR_USER_ID','operatorUserId','执行人', this);
    }
    get PLAN_TIME(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('PLAN_TIME','planTime','执行时间', this);
    }
    get RUN_STATE(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('RUN_STATE','runState','运行状态（0-未运行；1-运行中；2-运行成功；3-运行失败；4-已回滚；5-已取消；6-等待中；7', this);
    }
    get TASK_DESC(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('TASK_DESC','taskDesc','任务描述', this);
    }
    get CREATE_USER_ID(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('CREATE_USER_ID','createUserId','创建人id', this);
    }
    get UPDATE_USER_ID(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('UPDATE_USER_ID','updateUserId','修改人id', this);
    }
    get CREATE_TIME(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('CREATE_TIME','createTime','创建时间', this);
    }
    get UPDATE_TIME(): FieldUtil<DevopsTaskCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', this);
    }
    get UPGRADE_TIME(): FieldInfo{  
        return new FieldInfo('upgradeTime','升级时间（0-夜间升级，1-白天升级）');
    }
    get NGINX_CONF_NAME(): FieldInfo{  
        return new FieldInfo('nginxConfName','模板名称');
    }
}

@Singleton 
class DevopsTaskMU extends TableUtilImpl<DevopsTaskCU,DevopsTask>{ 
    tableName  = 'devops_task';
    tableFields  = ['id','task_name','template_id','timing_task','skip_nginx','business_area','business_group','operator_user_id','plan_time','run_state','task_desc','create_user_id','update_user_id','create_time','update_time'];
    modelFields  = ['id','taskName','templateId','timingTask','skipNginx','businessArea','businessGroup','operatorUserId','planTime','runState','taskDesc','createUserId','updateUserId','createTime','updateTime','upgradeTime','nginxConfName'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: false,
            foreignKeyFields: [DevopsTaskMU.TEMPLATE_ID],
            joinIdFields: [DevopsTemplateMU.ID],
            getTableUtil: ()=>{
                return Container.get(DevopsTemplateMU);
            },
            fields: [
                {
                    fieldUtil: DevopsTemplateMU.UPGRADE_TIME,
                    alias: 'upgradeTime'
                }
                ,{
                    fieldUtil: DevopsTemplateMU.NGINX_CONF_NAME,
                    alias: 'nginxConfName'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): DevopsTaskCU {
        return new DevopsTaskCUImpl();
    }   

    static get ID(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('ID','id','主键', new DevopsTaskCUImpl());
    }
    static get TASK_NAME(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('TASK_NAME','taskName','任务名称', new DevopsTaskCUImpl());
    }
    static get TEMPLATE_ID(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('TEMPLATE_ID','templateId','模板id', new DevopsTaskCUImpl());
    }
    static get TIMING_TASK(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('TIMING_TASK','timingTask','是否定时任务（0-是；1-不是）', new DevopsTaskCUImpl());
    }
    static get SKIP_NGINX(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('SKIP_NGINX','skipNginx','跳过Nginx（0-跳过；1-不跳过）', new DevopsTaskCUImpl());
    }
    static get BUSINESS_AREA(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('BUSINESS_AREA','businessArea','分区', new DevopsTaskCUImpl());
    }
    static get BUSINESS_GROUP(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('BUSINESS_GROUP','businessGroup','所属项目组', new DevopsTaskCUImpl());
    }
    static get OPERATOR_USER_ID(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('OPERATOR_USER_ID','operatorUserId','执行人', new DevopsTaskCUImpl());
    }
    static get PLAN_TIME(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('PLAN_TIME','planTime','执行时间', new DevopsTaskCUImpl());
    }
    static get RUN_STATE(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('RUN_STATE','runState','运行状态（0-未运行；1-运行中；2-运行成功；3-运行失败；4-已回滚；5-已取消；6-等待中；7', new DevopsTaskCUImpl());
    }
    static get TASK_DESC(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('TASK_DESC','taskDesc','任务描述', new DevopsTaskCUImpl());
    }
    static get CREATE_USER_ID(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('CREATE_USER_ID','createUserId','创建人id', new DevopsTaskCUImpl());
    }
    static get UPDATE_USER_ID(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('UPDATE_USER_ID','updateUserId','修改人id', new DevopsTaskCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','创建时间', new DevopsTaskCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<DevopsTaskCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', new DevopsTaskCUImpl());
    }
    static get UPGRADE_TIME(): FieldInfo{  
        return new FieldInfo('upgradeTime','升级时间（0-夜间升级，1-白天升级）');
    }
    static get NGINX_CONF_NAME(): FieldInfo{  
        return new FieldInfo('nginxConfName','模板名称');
    }

    get ID(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.ID;
    }
    get TASK_NAME(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.TASK_NAME;
    }
    get TEMPLATE_ID(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.TEMPLATE_ID;
    }
    get TIMING_TASK(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.TIMING_TASK;
    }
    get SKIP_NGINX(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.SKIP_NGINX;
    }
    get BUSINESS_AREA(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.BUSINESS_AREA;
    }
    get BUSINESS_GROUP(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.BUSINESS_GROUP;
    }
    get OPERATOR_USER_ID(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.OPERATOR_USER_ID;
    }
    get PLAN_TIME(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.PLAN_TIME;
    }
    get RUN_STATE(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.RUN_STATE;
    }
    get TASK_DESC(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.TASK_DESC;
    }
    get CREATE_USER_ID(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.CREATE_USER_ID;
    }
    get UPDATE_USER_ID(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.UPDATE_USER_ID;
    }
    get CREATE_TIME(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<DevopsTaskCU>{ 
        return DevopsTaskMU.UPDATE_TIME;
    }
    get UPGRADE_TIME(): FieldInfo{  
        return DevopsTaskMU.UPGRADE_TIME;
    }
    get NGINX_CONF_NAME(): FieldInfo{  
        return DevopsTaskMU.NGINX_CONF_NAME;
    }
}
export {DevopsTaskMU, DevopsTaskCU}
