簡化單錶的crud基本**.
假設現在有**
字段型別
idint
name
varchar
建立 controller 類
建立 service 類
建立 一些驗證方法
組合起來
@restcontroller
("/demo"
)public
class
projectdemocontroller
else
}}
@crudcontroller
(uri =
"/project/demo"
, idtype = integer.
class
)public
class
projectint
extends
absentity
implements
serializable
public
void
setname
(string name)
}
@cachekey
(type = projectint.
class
,key =
"asdc"
)public
inte***ce
extends
a) "
)@options
(usegeneratedkeys =
true
, keyproperty =
"id"
, keycolumn =
"id"
)int
insertselective
(projectint record)
;@override
@select
("select * from project_int where id = # "
) projectint selectbyprimarykey
(@param
("id"
) integer integer)
;@override
@delete
("delete from `dest`.`project_int` where `id` = # "
)int
deletebyprimarykey
(@param
("id"
) integer integer)
;@override
@update
("update `dest`.`project_int` set `name` = # where `id`= # "
)int
updatebyprimarykeyselective
(projectint record);}
註冊 servlet
@bean
servletregistrationbean myservletregistration()
許可權驗證:在使用了兩個servlet後通過***驗證會有問題,請使用 filter 進行許可權驗證
自定義入參驗證
@service
public
class
projectintvalidated
implements
validatedinte***ce
public
void
validatedelete
(projectint projectint)
public
void
validateadd
(projectint projectint)
public
void
validatebyid
(projectint projectint)
public
void
validateeditor
(projectint projectint)
}
public
class
issuesentity
implements
baseentity
@cachekey
(key =
"issues"
, type = issuesentity.
class
)public
inte***ce
extends
a)")
@options
(usegeneratedkeys =
true
, keyproperty =
"id"
, keycolumn =
"id"
)int
insertselective
(issuesentity record)
;@select
("select id as id , new_title as newtitle from issue where id = # "
) issuesentity selectbyprimarykey
(integer integer)
;@override
@update
("update `issue` set `new_title` = # where `id` = # "
)int
updatebyprimarykeyselective
(issuesentity record)
;@override
@delete
("delete from issue where id = #"
)int
deletebyprimarykey
(integer integer)
;}
@autowired
private crudfacade
> crudfacade;
@test
void
testinsert()
@cachekey(key = "tt", type = issuesentity.class, idmethod = "ooo")
public class issuesentity implements baseentity
@autowired
private crudentityfacade
crudentityfacade;
@test
void
testinsert()
具體用例請檢視:
目前 redis 僅支援 hash 操作
歡迎各位提出意見 :
ui設計的思考
主路線 貫穿部件豎向的路線,部件總高度的確定路線。一般有兩種方式,直接固定總高 部件 間距的傳遞。一般只有一條主路線。除非你希望高度是多條路線競爭的結果。其他部件的位置可根據主路線中的部件位置做相對位置擺放。其他部件的位置也可根據主路線中得指定區域,根據布局重心和本身尺寸確定位置。容錯間距 在其他間...
程式和介面簡潔化設計的思考
一年前,在被面試過程中,有很多面試官以各種方式問我 你會哪些計算機技能?此時我總會幾乎不停頓地說出幾十個名詞 此處省略100字 面試官有點吃驚,然後他會在其中挑幾個他最擅長的技能,然後把我的自信心徹底打敗。不過好像是真的,越牛的人,簡歷越短。我也許是眾多程式設計師的乙個縮影,每個同學都希望自己掌握更...
程式和介面簡潔化設計的思考
一年前,在被面試過程中,有很多面試官以各種方式問我 你會哪些計算機技能?此時我總會幾乎不停頓地說出幾十個名詞 此處省略100字 面試官有點吃驚,然後他會在其中挑幾個他最擅長的技能,然後把我的自信心徹底打敗。不過好像是真的,越牛的人,簡歷越短。我也許是眾多程式設計師的乙個縮影,每個同學都希望自己掌握更...