MybatisPlus自動生成,簡單實用兩步走

2021-10-19 15:22:52 字數 1271 閱讀 4236

前言

>

>com.baomidou>

>mybatis-plus-generator>

>3.3.1.tmp>

>

>

>org.apache.velocity>

>velocity>

>1.7>

>

package com.example.mybatisplus;

import com.baomidou.mybatisplus.annotation.dbtype;

import com.baomidou.mybatisplus.generator.autogenerator;

import com.baomidou.mybatisplus.generator.config.datasourceconfig;

import com.baomidou.mybatisplus.generator.config.globalconfig;

import com.baomidou.mybatisplus.generator.config.packageconfig;

import com.baomidou.mybatisplus.generator.config.strategyconfig;

import com.baomidou.mybatisplus.generator.config.rules.namingstrategy;

/** * @author 袁浩東

* @description

* @date 2021/2/20 16:41

*/public

class

main

}

生成後如下圖

如何生成部分**?

//生成指定表

指定生成user表

Mybatis Plus自動填充

使用場景 專案中經常會遇到一些資料,每次都使用相同的方式填充,例如記錄的建立時間,更新時間等,完成這些欄位的賦值工作 1 資料庫表中新增自動填充字段 在表中新增datetime型別的新的字段 create time update time 2 實體上新增屬性和註解 data public class...

MybatisPlus 自動填充

專案中經常會遇到一些資料,每次都使用相同的方式填充,例如記錄的建立時間,更新時間等。我們可以使用mybatis plus的自動填充功能,完成這些欄位的賦值工作 在user表中新增datetime型別的新的字段 create time update time 實體上增加欄位並新增自動填充註解 tabl...

mybatis plus主鍵生成策略

我們平時使用主鍵時會為主鍵加上自增長策略,like this auto increment 但有時自增長策略並不能滿足我們的專案需求,那我們就需要加一些其他的生成策略。讓我們列一下幾種常用主鍵生成 策略,以及在專案中設定方法 no1自動增長 自動增長是我們見過的最基本的生成策略,它遵循的是從1開始依...