func (p *Login) DupCheck(entity *entity.Login) bool { cbx := cb.CreateLoginCB() cbx.Query().SetDelFlag_Equal(0) cbx.Query().SetLoginId_Equal(entity.GetLoginId()) res, err := bhv.LoginBhv_I.SelectList(cbx, p.tx) if err != nil { panic(err.Error()) } return res.AllRecordCount > 0 }
func (p *Login) Fetch(data map[string]interface{}) { cbx := cb.CreateLoginCB() cbx.Query().SetDelFlag_Equal(0) p.SetupCriteria(cbx, data) cbx.Query().AddOrderBy_LoginId_Asc() res, err := bhv.LoginBhv_I.SelectList(cbx, p.tx) if err != nil { panic(err.Error()) } list := p.ResultToMap(res) p.context.JSON(200, dfweb.SetNormalFetchResult(list)) }
func GetLoginFromSession(session *entity.Session, tx *sql.Tx) *entity.Login { cb := cb.CreateLoginCB() cb.Query().SetId_Equal(session.GetLoginId().Int64) cb.Query().SetDelFlag_Equal(0) res, err := bhv.LoginBhv_I.SelectList(cb, tx) if err != nil { panic("Login Select Error:" + err.Error()) } if res.AllRecordCount != 1 { panic("Login Not Found") } return (res.List.Get(0)).(*entity.Login) }
func (p *Login) getOld(id int64) *entity.Login { cbx := cb.CreateLoginCB() cbx.Query().SetDelFlag_Equal(0) cbx.Query().SetId_Equal(id) res, err := bhv.LoginBhv_I.SelectList(cbx, p.tx) if err != nil { panic(err.Error()) } if res.AllRecordCount == 1 { return res.List.Get(0).(*entity.Login) } else { return nil } }
func (p *Login) getDelFlagMaxValue(entityx *entity.Login) int64 { cb := cb.CreateLoginCB() cb.Query().SetLoginId_Equal(entityx.GetLoginId()) cb.Query().AddOrderBy_DelFlag_Desc() cb.FetchFirst(1) res, err := bhv.LoginBhv_I.SelectList(cb, p.tx) if err != nil { panic(err.Error()) } if res.AllRecordCount == 1 { return (res.List.Get(0)).(*entity.Login).GetDelFlag() } panic("DelFlag Max not found") return 1 }
func (p *Login) getLoginFromLoginId(json map[string]interface{}, tx *sql.Tx) *entity.Login { cb := cb.CreateLoginCB() loginId := json["loginId"] if loginId == nil { return nil } cb.Query().SetLoginId_Equal((loginId).(string)) cb.Query().SetDelFlag_Equal(0) res, err2 := bhv.LoginBhv_I.SelectList(cb, tx) if err2 != nil { panic(err2.Error()) } if res.AllRecordCount == 1 { return (res.List.Get(0)).(*entity.Login) } return nil }