pojo
package com.offcn.mp.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@Data
@TableName("t_employee")
public class Employee {
@TableId(type = IdType.AUTO)
private Long empId;
@TableField("emp_name")
private String name;
private String empGender;
private Integer age;
private String email;
@TableField(exist = false)
private String remark;
}
mapper
package com.offcn.mp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.offcn.mp.entity.Employee;
public interface EmployeeMapper extends BaseMapper<Employee> {
}
主启动类
package com.offcn.mp; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @MapperScan("com.offcn.mp.mapper") public class Day16SpringbootMybatisplus01Application { public static void main(String[] args) { SpringApplication.run(Day16SpringbootMybatisplus01Application.class, args); } }
测试