Mybatis-Plus返回自增的主键Id @Override@Transactional(rollbackFor = Exception.class)public void saveBaseAttrInfo(BaseAttrInfo baseAttrInfo) {//1,平台属性信息 判断是修改还是添加if(baseAttrInfo.getId() != null){baseAttrInfoMapper.updateById(baseAttrInfo);}else{baseAttrInfoMapper.insert(baseAttrInfo);}//=====================//在MyBatis-Plus的插入操作中,底层会通过数据库的返回机制来获取自动生成的主键值,并将其赋值给实体类中的id字段。//因此,在执行baseAttrInfoMapper.insert(baseAttrInfo)后,如果生成成功,实体类baseAttrInfo中会被自动填充生成的id值。//=====================//2.平台属性值 先删除再进行修改QueryWrapper<BaseAttrValue> wrapper = new QueryWrapper<BaseAttrValue>();wrapper.eq("attr_id",baseAttrInfo.getId());baseAttrValueMapper.delete(wrapper);List<BaseAttrValue> attrValueList = baseAttrInfo.getAttrValueList();if (attrValueList != null && attrValueList.size() > 0){for(BaseAttrValue baseAttrValue : attrValueList){baseAttrValue.setAttrId(baseAttrInfo.getId());baseAttrValueMapper.insert(baseAttrValue);}}}