From 30d824eb001aa721dda824871ddace20cede567e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Thu, 16 Mar 2023 17:00:35 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20bug=E3=80=91=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=99=A8=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84?= =?UTF-8?q?PUT=E5=92=8CDELETE=E6=96=B9=E6=B3=95=E7=BB=9F=E4=B8=80=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BAPOST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/${entityName}Controller.javai | 7 +++++++ .../controller/${entityName}Controller.javai | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/jero-boot/jero-boot-module-system/src/main/resources/jero/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai b/jero-boot/jero-boot-module-system/src/main/resources/jero/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai index b16fb758..4448b8bb 100644 --- a/jero-boot/jero-boot-module-system/src/main/resources/jero/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai +++ b/jero-boot/jero-boot-module-system/src/main/resources/jero/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai @@ -18,6 +18,7 @@ import org.springframework.web.servlet.ModelAndView; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import com.jero.common.aspect.annotation.AutoLog; +import org.apache.commons.lang.StringUtils; <#assign bpm_flag=false> <#list originalColumns as po> @@ -116,6 +117,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en @ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除") @PostMapping(value = "/delete") public Result delete(@RequestBody Map map) { + if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){ + return Result.error("请选择数据!"); + } ${entityName?uncap_first}Service.deleteById(map.get("id")); return Result.OK("删除成功!"); } @@ -130,6 +134,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en @ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除") @PostMapping(value = "/deleteBatch") public Result deleteBatch(@RequestBody Map map) { + if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){ + return Result.error("请选择数据!"); + } this.${entityName?uncap_first}Service.deleteByIds(Arrays.asList(map.get("ids").split(","))); return Result.OK("批量删除成功!"); } diff --git a/jero-boot/jero-boot-module-system/src/main/resources/jero/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai b/jero-boot/jero-boot-module-system/src/main/resources/jero/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai index 1f61125d..72439943 100644 --- a/jero-boot/jero-boot-module-system/src/main/resources/jero/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai +++ b/jero-boot/jero-boot-module-system/src/main/resources/jero/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai @@ -32,6 +32,7 @@ import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSON; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang.StringUtils; /** * @Description: ${tableVo.ftlDescription} @@ -120,6 +121,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en @ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除") @PostMapping(value = "/delete") public Result delete(@RequestBody Map map) { + if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){ + return Result.error("请选择数据!"); + } ${entityName?uncap_first}Service.deleteById(map.get("id")); return Result.OK("删除成功!"); } @@ -134,6 +138,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en @ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除") @PostMapping(value = "/deleteBatch") public Result deleteBatch(@RequestBody Map map) { + if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){ + return Result.error("请选择数据!"); + } this.${entityName?uncap_first}Service.deleteByIds(Arrays.asList(map.get("ids").split(","))); return Result.OK("批量删除成功!"); }