架構師成長記 第四周 01

2021-10-17 19:22:11 字數 1825 閱讀 8266

*	bean validation 中內建的 constraint

*@null 被注釋的元素必須為 null

*@notnull 被注釋的元素必須不為 null

*@asserttrue 被注釋的元素必須為 true

*@assertfalse 被注釋的元素必須為 false

*@min

(value) 被注釋的元素必須是乙個數字, 其值必須大於等於指定的最小值

*@max

(value) 被注釋的元素必須是乙個數字, 其值必須小於等於指定的最大值

*@decimalmin

(value) 被注釋的元素必須是乙個數字, 其值必須大於等於指定的最小值

*@decimalmax

(value) 被注釋的元素必須是乙個數字, 其值必須小於等於指定的最大值

*@size

(max=

, min=

) 被注釋的元素的大小必須在指定的範圍內

*@digits

(integer, fraction) 被注釋的元素必須是乙個數字, 其值必須在可接受的範圍內

*@past 被注釋的元素必須是乙個過去的日期

*@future 被注釋的元素必須是乙個將來的日期

*@pattern

(regex=

,flag=

) 被注釋的元素必須符合指定的正規表示式

* hibernate validator 附加的 constraint

*@notblank

(message =

) 驗證字串非null, 且長度必須大於0

*@email 被注釋的元素必須是電子郵箱位址

*@length

(min=

,max=

) 被注釋的字串的大小必須在指定的範圍內

*@notempty 被注釋的字串的必須非空

*@range

(min=

,max=

,message=

) 被注釋的元素必須在合適的範圍內

private long id;

@max

(value=

20, message="")

private integer age;

@notblank

(message="")

@length

(max=

6, min=

3, message="")

private string username;

@notblank

(message="")

@pattern

(regexp=

"/^(?![0-9]+$)(?![a-za-z]+$)[0-9a-za-z]$/"

, message="密碼必須是6

~10位數字和字母的組

private string password;

@pattern

(regexp=

"^((13[0-9])|(15[^4,\d])|(18[0,5-9]))\d$"

, message=

"手機號格式不正確"

架構師成長記 第二週 05

根據商品id查詢商品的評價等級數量 param itemid public commentlevelcountsvo querycommentcounts string itemid transactional propagation propagation.supports override pu...

架構師成長記 第三週 07

設定訂單超時 所以,這樣的定時任務只是適用於小型輕量級專案,傳統專案.自動生成cron表示式鏈結工具 關閉超時未支付的訂單 public void closeorder transactional propagation propagation.required override public vo...

學期第四周周記

用css html設計創作網頁版大白,實驗步驟源 來自 charset utf 8 baymaxtitle body baymax head eye,eye2 eye2 mouth torso,belly belly cover heart left arm,right arm right arm ...