admin
2022-04-07 211840b64fa1132d76d6dff6c779e9ba2c0c450f
src/main/resources/generater/dao/mybatisDBXML.ftl
@@ -12,51 +12,51 @@
    <sql id="Base_Column_List">
        <trim suffixOverrides=",">
        <#list columnList as column>${column.column},</#list>
        ${identify.column},<#list columnList as column>${column.column},</#list>
        </trim>
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
            parameterType="java.lang.Long">
            parameterType="${identify.type}">
        select
        <include refid="Base_Column_List"/>
        from ${table} where ${identify.column} = <#noparse>#{</#noparse>id, jdbcType=${identify.jdbcType}}
    </select>
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
            parameterType="java.lang.Long">
            parameterType="${identify.type}">
        select
        <include refid="Base_Column_List"/>
        from ${table} where ${identify.column} = <#noparse>#{</#noparse>id,jdbcType=${identify.jdbcType}} for update
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <delete id="deleteByPrimaryKey" parameterType="${identify.type}">
        delete from
        ${table} where ${identify.column} = <#noparse>#{</#noparse>id,jdbcType=${identify.jdbcType}}
    </delete>
    <insert id="insert"
            parameterType="${entity.class}"
            parameterType="${entity.clazz}"
            useGeneratedKeys="true" keyProperty="${identify.property}">
        insert into
        ${table}
        <trim prefix="(" suffix=")" suffixOverrides=",">
        <#list columnList as column>
            ${column.column}},
            ${column.column},
        </#list>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
        <#list columnList as column>
            <#noparse>#{</#noparse>${column.property}},jdbcType=${column.jdbcType}},
            <#noparse>#{</#noparse>${column.property},jdbcType=${column.jdbcType}},
        </#list>
        </trim>
    </insert>
    <insert id="insertSelective"
            parameterType="${entity.class}"
            parameterType="${entity.clazz}"
            useGeneratedKeys="true" keyProperty="${identify.property}">
        insert into ${table}
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -74,7 +74,7 @@
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
            parameterType="${entity.class}">
            parameterType="${entity.clazz}">
        update ${table}
        <set>
            <if test="${identify.property} != null">${identify.column} = <#noparse>#{</#noparse>${identify.property},jdbcType=${identify.jdbcType}},</if>
@@ -85,7 +85,7 @@
        where ${identify.column} = <#noparse>#{</#noparse>${identify.property},jdbcType=${identify.jdbcType}}
    </update>
    <update id="updateByPrimaryKeySelective"
            parameterType="${entity.class}">
            parameterType="${entity.clazz}">
        update ${table}
        <set>
              <#list columnList as column>
@@ -110,6 +110,18 @@
             <#if query.queryType=="contains">
                and ${query.columnData.column} = '%<#noparse>#{</#noparse>query.${query.columnName}}%'
             </#if>
              <#if query.queryType=="gt">
                and ${query.columnData.column} > <#noparse>#{</#noparse>query.${query.columnName}}
              </#if>
              <#if query.queryType=="gte">
                and ${query.columnData.column} >= <#noparse>#{</#noparse>query.${query.columnName}}
              </#if>
              <#if query.queryType=="lt">
                and ${query.columnData.column} <![CDATA[<]]> <#noparse>#{</#noparse>query.${query.columnName}}
              </#if>
              <#if query.queryType=="lte">
                and ${query.columnData.column} <![CDATA[<=]]> <#noparse>#{</#noparse>query.${query.columnName}}
              </#if>
        </if>
        </#list>
    </sql>