mybatisplus簡略筆記

2021-09-27 11:32:40 字數 2072 閱讀 8808

public class programmeasuredataentity extends model {}

底層生成sql時,會將表名駝峰岔開,以_連線,例:program_measure_data_entity

解決:宣告式表名

@tablename(value = 「program_measure_data」)

@tableid

(value =

"id"

,type = idtype.auto)

在字段上加上該註解  @tablefield(exist = false)
# = mybaits 配置

mybatis-plus:

typealiasespackage: com.lenovo.sdms.**

.domain

global-config:

id-type:

2 field-strategy:

0 db-column-underline:

true

true

db-config:

update-strategy: ignored

configuration:

map-underscore-to-camel-

case

:true

cache-enabled:

true

@tablefield

(value =

"threshold_value"

, updatestrategy = fieldstrategy.ignored)

private bigdecimal thresholdvalue;

1)實現 metaobjecthandler

@component

public

class

metaobjecthandlerconfig

implements

metaobjecthandler

@override

public

void

updatefill

(metaobject metaobject)

}

2)實體類中為字段加入填充策略

@tablefield

(value =

"creator"

, fill = fieldfill.insert)

private string creator;

@tablefield

(value =

"modifier"

, fill = fieldfill.update)

private string modifier;

@tablefield

(value =

"modify_date"

, fill = fieldfill.insert_update, update=

"now()"

)private date modifydate;

and (… or …or…)

new<

>()

;string type =

(string) map.

get(

"type");

if(stringutils.

isnotblank

(type)

)string keys =

(string) map.

get(

"key");

if(stringutils.

isnotblank

(keys))或者

and>

for(

int i =

0; i < county.

size()

; i++)or

().like

("country"

, county.

get(i));

}});

CSCOPE用法簡略筆記

bin sh find name h o name c o name cc cscope.files cscope bkq i cscope.files my usage cscope q d i cscope.files f cscope.out d do not update the datab...

Mybatis Plus學習筆記

實體類屬性 建立日期 tablefield fill fieldfill.insert private date createtime 更新日期 tablefield fill fieldfill.insert update private date updatetime 3.0版本之前的配置類 c...

個人筆記之MyBatis Plus

1 table類的註解 tablename 用於實體類對應表明 tableid 用於實體類id對應表的id tabelfiels 用於實體類中的物件對應表中的表名 2 雪花演算法 也可不做任何自增設置,新增資料會自增生成id tableid type idtype.id worker 唯一id ta...