mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 10:48:15 +08:00
fix the logic for add HTTPRuleRewrite model
This commit is contained in:
parent
1d334ad4c1
commit
9168b0d58c
@ -325,13 +325,11 @@ func (h *HTTPRuleRewriteDaoTmpl) AddModel(mo model.Interface) error {
|
||||
return fmt.Errorf("can't not convert %s to *model.HTTPRuleRewrite", reflect.TypeOf(mo).String())
|
||||
}
|
||||
var oldHTTPRuleRewrite model.HTTPRuleRewrite
|
||||
if ok := h.DB.Where("uuid = ?", httpRuleRewrite.UUID).Find(&oldHTTPRuleRewrite).RecordNotFound(); ok {
|
||||
if err := h.DB.Create(httpRuleRewrite).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if ok := h.DB.Where("uuid = ?", httpRuleRewrite.UUID).Find(&oldHTTPRuleRewrite).RecordNotFound(); !ok {
|
||||
return fmt.Errorf("HTTPRuleRewrite already exists based on uuid(%s)", httpRuleRewrite.UUID)
|
||||
}
|
||||
return h.DB.Create(httpRuleRewrite).Error
|
||||
}
|
||||
|
||||
//UpdateModel -
|
||||
func (h *HTTPRuleRewriteDaoTmpl) UpdateModel(mo model.Interface) error {
|
||||
|
Loading…
Reference in New Issue
Block a user