实体类中id /** * 指定自增策略 */ @TableId(value = "id",type = IdType.AUTO) private int id;
service层中
@Service public class InformationService extends ServiceImpl<InformationMapper,Information> { @Autowired private InformationMapper informationMapper; public int add(Information information){ return informationMapper.insert(information); } }