Esempio n. 1
0
func (p *SysTable) Insert(data map[string]interface{}) {
	p.ctx.Put("Process", "login:insert")
	entityx := entity.CreateSysTable()
	var e df.Entity = entityx
	dfweb.MapToEntity(data, &e, "SysTable", false)
	//DupCheck
	if p.DupCheck(entityx) {
		panic("この tableName,Key1,Key2 は既に使用されています。")
	}
	_, err := bhv.SysTableBhv_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))
}
Esempio n. 2
0
func (p *Login) Insert(data map[string]interface{}) {
	p.ctx.Put("Process", "login:insert")
	entityx := entity.CreateLogin()
	var e df.Entity = entityx
	dfweb.MapToEntity(data, &e, "Login", false)
	if p.DupCheck(entityx) {
		panic("この 社員番号は既に使用されています。")
	}
	entityx.SetPassword(dfweb.CreateMd5(entityx.GetPassword()))
	_, err := bhv.LoginBhv_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))
}
Esempio n. 3
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)
}
Esempio n. 4
0
func (p *Login) Update(data map[string]interface{}) {
	p.ctx.Put("Process", "login:update")
	entityx := entity.CreateLogin()
	var e df.Entity = entityx
	dfweb.MapToEntity(data, &e, "Login", true)
	p.convertPassword(entityx)
	old := p.getOld(entityx.GetId())
	if entityx.GetLoginId() != old.GetLoginId() && p.DupCheck(entityx) {
		panic("この 社員番号は既に使用されています。")
	}
	_, err := bhv.LoginBhv_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))
}
Esempio n. 5
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)
}
func (p *TestTable) Update(data map[string]interface{}) {
	p.ctx.Put("Process", "testTable:update")
	entityx := entity.CreateTestTable()
	var e df.Entity = entityx
	dfweb.MapToEntity(data, &e, "TestTable", true)
	//DupCheck
	old := p.getOld(entityx.GetId())
	old = old
	if entityx.GetTestId() != old.GetTestId() &&
		p.DupCheck(entityx) {
		panic("この TestIdは既に使用されています。")
	}
	_, err := bhv.TestTableBhv_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))
}
Esempio n. 7
0
func (p *SysTable) Update(data map[string]interface{}) {
	p.ctx.Put("Process", "login:update")
	entityx := entity.CreateSysTable()
	var e df.Entity = entityx
	dfweb.MapToEntity(data, &e, "SysTable", 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.SysTableBhv_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))
}
Esempio n. 8
0
func (p *Employee) Update(data map[string]interface{}) {
	p.ctx.Put("Process", "employee:update")
	entityx := entity.CreateEmployee()
	var e df.Entity = entityx
	dfweb.MapToEntity(data, &e, "Employee", true)
	//DupCheck
	old := p.getOld(entityx.GetId())
	if entityx.GetEmpCd() != old.GetEmpCd() &&
		p.DupCheck(entityx) {
		panic("この EmpCdは既に使用されています。")
	}
	_, err := bhv.EmployeeBhv_I.Update(entityx, p.tx, p.ctx)
	if err != nil {
		panic("Update Error:" + err.Error())
	}
	ut := p.GetUserTableSec(entityx.GetSecId())
	var ee df.Entity = entityx
	rmap := p.EntityToMap(&ee)
	rmap["sec"] = dfweb.ConvWebData(ut.GetS1Data())
	p.context.JSON(200, dfweb.SetSingleFetchResult(rmap))
}