diff --git a/src/main/java/com/dreamworks/boditech/controller/IdChipController.java b/src/main/java/com/dreamworks/boditech/controller/IdChipController.java index 8e1f7f6..233ff34 100644 --- a/src/main/java/com/dreamworks/boditech/controller/IdChipController.java +++ b/src/main/java/com/dreamworks/boditech/controller/IdChipController.java @@ -1,6 +1,7 @@ package com.dreamworks.boditech.controller; import com.dreamworks.boditech.controller.entity.ApiResponse; import com.dreamworks.boditech.entity.MdbIdChip; +import com.dreamworks.boditech.entity.parameter.ParamBatchDeleteById; import com.dreamworks.boditech.entity.parameter.ParamIdChipSearch; import com.dreamworks.boditech.service.IdChipService; import com.dreamworks.boditech.utils.MyCommon; @@ -39,7 +40,8 @@ public class IdChipController extends BaseController { @ResponseBody @RequestMapping("/api/id-chip/batch-delete") - public ApiResponse batchDelete() { + public ApiResponse batchDelete(@RequestBody ParamBatchDeleteById params) { + this.idChipService.batchDelete(params.idList); return this.success(); } } diff --git a/src/main/java/com/dreamworks/boditech/entity/parameter/ParamBatchDeleteById.java b/src/main/java/com/dreamworks/boditech/entity/parameter/ParamBatchDeleteById.java index e455aaf..854a48e 100644 --- a/src/main/java/com/dreamworks/boditech/entity/parameter/ParamBatchDeleteById.java +++ b/src/main/java/com/dreamworks/boditech/entity/parameter/ParamBatchDeleteById.java @@ -1,2 +1,5 @@ -package com.dreamworks.boditech.entity.parameter;public class ParamBatchDeleteById { +package com.dreamworks.boditech.entity.parameter; +import java.util.List; +public class ParamBatchDeleteById { + public List idList; } diff --git a/src/main/java/com/dreamworks/boditech/mapper/IdChipMapper.java b/src/main/java/com/dreamworks/boditech/mapper/IdChipMapper.java index cfcc693..a84deae 100644 --- a/src/main/java/com/dreamworks/boditech/mapper/IdChipMapper.java +++ b/src/main/java/com/dreamworks/boditech/mapper/IdChipMapper.java @@ -14,4 +14,7 @@ public interface IdChipMapper { @Select("SELECT COUNT(id) FROM bdt_id_chips") Integer count(ParamIdChipSearch param); + + @Select("DELETE FROM bdt_id_chips WHERE id = #{id}") + void deleteById(Integer id); } diff --git a/src/main/java/com/dreamworks/boditech/service/IdChipService.java b/src/main/java/com/dreamworks/boditech/service/IdChipService.java index b70a579..786cdb4 100644 --- a/src/main/java/com/dreamworks/boditech/service/IdChipService.java +++ b/src/main/java/com/dreamworks/boditech/service/IdChipService.java @@ -24,4 +24,11 @@ public class IdChipService { public Integer count (ParamIdChipSearch param) { return this.idChipMapper.count(param); } + + // batch delete + public void batchDelete (List ids) { + for ( Integer id : ids ) { + this.idChipMapper.deleteById(id); + } + } }