Browse Source

fixed 293

jobob 8 years ago
parent
commit
af9666b9a0

+ 3 - 0
src/main/resources/templates/mapper.xml.vm

@@ -29,6 +29,9 @@
 #if(${baseColumnList})
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
+		#foreach($field in ${table.commonFields})
+			#if(${field.name} == ${field.propertyName})${field.name}#else${field.name} AS ${field.propertyName}#end,
+		#end
         ${table.fieldNames}
     </sql>
 

+ 2 - 2
src/test/java/com/baomidou/mybatisplus/test/generator/MysqlGenerator.java

@@ -59,7 +59,7 @@ public class MysqlGenerator {
         gc.setActiveRecord(true);// 开启 activeRecord 模式
         gc.setEnableCache(false);// XML 二级缓存
         gc.setBaseResultMap(true);// XML ResultMap
-        gc.setBaseColumnList(false);// XML columList
+        gc.setBaseColumnList(true);// XML columList
         gc.setAuthor("Yanghu");
 
         // 自定义文件命名,注意 %s 会自动填充表实体属性!
@@ -98,7 +98,7 @@ public class MysqlGenerator {
         // 自定义实体父类
         // strategy.setSuperEntityClass("com.baomidou.demo.TestEntity");
         // 自定义实体,公共字段
-        // strategy.setSuperEntityColumns(new String[] { "test_id", "age" });
+        strategy.setSuperEntityColumns(new String[] { "test_id", "age" });
         // 自定义 mapper 父类
         // strategy.setSuperMapperClass("com.baomidou.demo.TestMapper");
         // 自定义 service 父类