Пример #1
0
func (p *TestTable) DupCheck(entityx *entity.TestTable) bool {
	cbx := cb.CreateTestTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	//Unique SetXXX
	cbx.Query().SetTestId_Equal(entityx.GetTestId())
	res, err := bhv.TestTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	return res.AllRecordCount > 0
}
Пример #2
0
func (p *TestTable) Fetch(data map[string]interface{}) {
	cbx := cb.CreateTestTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	p.SetupCriteria(cbx, data)
	//add Order By
	cbx.Query().AddOrderBy_TestId_Asc()
	res, err := bhv.TestTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	list := p.ResultToMap(res)
	p.context.JSON(200, dfweb.SetNormalFetchResult(list))
}
Пример #3
0
func (p *TestTable) getOld(id int64) *entity.TestTable {
	cbx := cb.CreateTestTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetId_Equal(id)
	res, err := bhv.TestTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	if res.AllRecordCount == 1 {
		return res.List.Get(0).(*entity.TestTable)
	} else {
		return nil
	}
}
Пример #4
0
func (p *TestTable) getDelFlagMaxValue(entityx *entity.TestTable) int64 {
	cbx := cb.CreateTestTableCB()
	//Unique SetXXX
	cbx.Query().SetTestId_Equal(entityx.GetTestId())
	cbx.Query().AddOrderBy_DelFlag_Desc()
	cbx.FetchFirst(1)
	res, err := bhv.TestTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	if res.AllRecordCount == 1 {
		return (res.List.Get(0)).(*entity.TestTable).GetDelFlag()
	}
	panic("DelFlag Max not found")
	return 1
}