From d301c1785e178e2b16c3ebd516e1417507f3766e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=91=E5=B9=B4=E6=A2=A6=E4=B8=8E=E7=A0=96?= <2847127106@qq.com> Date: Thu, 22 Aug 2024 22:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E7=BC=BA=E5=B0=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/vm/java/controller.java.vm | 7 ++++--- src/main/resources/vm/java/serviceImpl.java.vm | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/resources/vm/java/controller.java.vm b/src/main/resources/vm/java/controller.java.vm index 3d3c6a3..3d5b999 100644 --- a/src/main/resources/vm/java/controller.java.vm +++ b/src/main/resources/vm/java/controller.java.vm @@ -1,8 +1,9 @@ package ${packageName}.controller; +import java.util.Arrays; import java.util.List; import jakarta.servlet.http.HttpServletResponse; - import javax.annotation.Resource; +import javax.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -85,7 +86,7 @@ public class ${ClassName}Controller extends BaseController public Result add( @Validated @RequestBody ${ClassName} ${className}) { - if (taskService.checkIdUnique(task)) { + if (${className}Service.checkIdUnique(${className})) { return error("新增 ${functionName} '" + ${className} + "'失败,${functionName}已存在"); } ${className}.setCreateBy(SecurityUtils.getUsername()); @@ -100,7 +101,7 @@ public class ${ClassName}Controller extends BaseController public Result edit( @Validated @RequestBody ${ClassName} ${className}) { - if (!taskService.checkIdUnique(task)) { + if (!${className}Service.checkIdUnique(${className})) { return error("修改 ${functionName} '" + ${className} + "'失败,${functionName}不存在"); } ${className}.setUpdateBy(SecurityUtils.getUsername()); diff --git a/src/main/resources/vm/java/serviceImpl.java.vm b/src/main/resources/vm/java/serviceImpl.java.vm index 4d0c840..38f1eca 100644 --- a/src/main/resources/vm/java/serviceImpl.java.vm +++ b/src/main/resources/vm/java/serviceImpl.java.vm @@ -70,7 +70,7 @@ public class ${ClassName}ServiceImpl if (StringUtils.isNotEmpty(${className}.get${AttrName}())){ queryWrapper.eq(${ClassName}::get${AttrName}, ${className}.get${AttrName}()); } - #elseif($queryType == "NE") + #elseif($queryType == "NE") if (StringUtils.isNotEmpty(${className}.get${AttrName}())){ queryWrapper.ne(${ClassName}::get${AttrName}, ${className}.get${AttrName}()); }