diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java index 7b3b00e5..2adbd68d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java @@ -72,6 +72,18 @@ public class TypeKeeperController extends BaseController { return success(typeKeeperService.selectTypeKeeperByID(ID)); } + /** + * 新增库管员配置 + */ +// @ApiOperation(value = "新增库管员配置") +// @PreventRepeatSubmit +// @RequiresPermissions("ma:keeper:add") +// @SysLog(title = "库管员配置", businessType = OperaType.INSERT, module = "物资管理->新增库管员配置") +// @PostMapping +// public AjaxResult add(@RequestBody TypeKeeper typeKeeper) { +// return toAjax(typeKeeperService.insertTypeKeeper(typeKeeper)); +// } + /** * 新增库管员配置 */ @@ -80,8 +92,8 @@ public class TypeKeeperController extends BaseController { @RequiresPermissions("ma:keeper:add") @SysLog(title = "库管员配置", businessType = OperaType.INSERT, module = "物资管理->新增库管员配置") @PostMapping - public AjaxResult add(@RequestBody TypeKeeper typeKeeper) { - return toAjax(typeKeeperService.insertTypeKeeper(typeKeeper)); + public AjaxResult add(@RequestBody List typeKeepers) { + return toAjax(typeKeeperService.insertTypeKeeper(typeKeepers)); } /** @@ -112,13 +124,23 @@ public class TypeKeeperController extends BaseController { /** * 删除单个库管员配置 */ - @ApiOperation(value = "删除单个库管员配置") +// @ApiOperation(value = "删除单个库管员配置") +// @PreventRepeatSubmit +// @RequiresPermissions("ma:keeper:remove") +// @SysLog(title = "库管员配置", businessType = OperaType.DELETE, logType = 1,module = "物资管理->删除单个库管员配置") +// @DeleteMapping +// public AjaxResult remove(@RequestBody TypeKeeper typeKeeper) +// { +// return toAjax(typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(typeKeeper)); +// } + + @ApiOperation(value = "删除库管员配置") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:remove") @SysLog(title = "库管员配置", businessType = OperaType.DELETE, logType = 1,module = "物资管理->删除单个库管员配置") @DeleteMapping - public AjaxResult remove(@RequestBody TypeKeeper typeKeeper) + public AjaxResult remove(@RequestBody List typeKeepers) { - return toAjax(typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(typeKeeper)); + return toAjax(typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(typeKeepers)); } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java index c5c195a9..aeaaff0f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java @@ -38,10 +38,10 @@ public interface TypeKeeperMapper { /** * 新增库管员配置 * - * @param typeKeeper 库管员配置 + * @param typeKeepers 库管员配置 * @return 结果 */ - int insertTypeKeeper(TypeKeeper typeKeeper); + int insertTypeKeeper(List typeKeepers); /** * 修改库管员配置 @@ -59,11 +59,6 @@ public interface TypeKeeperMapper { */ int deleteTypeKeeperByID(Long ID); - /** - * 根据用户ID和物资类型ID删除库管员配置 - */ - int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper); - /** * 批量删除库管员配置 * @@ -71,4 +66,9 @@ public interface TypeKeeperMapper { * @return 结果 */ int deleteTypeKeeperByIDs(Long[] IDs); + + /** + * 根据用户ID和物资类型ID删除库管员配置 + */ + int deleteTypeKeeperByUserIdAndTypeId(List typeKeepers); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java index 6a129bda..efab85c3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java @@ -31,10 +31,10 @@ public interface ITypeKeeperService { /** * 新增库管员配置 * - * @param typeKeeper 库管员配置 + * @param typeKeepers 库管员配置 * @return 结果 */ - int insertTypeKeeper(TypeKeeper typeKeeper); + int insertTypeKeeper(List typeKeepers); /** * 修改库管员配置 @@ -63,8 +63,8 @@ public interface ITypeKeeperService { /** * 根据用户ID和物资类型ID删除库管员配置信息 * - * @param typeKeeper + * @param typeKeepers * @return */ - int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper); + int deleteTypeKeeperByUserIdAndTypeId(List typeKeepers); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java index dc6b184b..5bff4228 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java @@ -54,13 +54,13 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { /** * 新增库管员配置 * - * @param typeKeeper 库管员配置 + * @param typeKeepers 库管员配置 * @return 结果 */ @Override - public int insertTypeKeeper(TypeKeeper typeKeeper) { - typeKeeper.setCreateTime(DateUtils.getNowDate()); - return typeKeeperMapper.insertTypeKeeper(typeKeeper); + public int insertTypeKeeper(List typeKeepers) { + typeKeepers.forEach(typeKeeper -> typeKeeper.setCreateTime(DateUtils.getNowDate())); + return typeKeeperMapper.insertTypeKeeper(typeKeepers); } /** @@ -101,11 +101,11 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { /** * 根据用户ID和物资类型ID删除库管员配置信息 * - * @param typeKeeper + * @param typeKeepers * @return */ @Override - public int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper) { - return typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeeper); + public int deleteTypeKeeperByUserIdAndTypeId(List typeKeepers) { + return typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeepers); } } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml index 7e3a918f..e0c1df7c 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml @@ -37,21 +37,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into ma_type_keeper - - type_id, - user_id, - create_time, - update_time, - company_id, - - - #{typeId}, - #{userId}, - #{createTime}, - #{updateTime}, - #{companyId}, - + insert into ma_type_keeper (type_id,user_id,create_time,update_time,company_id) + values + + ( + #{item.typeId}, + #{item.userId}, + #{item.createTime}, + #{item.updateTime}, + #{item.companyId} + ) + @@ -90,6 +86,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from ma_type_keeper where user_id = #{userId} and type_id = #{typeId} + delete from ma_type_keeper where + type_id in + + ( + #{item.typeId} + ) + + and + user_id in + + ( + #{item.userId} + ) + \ No newline at end of file