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

easymybatis.tpl.postgresql.vm Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
#set($jq="$")



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

	
    

	
    
    
    
    
	
	
	
	
	
	
	

	
    
#if(${pk.isUuid})
	
            SELECT UUID()
    
#end
	INSERT INTO "${table.tableName}"
         (
 #set ($i=0) 
        #foreach($column in $columns) 
            #if(!${column.isIdentityPk})               
        #if($i > 0),#end "${column.columnName}"
#set($i=$i +1)
            #end          
        #end
          )
	VALUES (
 #set ($i=0) 
        #foreach($column in $columns) 
            #if(!${column.isIdentityPk})               
        #if($i > 0),#end ${column.mybatisInsertValue}
#set($i=$i +1)
            #end          
        #end
 
        )
	
    
    
    
        #if(${pk.isUuid})
	
            SELECT UUID()
    
	#end
        INSERT INTO "${table.tableName}"
    
        	 

            #foreach($column in $columns) 
                #if(!${column.isIdentityPk}) 
                    #if(${column.hasTypeHandlerInsert})
                        "${column.columnName}",
                    #else
                        
                       "${column.columnName}",
                        
                    #end
                #end          
            #end
        
                    
            #foreach($column in $columns) 
                #if(!${column.isIdentityPk})  
                    #if(${column.hasTypeHandlerInsert})
                        ${column.mybatisInsertValue},
                    #else
                        
                        ${column.mybatisInsertValue},
                        
                    #end
                #end          
            #end
        
    

	
    
		INSERT INTO "${table.tableName}" 
		(
 #set ($i=0) 
        #foreach($column in $columns) 
            #if(!${column.isIdentityPk})               
        #if($i > 0),#end "${column.columnName}"
#set($i=$i +1)
            #end          
        #end
          )
		VALUES 
		
        ( #set ($i=0)
        #foreach($column in $columns) 
            #if(!${column.isIdentityPk})               
         	#if($i > 0),#end ${column.mybatisInsertValuePrefix}
         	#set($i=$i +1)
            #end          
        #end
        )
		
	


	 
    
		INSERT INTO "${table.tableName}"
		
			${jq}{column.columnName}
		
		VALUES 
		
        ( 
        	
        		#{entity.${column.alias} ${column.typeHandler}}
        	
        )
        
	
	
	
    
		INSERT INTO "${table.tableName}" 
		(
 #set ($i=0) 
        #foreach($column in $columns) 
            #if(!${column.isIdentityPk})               
        #if($i > 0),#end "${column.columnName}"
#set($i=$i +1)
            #end          
        #end
          )
		
        SELECT  #set ($i=0)
        #foreach($column in $columns) 
            #if(!${column.isIdentityPk})               
         	#if($i > 0),#end ${column.mybatisInsertValuePrefix}
         	#set($i=$i +1)
            #end          
        #end        
		
	
	
	
    
		INSERT INTO "${table.tableName}"
		
			"${jq}{column.columnName}"
		
		
        SELECT  
        	
        		#{entity.${column.alias} ${column.typeHandler}}
        	
        
	

	
    
    UPDATE "${table.tableName}"
     		
     #foreach($column in $columns) 
         #if(!${column.isPk})               
         "${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.isPk})  
                #if(${column.hasTypeHandlerUpdate})
                    "${column.columnName}"=${column.mybatisUpdateValue},
                #else
                    
                    "${column.columnName}"=${column.mybatisUpdateValue},
                    
                #end
            #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.isPk})  
                #if(${column.hasTypeHandlerUpdate})
                    "${column.columnName}"=${column.mybatisUpdateValuePrefix},
                #else
                    
                    "${column.columnName}"=${column.mybatisUpdateValuePrefix},
                    
                #end
            #end          
        #end
    
    
    	
	
	
	
		#if(${table.hasLogicDeleteColumn})            
            UPDATE ${table.tableName}
            
                #foreach($column in $columns) 
                    #if(${column.isPk})  
                    #elseif(${column.isLogicDelete})
                        ${table.logicDeleteColumn.columnName} = ${table.logicDeleteColumn.logicDeleteValueString},
                    #else
                        
                            ${column.columnName}=${column.mybatisUpdateValue},
                        
                    #end          
                #end
            
            WHERE ${pk.columnName} = #{${pk.javaFieldName}}
            AND ${table.logicDeleteColumn.columnName} = ${table.logicDeleteColumn.logicNotDeleteValueString}
            #if(${table.hasVersionColumn})
                AND ${table.versionColumn.columnName} = #{${table.versionColumn.javaFieldName}} 
            #end    
       #else
            DELETE FROM ${table.tableName}
            WHERE ${pk.columnName} = #{${pk.javaFieldName}}
       #end
	    
    
    
    
		DELETE FROM "${table.tableName}"
		
	
	
	
    
    





© 2015 - 2024 Weber Informatics LLC | Privacy Policy