func (p *UserTable) Insert(data map[string]interface{}) { p.ctx.Put("Process", "login:insert") entityx := entity.CreateUserTable() var e df.Entity = entityx dfweb.MapToEntity(data, &e, "UserTable", false) //DupCheck if p.DupCheck(entityx) { panic("この tableName,Key1,Key2 は既に使用されています。") } _, err := bhv.UserTableBhv_I.Insert(entityx, p.tx, p.ctx) if err != nil { panic("Insert Error:" + err.Error()) } var ee df.Entity = entityx rmap := p.EntityToMap(&ee) p.context.JSON(200, dfweb.SetSingleFetchResult(rmap)) }
func (p *UserTable) Update(data map[string]interface{}) { p.ctx.Put("Process", "login:update") entityx := entity.CreateUserTable() var e df.Entity = entityx dfweb.MapToEntity(data, &e, "UserTable", true) //DupCheck old := p.getOld(entityx.GetId()) if (entityx.GetTableName() != old.GetTableName() || entityx.GetKey1() != old.GetKey1() || entityx.GetKey2() != old.GetKey2()) && p.DupCheck(entityx) { panic("この tableName,Key1,Key2 は既に使用されています。") } _, err := bhv.UserTableBhv_I.Update(entityx, p.tx, p.ctx) if err != nil { panic("Update Error:" + err.Error()) } var ee df.Entity = entityx rmap := p.EntityToMap(&ee) p.context.JSON(200, dfweb.SetSingleFetchResult(rmap)) }