The save or insert method of Mybatis plus under the distributed microservice architecture does not return the primary key id

1. Personal problems

在服务A暴露接口实现层

insert image description here
interface
insert image description here

When service B calls the interface exposed by service A, save is the default method of IService. There is
insert image description here
a problem: when service B uses the save or insert method, the primary key id of the user will not be returned.

Two, solve

After testing, when the save or insert method is used in service A, the primary key id of the user will be returned.
So, use the save or insert method in service A and return the user's primary key id.

Define the saveUser method in service A, and return the user's primary key id after using the save or insert method.
Of course, you can also directly return the entire user entity class.
insert image description here

Then call the saveUser method in service B

insert image description here

Guess you like

Origin blog.csdn.net/weixin_46463341/article/details/127217866