From 29af3b3b01ab035e3c2b07e5036d7a54f3afcb00 Mon Sep 17 00:00:00 2001 From: weijw <13718713024@163.com> Date: 2022年7月27日 12:07:32 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=94=9F=E6=88=90=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../code-generator/mybatis/mybatis.ftl | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/generator-web/src/main/resources/templates/code-generator/mybatis/mybatis.ftl b/generator-web/src/main/resources/templates/code-generator/mybatis/mybatis.ftl index d22cac04..4dd83469 100644 --- a/generator-web/src/main/resources/templates/code-generator/mybatis/mybatis.ftl +++ b/generator-web/src/main/resources/templates/code-generator/mybatis/mybatis.ftl @@ -19,6 +19,27 @@ + + + <#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0> + <#list classInfo.fieldList as fieldItem> + ${fieldItem.columnName} AS "${fieldItem.fieldName}"<#if fieldItem_has_next>, + + + + + + + <#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0> + <#list classInfo.fieldList as fieldItem> + + AND + ${fieldItem.columnName} = ${r"#{"}${fieldItem.fieldName}${r"}"} + + + + + INSERT INTO ${classInfo.originTableName}
@@ -78,12 +99,20 @@ + \ No newline at end of file From f0ad3eefd599cc9d9f870961bc28f70483011eff Mon Sep 17 00:00:00 2001 From: weijw <13718713024@163.com> Date: 2022年7月27日 16:32:58 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84service=E3=80=81mapper=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 10 +++---- .../mybatis-plus/plusentity.ftl | 5 +++- .../code-generator/mybatis/mapper.ftl | 12 ++++---- .../code-generator/mybatis/model.ftl | 21 ++++---------- .../code-generator/mybatis/mybatis.ftl | 6 +++- .../code-generator/mybatis/service.ftl | 10 +++---- .../code-generator/mybatis/service_impl.ftl | 29 ++++++++----------- 7 files changed, 42 insertions(+), 51 deletions(-) diff --git a/generator-web/src/main/resources/application-dev.yml b/generator-web/src/main/resources/application-dev.yml index 42869ce0..0d9787d7 100644 --- a/generator-web/src/main/resources/application-dev.yml +++ b/generator-web/src/main/resources/application-dev.yml @@ -53,10 +53,10 @@ OEM: title: JAVA代码生成平台 slogan: For reducing the repetitive CRUD work description: SpringBootCodeGenerator(JAVA代码生成平台),又名`大狼狗代码生成器`、`SQL转JAVA`、`SQL转JPA`、`SQL转Mybatis`、`Mybatis在线生成器`、`SQL转Java JPA、MYBATIS实现类代码生成平台`。 - author: zhengkai.blog.csdn.net - packageName: com.software.system - copyright: powered by Moshow郑锴(大狼狗) - returnUtilSuccess: ReturnT.success - returnUtilFailure: ReturnT.error + author: weijw + packageName: com.easyhome.xxx + copyright: easyhome + returnUtilSuccess: Response.buildSuccess + returnUtilFailure: Response.buildFailed outputStr: zhengkai.blog.csdn.net mode: local diff --git a/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusentity.ftl b/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusentity.ftl index 52134edb..1904e8b9 100644 --- a/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusentity.ftl +++ b/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusentity.ftl @@ -16,7 +16,10 @@ import io.swagger.annotations.ApiModelProperty; * @author ${authorName} * @date ${.now?string('yyyy-MM-dd')} */ -<#if isLombok?exists && isLombok==true>@Data<#if isSwagger?exists && isSwagger==true> +<#if isLombok?exists && isLombok==true> + @Data + @NoArgsConstructor +<#if isSwagger?exists && isSwagger==true> @ApiModel("${classInfo.classComment}") public class ${classInfo.className} implements Serializable { diff --git a/generator-web/src/main/resources/templates/code-generator/mybatis/mapper.ftl b/generator-web/src/main/resources/templates/code-generator/mybatis/mapper.ftl index e7dc9ef5..4726c388 100644 --- a/generator-web/src/main/resources/templates/code-generator/mybatis/mapper.ftl +++ b/generator-web/src/main/resources/templates/code-generator/mybatis/mapper.ftl @@ -19,41 +19,41 @@ public interface ${classInfo.className}Mapper { * @author ${authorName} * @date ${.now?string('yyyy/MM/dd')} **/ - int insert(${classInfo.className} ${classInfo.className?uncap_first}); + int insert(${classInfo.className}PO ${classInfo.className?uncap_first}); /** * 刪除 * @author ${authorName} * @date ${.now?string('yyyy/MM/dd')} **/ - int delete(int id); + int delete(Long id); /** * 更新 * @author ${authorName} * @date ${.now?string('yyyy/MM/dd')} **/ - int update(${classInfo.className} ${classInfo.className?uncap_first}); + int update(${classInfo.className}PO ${classInfo.className?uncap_first}); /** * 查询 根据主键 id 查询 * @author ${authorName} * @date ${.now?string('yyyy/MM/dd')} **/ - ${classInfo.className} load(int id); + ${classInfo.className}PO load(Long id); /** * 查询 分页查询 * @author ${authorName} * @date ${.now?string('yyyy/MM/dd')} **/ - List<${classinfo.classname}> pageList(int offset,int pagesize); + List<${classinfo.classname}po> pageList(${classInfo.className}Req req); /** * 查询 分页查询 count * @author ${authorName} * @date ${.now?string('yyyy/MM/dd')} **/ - int pageListCount(int offset,int pagesize); + int pageListCount(${classInfo.className}Req req); } diff --git a/generator-web/src/main/resources/templates/code-generator/mybatis/model.ftl b/generator-web/src/main/resources/templates/code-generator/mybatis/model.ftl index 3e94df70..f4f938ef 100644 --- a/generator-web/src/main/resources/templates/code-generator/mybatis/model.ftl +++ b/generator-web/src/main/resources/templates/code-generator/mybatis/model.ftl @@ -8,7 +8,11 @@ import java.util.List; * @author ${authorName} * @date ${.now?string('yyyy-MM-dd')} */ -public class ${classInfo.className} implements Serializable { +<#if isLombok?exists && isLombok==true> +@Data +@NoArgsConstructor + +public class ${classInfo.className}PO implements Serializable { private static final long serialVersionUID = 1L; @@ -22,19 +26,4 @@ public class ${classInfo.className} implements Serializable { -<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0> - public ${classInfo.className}() { - } - -<#list classInfo.fieldList as fieldItem> - public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() { - return ${fieldItem.fieldName}; - } - - public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) { - this.${fieldItem.fieldName} = ${fieldItem.fieldName}; - } - - - } diff --git a/generator-web/src/main/resources/templates/code-generator/mybatis/mybatis.ftl b/generator-web/src/main/resources/templates/code-generator/mybatis/mybatis.ftl index 4dd83469..ca86000b 100644 --- a/generator-web/src/main/resources/templates/code-generator/mybatis/mybatis.ftl +++ b/generator-web/src/main/resources/templates/code-generator/mybatis/mybatis.ftl @@ -104,9 +104,13 @@ LIMIT ${r"#{page}"}, ${r"#{pageSize}"} +
+ + ${r"#{offset}"}, ${r"#{limit}"} + + -