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 5bff4228..8e7b2163 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 @@ -7,6 +7,7 @@ import org.springframework.stereotype.Service; import com.bonus.material.ma.mapper.TypeKeeperMapper; import com.bonus.material.ma.domain.TypeKeeper; import com.bonus.material.ma.service.ITypeKeeperService; +import org.springframework.util.CollectionUtils; /** * 库管员配置Service业务层处理 @@ -59,7 +60,11 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { */ @Override public int insertTypeKeeper(List typeKeepers) { + if (CollectionUtils.isEmpty(typeKeepers)) { + return 0; + } typeKeepers.forEach(typeKeeper -> typeKeeper.setCreateTime(DateUtils.getNowDate())); + typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeepers); return typeKeeperMapper.insertTypeKeeper(typeKeepers); } @@ -106,6 +111,9 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { */ @Override public int deleteTypeKeeperByUserIdAndTypeId(List typeKeepers) { + if (CollectionUtils.isEmpty(typeKeepers)) { + return 0; + } return typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeepers); } }