From 052e1d5c47c4e536fde79074d53b0481c7d4f9b6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 13 十月 2021 18:33:42 +0800 Subject: [PATCH] 自动化代码生成优化 --- src/main/resources/generater/dao/mybatisDBXML.ftl | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/resources/generater/dao/mybatisDBXML.ftl b/src/main/resources/generater/dao/mybatisDBXML.ftl index 6456016..fb90129 100644 --- a/src/main/resources/generater/dao/mybatisDBXML.ftl +++ b/src/main/resources/generater/dao/mybatisDBXML.ftl @@ -17,32 +17,32 @@ </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> @@ -56,7 +56,7 @@ </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> -- Gitblit v1.8.0