Esempio n. 1
0
func (p *Employee) GetUserTableSec(id int64) *entity.UserTable {
	cbx := cb.CreateUserTableCB()
	cbx.Query().SetId_Equal(id)
	res, err := bhv.UserTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic("Insert Error:" + err.Error())
	}
	if res.AllRecordCount != 1 {
		return nil
	}
	return (res.List.Get(0)).(*entity.UserTable)
}
func (p *UserTable) Fetch(data map[string]interface{}) {
	cbx := cb.CreateUserTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	p.SetupCriteria(cbx, data)
	cbx.Query().AddOrderBy_TableName_Asc().AddOrderBy_Key1_Asc().AddOrderBy_Key2_Asc()
	res, err := bhv.UserTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	list := p.ResultToMap(res)
	p.context.JSON(200, dfweb.SetNormalFetchResult(list))
}
func (p *UserTable) DupCheck(entityx *entity.UserTable) bool {
	cbx := cb.CreateUserTableCB()
	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.UserTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	return res.AllRecordCount > 0
}
func (p *UserTable) getOld(id int64) *entity.UserTable {
	cbx := cb.CreateUserTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetId_Equal(id)
	res, err := bhv.UserTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	if res.AllRecordCount == 1 {
		return res.List.Get(0).(*entity.UserTable)
	} else {
		return nil
	}
}
func (p *UserTable) getDelFlagMaxValue(entityx *entity.UserTable) int64 {
	cbx := cb.CreateUserTableCB()
	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.UserTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	if res.AllRecordCount == 1 {
		return (res.List.Get(0)).(*entity.UserTable).GetDelFlag()
	}
	panic("DelFlag Max not found")
	return 1
}
Esempio n. 6
0
func (p *Employee) getSecData() {
	cbx := cb.CreateUserTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetTableName_Equal("section")
	cbx.Query().AddOrderBy_Key1_Asc()
	res, err := bhv.UserTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	reslist := new(df.List)
	cmap := make(map[string]interface{})
	cmap["value"] = 0
	cmap["label"] = ""
	reslist.Add(cmap)
	for _, ent := range res.List.GetAsArray() {
		entx := ent.(*entity.UserTable)
		cmap := make(map[string]interface{})
		cmap["value"] = entx.GetId()
		cmap["label"] = entx.GetS1Data().String
		reslist.Add(cmap)
	}
	p.context.JSON(200, dfweb.SetNormalFetchResult(reslist))
}