#if(${enableCache})
#end
#if(${baseResultMap})
#foreach($field in ${table.fields})
#if(${field.keyFlag})##生成主键排在第一位
#set($keyPropertyName = ${field.propertyName})
#set($keyFieldName = ${field.name})
#end
#end
#foreach($field in ${table.commonFields})##生成公共字段
#end
#foreach($field in ${table.fields})
#if(!${field.keyFlag})##生成普通字段
#end
#end
#end
#if(${baseColumnList})
#foreach($field in ${table.commonFields})
#if(${field.name} == ${field.propertyName})${field.name}#else${field.name}#end,
#end
${table.fieldNames}
#end
#if(${keyPropertyName})
#end
#if(${keyPropertyName})
#end
INSERT INTO ${table.name}
#foreach($field in ${table.fields})
#if($!{velocityCount} == 1)
${field.name},
#else
${field.name},
#end
#end
VALUES
#foreach($field in ${table.fields})
#if($!{velocityCount} == 1)
#{${field.propertyName}},
#else
#{${field.propertyName}},
#end
#end
INSERT INTO ${table.name}
VALUES
#foreach($field in ${table.fields})
#{${field.propertyName}},
#end
#if(${keyPropertyName})
UPDATE ${table.name}
#foreach($field in ${table.fields})
#if(!${field.keyFlag})
${field.name}=#{et.${field.propertyName}},
#end
#end
WHERE ${keyFieldName}=#{et.${keyPropertyName}} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}
#end
#if(${keyPropertyName})
UPDATE ${table.name}
#foreach($field in ${table.fields})
#if(!${field.keyFlag})
${field.name}=#{et.${field.propertyName}},
#end
#end
WHERE ${keyFieldName}=#{et.${keyPropertyName}} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}
#end
UPDATE ${table.name}
#foreach($field in ${table.fields})
#if(!${field.keyFlag})
${field.name}=#{et.${field.propertyName}},
#end
#end
#foreach($field in ${table.fields})
#if($!{velocityCount} == 1)
${field.name}=#{ew.entity.${field.propertyName}}
#else
AND ${field.name}=#{ew.entity.${field.propertyName}}
#end
#end
${ew.sqlSegment}
${ew.sqlSegment}
#if(${keyPropertyName})
DELETE FROM ${table.name} WHERE ${keyFieldName}=#{${keyPropertyName}}
#end
DELETE FROM ${table.name}
${k} = #{cm[${k}]}
DELETE FROM ${table.name}
#foreach($field in ${table.fields})
#if($!{velocityCount} == 1)
${field.name}=#{ew.entity.${field.propertyName}}
#else
AND ${field.name}=#{ew.entity.${field.propertyName}}
#end
#end
${ew.sqlSegment}
${ew.sqlSegment}
#if(${keyPropertyName})
DELETE FROM ${table.name} WHERE ${keyFieldName} IN (
#{item}
)
#end