Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {

plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.3.5'
id 'org.jetbrains.intellij' version '0.7.2'
}

//2.1 插件配置
Expand All @@ -17,7 +17,7 @@ apply plugin: 'idea'
apply plugin: 'org.jetbrains.intellij'

group 'com.bruce'
version '1.2.3-RELEASE'
version '1.2.4-RELEASE'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -42,12 +42,12 @@ intellij {
sandboxDirectory = "${rootProject.rootDir}/idea-sandbox"
// 开发环境运行时使用的版本 2018.1.6 LATEST-EAP-SNAPSHOT
//测试最新版本
// version '2018.1.6'
version '2018.1.6'
type 'IU'

localPath 'G:\\Program Files\\JetBrains\\IntelliJ IDEA 201.5616.10'
// localPath '/Users/wind/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/LATEST-EAP-SNAPSHOT/754a628dd74aa813e7ecac0f4179612ecee07de6/ideaIC-LATEST-EAP-SNAPSHOT'
// 依赖的插件
plugins = ['DatabaseTools', 'Velocity','Kotlin','Java']
plugins = ['DatabaseTools', 'Velocity','Kotlin','JavaEE']
//Disables updating since-build attribute in plugin.xml
updateSinceUntilBuild false
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
16 changes: 10 additions & 6 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@


<change-notes><![CDATA[
<p>1.2.3-RELEASE</p>
<ul>
<li>1.EasyCode插件支持MybatisCodeHelper插件 在resultMap中添加Table注释</li>
<li>2.支持Kotlin代码生成</li>
<li>3.兼容2020版本</li>
</ul>
<p>1.2.4-RELEASE</p>
<ul>
<li>1.新增mapper sql</li>
</ul>
<p>1.2.3-RELEASE</p>
<ul>
<li>1.EasyCode插件支持MybatisCodeHelper插件 在resultMap中添加Table注释</li>
<li>2.支持Kotlin代码生成</li>
<li>3.兼容2020版本</li>
</ul>
<p>1.2.2-RELEASE</p>
<ul>
<li>1.Fix unavailability of online import function.</li>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/globalConfig/Default/init.vm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
##初始化区域

##去掉表的t_前缀
$!tableInfo.setName($tool.getClassName($tableInfo.obj.name.replaceFirst("book_","")))
$!tableInfo.setName($tool.getClassName($tableInfo.obj.name.replaceFirst("t_","")))

##参考阿里巴巴开发手册,POJO 类中布尔类型的变量,都不要加 is 前缀,否则部分框架解析会引起序列化错误
#foreach($column in $tableInfo.fullColumn)
Expand Down
26 changes: 25 additions & 1 deletion src/main/resources/template/Default/dao.java.vm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public interface $!{tableName} {
*/
$!{tableInfo.name} queryById($!pk.shortType $!pk.name);

/**
* 通过ID查询单条数据
*
* @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象
* @return 实例对象
*/
$!{tableInfo.name} queryOne($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));

/**
* 查询指定行数据
*
Expand All @@ -40,7 +48,6 @@ public interface $!{tableName} {
*/
List<$!{tableInfo.name}> queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit);


/**
* 通过实体作为筛选条件查询
*
Expand All @@ -49,6 +56,23 @@ public interface $!{tableName} {
*/
List<$!{tableInfo.name}> queryAll($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));

/**
* 查询指定行数据
*
* @param offset 查询起始位置
* @param limit 查询条数
* @return 对象列表
*/
List<$!{tableInfo.name}> queryByLimit(@Param("$!tool.firstLowerCase($!{tableInfo.name})") $!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}), @Param("offset") int offset, @Param("limit") int limit);

/**
* 通过实体作为筛选条件查询
*
* @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象
* @return 行数
*/
int count($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));

/**
* 新增数据
*
Expand Down
49 changes: 49 additions & 0 deletions src/main/resources/template/Default/mapper.xml.vm
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,29 @@ $!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))
where $!pk.obj.name = #{$!pk.name}
</select>

<!--查询单个-->
<select id="queryOne" resultMap="BaseResultMap">
select
#allSqlColumn()

from $!{tableInfo.obj.parent.name}.$!tableInfo.obj.name
<where>
#foreach($column in $tableInfo.fullColumn)
<if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end">
and $!column.obj.name = #{$!column.name}
</if>
#end
</where>
limit 0, 1
</select>

<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="BaseResultMap">
select
#allSqlColumn()

from $!{tableInfo.obj.parent.name}.$!tableInfo.obj.name
order by id desc
limit #{offset}, #{limit}
</select>

Expand All @@ -52,6 +69,38 @@ $!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))
</if>
#end
</where>
order by id desc
</select>

<!--通过实体作为筛选条件查询-->
<select id="queryByLimit" resultMap="BaseResultMap">
select
#allSqlColumn()

from $!{tableInfo.obj.parent.name}.$!tableInfo.obj.name
<where>
#foreach($column in $tableInfo.fullColumn)
<if test="$!tool.firstLowerCase($!{tableInfo.name}).$!column.name != null#if($column.type.equals("java.lang.String")) and $!tool.firstLowerCase($!{tableInfo.name}).$!column.name != ''#end">
and $!column.obj.name = #{$!tool.firstLowerCase($!{tableInfo.name}).$!column.name}
</if>
#end
</where>
order by id desc
limit #{offset}, #{limit}
</select>

<!--聚合查询-->
<select id="count" resultType="java.lang.Integer">
select
count(1)
from $!{tableInfo.obj.parent.name}.$!tableInfo.obj.name
<where>
#foreach($column in $tableInfo.fullColumn)
<if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end">
and $!column.obj.name = #{$!column.name}
</if>
#end
</where>
</select>

<!--新增所有列-->
Expand Down