Esempio n. 1
0
func (p *Employee) DupCheck(entityx *entity.Employee) bool {
	cbx := cb.CreateEmployeeCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetEmpCd_Equal(entityx.GetEmpCd())
	res, err := bhv.EmployeeBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	return res.AllRecordCount >= 0
}
Esempio n. 2
0
func (p *Employee) Fetch(data map[string]interface{}) {
	cbx := cb.CreateEmployeeCB()
	cbx.SetupSelect_UserTable()
	cbx.Query().SetDelFlag_Equal(0)
	p.SetupCriteria(cbx, data)
	//add Order By
	res, err := bhv.EmployeeBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	list := p.ResultToMap(res)
	p.context.JSON(200, dfweb.SetNormalFetchResult(list))
}
Esempio n. 3
0
func (p *Employee) getOld(id int64) *entity.Employee {
	cbx := cb.CreateEmployeeCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetId_Equal(id)
	res, err := bhv.EmployeeBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	if res.AllRecordCount == 1 {
		return res.List.Get(0).(*entity.Employee)
	} else {
		return nil
	}
}
Esempio n. 4
0
func (p *Employee) getDelFlagMaxValue(entityx *entity.Employee) int64 {
	cbx := cb.CreateEmployeeCB()
	cbx.Query().SetEmpCd_Equal(entityx.GetEmpCd())
	cbx.Query().AddOrderBy_DelFlag_Desc()
	cbx.FetchFirst(1)
	res, err := bhv.EmployeeBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	if res.AllRecordCount == 1 {
		return (res.List.Get(0)).(*entity.Employee).GetDelFlag()
	}
	panic("DelFlag Max not found")
	return 1
}