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