func (p *Login) LogoutExec(c *gin.Context) {
	session, _, tx, ctx := util.GetSessionLogin(c, "logout")
	defer dfweb.ErrorRecover(c, tx)
	session.SetDelFlag(1)
	bhv.SessionBhv_I.Update(session, tx, ctx)
	c.JSON(200, dfweb.SetSingleFetchResult("OK"))
}
func (p *Login) LoginauthExec(c *gin.Context) {
	tx, err := util.GetTx()
	defer dfweb.ErrorRecover(c, tx)
	if err != nil {
		panic("Get Transaction Error:" + err.Error())
	}
	json := dfweb.GetBodyJson(c)
	login := p.getLoginFromLoginId(json, tx)
	if login == nil {
		c.JSON(200, dfweb.SetErrorMessage("ユーザー IDが見つかりません"))
		return
	}
	password := json["password"]
	if password == nil {
		c.JSON(200, dfweb.SetErrorMessage("パスワードがありません"))
		return
	}
	pwd := dfweb.CreateMd5(password.(string))
	if login.GetPassword() != pwd {
		c.JSON(200, dfweb.SetErrorMessage("passwordが違います"))
		return
	}
	ctx := util.CreateContextFromLogin("loginauth", login)
	session := p.createNewSession(login, tx, ctx)
	loginInfo := p.createLoginInfo(login)
	p.addUuidCookie(c, session.GetUuid())
	c.JSON(200, dfweb.SetSingleFetchResult(loginInfo))
}
func (p *SysTable) Delete(id float64) {
	p.ctx.Put("Process", "login:delete")
	entityx := p.getOld(int64(id))
	entityx.SetDelFlag(p.getDelFlagMaxValue(entityx) + 1)
	_, err := bhv.SysTableBhv_I.Update(entityx, p.tx, p.ctx)
	if err != nil {
		panic("Delete Error:" + err.Error())
	}
	var ee df.Entity = entityx
	rmap := p.EntityToMap(&ee)
	p.context.JSON(200, dfweb.SetSingleFetchResult(rmap))
}
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))
}
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))
}
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)
}
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))
}
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))
}
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))
}
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))
}