mysql basemapper_Mybatis-Plus BaseMapper的用法详解

1、如何使用BaseMapper进行数据库的操作。2、使用BaseMapper进行插入实体时如何让UUID的主键自动生成。Student实体类,其中id属性主键为UUIDpackage com.huixiaoer.ant.api.model.bean;import com.baomidou.mybatisplus.annotation.IdType;import com.baomidou.myba...
摘要由CSDN通过智能技术生成

1、如何使用BaseMapper进行数据库的操作。

2、使用BaseMapper进行插入实体时如何让UUID的主键自动生成。

Student实体类,其中id属性主键为UUID

package com.huixiaoer.ant.api.model.bean;

import com.baomidou.mybatisplus.annotation.IdType;

import com.baomidou.mybatisplus.annotation.TableId;

public class Student {

/**

*

* This field was generated by MyBatis Generator.

* This field corresponds to the database column student.id

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

@TableId(type= IdType.UUID)

private String id;

/**

*

* This field was generated by MyBatis Generator.

* This field corresponds to the database column student.user_name

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

private String userName;

/**

*

* This field was generated by MyBatis Generator.

* This field corresponds to the database column student.age

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

private Integer age;

/**

*

* This field was generated by MyBatis Generator.

* This field corresponds to the database column student.phone

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

private String phone;

/**

* This method was generated by MyBatis Generator.

* This method corresponds to the database table student

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

public Student(String id, String userName, Integer age, String phone) {

this.id = id;

this.userName = userName;

this.age = age;

this.phone = phone;

}

/**

* This method was generated by MyBatis Generator.

* This method corresponds to the database table student

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

public Student() {

super();

}

/**

* This method was generated by MyBatis Generator.

* This method returns the value of the database column student.id

*

* @return the value of student.id

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

public String getId() {

return id;

}

/**

* This method was generated by MyBatis Generator.

* This method sets the value of the database column student.id

*

* @param id the value for student.id

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

public void setId(String id) {

this.id = id == null ? null : id.trim();

}

/**

* This method was generated by MyBatis Generator.

* This method returns the value of the database column student.user_name

*

* @return the value of student.user_name

*

* @mbg.generated Thu Oct 31 14:09:39 CST 2019

*/

public String getUserName() {

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值