com.base4j.mybatis.sql.template.ftl.oracle.ftl Maven / Gradle / Ivy
The newest version!
<#if cache?? && cache == "MYBATIS">
#if>
<#list entityClassColumns as column>
<#if column.id>
jdbcType="${column.jdbcTypeName}"#if>
property="${column.property}"/>
#if>
#list>
<#list entityClassColumns as column>
<#if !column.id>
jdbcType="${column.jdbcTypeName}"#if>
property="${column.property}"/>
#if>
#list>
<#list mybatisAssociations as association>
<#list association.resultMap as result>
<#if result.id>
jdbcType="${result.jdbcTypeName}"#if>
property="${result.property}"/>
#if>
#list>
<#list association.resultMap as result>
<#if !result.id>
jdbcType="${result.jdbcTypeName}"#if>
property="${result.property}"/>
#if>
#list>
#list>
<#list mybatisConnections as connection>
<#list connection.resultMap as result>
<#if result.id>
jdbcType="${result.jdbcTypeName}"#if>
property="${result.property}"/>
#if>
#list>
<#list connection.resultMap as result>
<#if !result.id>
jdbcType="${result.jdbcTypeName}"#if>
property="${result.property}"/>
#if>
#list>
#list>
select SEQ_${name}_ID.NEXTVAL as ID from DUAL
<#list entityClassPKColumns as column>
select ${r'#{'}${column.property}<#if column.jdbcTypeName??>
,jdbcType=${column.jdbcTypeName}#if>${r'}'} as ID from DUAL
#list>
insert into ${name}
<#list entityClassColumns as column>
<#if column.id>
${column.column},
<#else>
${column.column},
#if>
#list>
<#list entityClassColumns as column>
<#if column.id>
${r'#{'}${column.property}<#if column.jdbcTypeName??>, jdbcType=${column.jdbcTypeName}#if>${r'}'},
<#else >
${r'#{'}${column.property}<#if column.jdbcTypeName??>, jdbcType=${column.jdbcTypeName}#if>${r'}'},
#if>
#list>
INSERT ALL
INTO ${name}
<#list entityClassColumns as column>
${column.column},
#list>
VALUES
<#list entityClassColumns as column>
${r'#{'}record.${column.property}<#if column.jdbcTypeName??>, jdbcType=${column.jdbcTypeName}#if>${r'}'},
#list>
SELECT 1 FROM DUAL
update ${name}
<#list entityClassColumns as column>
<#if !column.id>
${column.column} = ${r'#{'}${column.property}<#if column.jdbcTypeName??>,
jdbcType=${column.jdbcTypeName}#if>${r'}'},
#if>
#list>
<#list entityClassPKColumns as column>
${column.column} = ${r'#{'}${column.property}<#if column.jdbcTypeName??>,
jdbcType=${column.jdbcTypeName}#if>${r'}'} and
#list>
update ${name}
<#list entityClassColumns as column>
<#if !column.id>
${column.column} = ${r'#{'}${column.property}<#if column.jdbcTypeName??>,
jdbcType=${column.jdbcTypeName}#if>${r'}'},
#if>
#list>
<#list entityClassPKColumns as column>
${column.column} = ${r'#{'}${column.property}<#if column.jdbcTypeName??>,
jdbcType=${column.jdbcTypeName}#if>${r'}'} and
#list>
update ${name}
<#list entityClassColumns as column>
<#if !column.id>
${column.column} = ${r'#{record.'}${column.property}<#if column.jdbcTypeName??>
,jdbcType=${column.jdbcTypeName}#if>${r'}'},
#if>
#list>
and ${r'${criterion.condition}'}
and ${r'${criterion.condition} #{criterion.value}'}
and ${r'${criterion.condition} #{criterion.value} and #{criterion.secondValue}'}
and ${r'${criterion.condition}'}
${r'#{listItem}'}
1 = -1
1 = -1
update ${name}
<#list entityClassColumns as column>
${column.column} = ${r'#{record.'}${column.property}<#if column.jdbcTypeName??>,
jdbcType=${column.jdbcTypeName}#if>${r'}'},
#list>
and ${r'${criterion.condition}'}
and ${r'${criterion.condition} #{criterion.value}'}
and ${r'${criterion.condition} #{criterion.value} and #{criterion.secondValue}'}
and ${r'${criterion.condition}'}
${r'#{listItem}'}
1 = -1
1 = -1
delete from ${name}
<#list entityClassPKColumns as column>
${column.column} = ${r'#{'}${column.property}<#if column.jdbcTypeName??>,
jdbcType=${column.jdbcTypeName}#if>${r'}'} and
#list>
delete from ${name}
1 = -1
1 = -1
and ${r'${criterion.condition}'}
and ${name}.${r'${criterion.condition} #{criterion.value}'}
and ${name}.${r'${criterion.condition} #{criterion.value} and #{criterion.secondValue}'}
and ${name}.${r'${criterion.condition}'}
${r'#{listItem}'}