All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fastmybatis.tpl.dmdbms.vm Maven / Gradle / Ivy

The newest version!
#set($jq="$")



    
        #foreach($column in $allColumns)
            
        #end
        #foreach($association in $associations)
            
        #end
    

    
    
        #set ($i=0)
        #foreach($column in $columns)
            #if($i > 0),#end t.${column.columnName}
            #set($i=$i +1)
        #end
    

    
    

    

    
    

    
    

    
    

    
    

    
    

    
    


    
    
        #if(${pk.isUuid})
            
                SELECT SYS_GUID() FROM DUAL
            
        #end
        #if(${pk.isCustomIdFill})
            
                SELECT ${pk.customIdTypeHandlerValue}
            
        #end
        #if(${pk.isSequence})
            
                SELECT ${pk.sequenceName}.NEXTVAL AS ${pk.javaFieldName} FROM DUAL
            
        #end
        INSERT INTO ${table.tableName}
        (
        #set ($i=0)
        #foreach($column in $columns)
            #if(${column.isInsertColumn})
                #if($i > 0),#end ${column.columnName}
                #set($i=$i +1)
            #end
        #end
        )
        VALUES (
        #set ($i=0)
        #foreach($column in $columns)
            #if(${column.isInsertColumn})
                #if($i > 0),#end ${column.mybatisInsertValue}
                #set($i=$i +1)
            #end
        #end

        )
    

    
    
        #if(${pk.isUuid})
            
                SELECT SYS_GUID() FROM DUAL
            
        #end
        #if(${pk.isCustomIdFill})
            
                SELECT ${pk.customIdTypeHandlerValue}
            
        #end
        #if(${pk.isSequence})
            
                SELECT ${pk.sequenceName}.NEXTVAL AS ${pk.javaFieldName} FROM DUAL
            
        #end
        INSERT INTO ${table.tableName}

        
            #foreach($column in $columns)
                #if(${column.isCustomFill})
                    ${column.columnName},
                #elseif(${column.isInsertColumn})
                    
                        ${column.columnName},
                    
                #end
            #end
        
        
            #foreach($column in $columns)
                #if(${column.isCustomFill})
                    ${column.mybatisInsertValue},
                #elseif(${column.isInsertColumn})
                    
                        ${column.mybatisInsertValue},
                    
                #end
            #end
        
    

    
    
        INSERT ALL
        
            INTO ${table.tableName}
            
                #foreach($column in $columns)
                    #if(${column.isInsertColumn})
                        ${column.columnName},
                    #end
                #end
            
            VALUES
            
                #foreach($column in $columns)
                    #if(${column.isInsertColumn})
                        ${column.mybatisInsertValuePrefix},
                    #end
                #end
            
        
        SELECT ${entitys.size} FROM DUAL
    

    
    
        INSERT ALL
        
            INTO ${table.tableName}
            
                #foreach($column in $columns)
                    
                        ${column.columnName},
                    
                #end
            
            VALUES
            
                
                    #foreach($column in $columns)
                        
                            ${column.mybatisInsertValuePrefix},
                        
                    #end
                
            
        
        SELECT ${entitys.size} FROM DUAL
    

    
    
        INSERT INTO ${table.tableName}
        
            #foreach($column in $columns)
                #if(${column.isInsertColumn})
                    ${column.columnName},
                #end
            #end
        
        
            SELECT
            
                #foreach($column in $columns)
                    #if(${column.isInsertColumn})
                        ${column.mybatisInsertValuePrefix},
                    #end
                #end
            
            FROM dual
        
    

    
    
        UPDATE ${table.tableName}
        
            #foreach($column in $columns)
                #if(${column.isUpdateColumn})
                    ${column.columnName}=${column.mybatisUpdateValue},
                #end
            #end
        
        WHERE ${pk.columnName} = #{${pk.javaFieldName}}
        #if(${table.hasVersionColumn})
            AND ${table.versionColumn.columnName} = #{${table.versionColumn.javaFieldName}}
        #end
    

    
    
        UPDATE ${table.tableName}
        
            #foreach($column in $columns)
                #if(${column.isCustomFillUpdate})
                    ${column.columnName}=${column.mybatisUpdateValue},
                #elseif(${column.isUpdateColumn})
                    
                        ${column.columnName}=${column.mybatisUpdateValue},
                    
                #end
            #end
        
        WHERE ${pk.columnName} = #{${pk.javaFieldName}}
        #if(${table.hasVersionColumn})
            AND ${table.versionColumn.columnName} = #{${table.versionColumn.javaFieldName}}
        #end
    

    
    
        UPDATE ${table.tableName}
        
            #foreach($column in $columns)
                #if(${column.isUpdateColumn})
                    #if(${column.hasTypeHandlerUpdate})
                        ${column.columnName}=${column.mybatisUpdateValuePrefix},
                    #else
                        
                            
                                ${column.columnName}=${column.mybatisUpdateValuePrefix},
                            
                        
                    #end
                #end
            #end
        
        
        #if(${table.hasLogicDeleteColumn})
            
                AND ${table.logicDeleteColumn.columnName} ${table.logicDeleteColumn.logicNotDeleteValueExpression}
            
        #end
    

    
    
        UPDATE ${table.tableName}
        
            
                ${key} = #{entity[${key}]}
            
        
        
    

    
        #if(${table.hasLogicDeleteColumn})
        
            UPDATE ${table.tableName}
            
                #foreach($column in $columns)
                    #if(${column.isPk})
                    #elseif(${column.isLogicDelete})
                        #if($column.logicDeleteStrategy == 'fixed_value')
                            ${table.logicDeleteColumn.columnName} = ${table.logicDeleteColumn.logicDeleteValueString},
                        #elseif($column.logicDeleteStrategy == 'id_fill')
                            ${table.logicDeleteColumn.columnName} = ${pk.columnName},
                        #end
                    #end
                #end
            
            WHERE ${pk.columnName} = #{${pk.javaFieldName}}
            AND ${table.logicDeleteColumn.columnName} ${table.logicDeleteColumn.logicNotDeleteValueExpression}
            #if(${table.hasVersionColumn})
                AND ${table.versionColumn.columnName} = #{${table.versionColumn.javaFieldName}}
            #end
        
        #else
        
            DELETE FROM ${table.tableName}
            WHERE ${pk.columnName} = #{${pk.javaFieldName}}
        
        #end

    
        #if(${table.hasLogicDeleteColumn})
        
            UPDATE ${table.tableName}
            
                #foreach($column in $columns)
                    #if(${column.isPk})
                    #elseif(${column.isLogicDelete})
                        #if($column.logicDeleteStrategy == 'fixed_value')
                            ${table.logicDeleteColumn.columnName} = ${table.logicDeleteColumn.logicDeleteValueString},
                        #elseif($column.logicDeleteStrategy == 'id_fill')
                            ${table.logicDeleteColumn.columnName} = ${pk.columnName},
                        #end
                    #end
                #end
            
            WHERE ${pk.columnName} = #{value}
            AND ${table.logicDeleteColumn.columnName} ${table.logicDeleteColumn.logicNotDeleteValueExpression}
            #if(${table.hasVersionColumn})
                AND ${table.versionColumn.columnName} = #{${table.versionColumn.javaFieldName}}
            #end
        
        #else
        
            DELETE FROM ${table.tableName}
            WHERE ${pk.columnName} = #{value}
        
        #end

    
    #if(${table.hasLogicDeleteColumn})
        
            
                
                    DELETE FROM ${table.tableName}
                    
                
                
                    UPDATE ${table.tableName}
                    
                        #foreach($column in $columns)
                            #if(${column.isPk})
                            #elseif(${column.isLogicDelete})
                                #if($column.logicDeleteStrategy == 'fixed_value')
                                    ${table.logicDeleteColumn.columnName} = ${table.logicDeleteColumn.logicDeleteValueString},
                                #elseif($column.logicDeleteStrategy == 'id_fill')
                                    ${table.logicDeleteColumn.columnName} = ${pk.columnName},
                                #end
                            #end
                        #end
                        
                            
                                ${block.columnName} = #{block.value},
                            
                        
                    
                    
                    AND ${table.logicDeleteColumn.columnName} ${table.logicDeleteColumn.logicNotDeleteValueExpression}
                
            
        
    #else
        
            DELETE FROM ${table.tableName}
            
        
    #end

    

    

    






© 2015 - 2024 Weber Informatics LLC | Privacy Policy