예제 #1
0
func (p *SysTable) Fetch(data map[string]interface{}) {
	cbx := cb.CreateSysTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	p.SetupCriteria(cbx, data)
	cbx.Query().AddOrderBy_TableName_Asc().AddOrderBy_Key1_Asc().AddOrderBy_Key2_Asc()
	res, err := bhv.SysTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	list := p.ResultToMap(res)
	p.context.JSON(200, dfweb.SetNormalFetchResult(list))
}
예제 #2
0
func (p *SysTable) DupCheck(entityx *entity.SysTable) bool {
	cbx := cb.CreateSysTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetTableName_Equal(entityx.GetTableName())
	cbx.Query().SetKey1_Equal(entityx.GetKey1())
	cbx.Query().SetKey2_Equal(entityx.GetKey2())
	res, err := bhv.SysTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	return res.AllRecordCount > 0
}
예제 #3
0
func (p *SysTable) getOld(id int64) *entity.SysTable {
	cbx := cb.CreateSysTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetId_Equal(id)
	res, err := bhv.SysTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	if res.AllRecordCount == 1 {
		return res.List.Get(0).(*entity.SysTable)
	} else {
		return nil
	}
}
예제 #4
0
func (p *SysTable) getDelFlagMaxValue(entityx *entity.SysTable) int64 {
	cbx := cb.CreateSysTableCB()
	cbx.Query().SetTableName_Equal(entityx.GetTableName())
	cbx.Query().SetKey1_Equal(entityx.GetKey1())
	cbx.Query().SetKey2_Equal(entityx.GetKey2())
	cbx.Query().AddOrderBy_DelFlag_Desc()
	cbx.FetchFirst(1)
	res, err := bhv.SysTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	if res.AllRecordCount == 1 {
		return (res.List.Get(0)).(*entity.SysTable).GetDelFlag()
	}
	panic("DelFlag Max not found")
	return 1
}
예제 #5
0
func (p *SysTable) GetDbs() {
	cbx := cb.CreateSysTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetTableName_Equal("DbName")
	cbx.Query().AddOrderBy_Key1_Asc()
	res, err := bhv.SysTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	reslist := new(df.List)
	for _, ent := range res.List.GetAsArray() {
		entx := ent.(*entity.SysTable)
		cmap := make(map[string]string)
		cmap["value"] = entx.GetKey1()
		cmap["label"] = entx.GetKey1()
		reslist.Add(cmap)
	}
	p.context.JSON(200, dfweb.SetNormalFetchResult(reslist))
}