From 211840b64fa1132d76d6dff6c779e9ba2c0c450f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 07 四月 2022 19:13:54 +0800
Subject: [PATCH] 优化自动化代码

---
 src/main/resources/generater/dao/mybatisDBXML.ftl |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/main/resources/generater/dao/mybatisDBXML.ftl b/src/main/resources/generater/dao/mybatisDBXML.ftl
index 6456016..59939c2 100644
--- a/src/main/resources/generater/dao/mybatisDBXML.ftl
+++ b/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>

--
Gitblit v1.8.0