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

import {DevopsOperationLogMU} from './DevopsOperationLog' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2022-09-01 18:16
 */
interface DevopsSwitchPartitionStcLogCU extends ConditionUtil<DevopsSwitchPartitionStcLogCU>{
    ID:FieldUtil<DevopsSwitchPartitionStcLogCU>;
    PARTITION_CODE:FieldUtil<DevopsSwitchPartitionStcLogCU>;
    LOG_ID:FieldUtil<DevopsSwitchPartitionStcLogCU>;
    CREATE_TIME:FieldUtil<DevopsSwitchPartitionStcLogCU>;
}

class DevopsSwitchPartitionStcLogCUImpl extends ConditionUtilImpl<DevopsSwitchPartitionStcLogCUImpl> implements DevopsSwitchPartitionStcLogCU{ 
    newInstance(): DevopsSwitchPartitionStcLogCUImpl {
        return new DevopsSwitchPartitionStcLogCUImpl();
    } 
    get ID(): FieldUtil<DevopsSwitchPartitionStcLogCU>{  
        return new FieldUtil('id','id','主键', this);
    }
    get PARTITION_CODE(): FieldUtil<DevopsSwitchPartitionStcLogCU>{  
        return new FieldUtil('partition_code','partitionCode','分区编码', this);
    }
    get LOG_ID(): FieldUtil<DevopsSwitchPartitionStcLogCU>{  
        return new FieldUtil('log_id','logId','操作日志ID', this);
    }
    get CREATE_TIME(): FieldUtil<DevopsSwitchPartitionStcLogCU>{  
        return new FieldUtil('create_time','createTime','创建时间', this);
    }
    get USER_ID(): FieldInfo{  
        return new FieldInfo('userId','用户id');
    }
    get OPERATION_CONTENT(): FieldInfo{  
        return new FieldInfo('operationContent','操作内容');
    }
    get USER_NAME(): FieldInfo{  
        return new FieldInfo('userName','');
    }
}

@Singleton 
class DevopsSwitchPartitionStcLogMU extends TableUtilImpl<DevopsSwitchPartitionStcLogCU,DevopsSwitchPartitionStcLog>{ 
    tableName  = 'devops_switch_partition_stc_log';
    tableFields  = ['id','partition_code','log_id','create_time'];
    modelFields  = ['id','partitionCode','logId','createTime','userId','operationContent','userName'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: true,
            foreignKeyFields: [DevopsSwitchPartitionStcLogMU.LOG_ID],
            joinIdFields: [DevopsOperationLogMU.ID],
            getTableUtil: ()=>{
                return Container.get(DevopsOperationLogMU);
            },
            fields: [
                {
                    fieldUtil: DevopsOperationLogMU.USER_ID,
                    alias: 'userId'
                }
                ,{
                    fieldUtil: DevopsOperationLogMU.OPERATION_CONTENT,
                    alias: 'operationContent'
                }
                ,{
                    fieldUtil: DevopsOperationLogMU.USER_NAME,
                    alias: 'userName'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): DevopsSwitchPartitionStcLogCU {
        return new DevopsSwitchPartitionStcLogCUImpl();
    }   

    static get ID(): FieldUtil<DevopsSwitchPartitionStcLogCU>{ 
        return new FieldUtil('id','id','主键', new DevopsSwitchPartitionStcLogCUImpl());
    }
    static get PARTITION_CODE(): FieldUtil<DevopsSwitchPartitionStcLogCU>{ 
        return new FieldUtil('partition_code','partitionCode','分区编码', new DevopsSwitchPartitionStcLogCUImpl());
    }
    static get LOG_ID(): FieldUtil<DevopsSwitchPartitionStcLogCU>{ 
        return new FieldUtil('log_id','logId','操作日志ID', new DevopsSwitchPartitionStcLogCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<DevopsSwitchPartitionStcLogCU>{ 
        return new FieldUtil('create_time','createTime','创建时间', new DevopsSwitchPartitionStcLogCUImpl());
    }
    static get USER_ID(): FieldInfo{  
        return new FieldInfo('userId','用户id');
    }
    static get OPERATION_CONTENT(): FieldInfo{  
        return new FieldInfo('operationContent','操作内容');
    }
    static get USER_NAME(): FieldInfo{  
        return new FieldInfo('userName','');
    }

    get ID(): FieldUtil<DevopsSwitchPartitionStcLogCU>{ 
        return DevopsSwitchPartitionStcLogMU.ID;
    }
    get PARTITION_CODE(): FieldUtil<DevopsSwitchPartitionStcLogCU>{ 
        return DevopsSwitchPartitionStcLogMU.PARTITION_CODE;
    }
    get LOG_ID(): FieldUtil<DevopsSwitchPartitionStcLogCU>{ 
        return DevopsSwitchPartitionStcLogMU.LOG_ID;
    }
    get CREATE_TIME(): FieldUtil<DevopsSwitchPartitionStcLogCU>{ 
        return DevopsSwitchPartitionStcLogMU.CREATE_TIME;
    }
    get USER_ID(): FieldInfo{  
        return DevopsSwitchPartitionStcLogMU.USER_ID;
    }
    get OPERATION_CONTENT(): FieldInfo{  
        return DevopsSwitchPartitionStcLogMU.OPERATION_CONTENT;
    }
    get USER_NAME(): FieldInfo{  
        return DevopsSwitchPartitionStcLogMU.USER_NAME;
    }
}
export {DevopsSwitchPartitionStcLogMU, DevopsSwitchPartitionStcLogCU}
