예제 #1
0
func (p *Customer) InsertSub(data map[string]interface{}) map[string]interface{} {
	p.ctx.Put("Process", "godbfexan:insert")
	entityx := entity.CreateCustomer()
	var e df.Entity = entityx
	dfweb.MapToEntity(data, &e, "Customer", false)
	//DupCheck
	if p.DupCheck(entityx) {
		panic("この CustomerCodeは既に使用されています。")
	}
	_, err := bhv.CustomerBhv_I.Insert(entityx, p.tx, p.ctx)
	if err != nil {
		panic("Insert Error:" + err.Error())
	}
	var ee df.Entity = entityx
	rmap := p.EntityToMap(&ee)
	return dfweb.SetSingleFetchResult(rmap)
}
예제 #2
0
func (p *Customer) UpdateSub(data map[string]interface{}) map[string]interface{} {
	p.ctx.Put("Process", "godbfexan:update")
	entityx := entity.CreateCustomer()
	var e df.Entity = entityx
	dfweb.MapToEntity(data, &e, "Customer", true)
	//DupCheck
	old := p.getOld(entityx.GetId())
	if old.GetCusCd() != entityx.GetCusCd() &&
		p.DupCheck(entityx) {
		panic("この CustomerCodeは既に使用されています。")
	}
	_, err := bhv.CustomerBhv_I.Update(entityx, p.tx, p.ctx)
	if err != nil {
		panic("Update Error:" + err.Error())
	}
	var ee df.Entity = entityx
	rmap := p.EntityToMap(&ee)
	return dfweb.SetSingleFetchResult(rmap)
}