Esempio n. 1
0
func (this *TravelController) List() {
	item := s.Travel
	oItemDef, _ := itemDef.EntityDefMap[item]
	queryParams, limitParams, orderByParams := this.GetParams(oItemDef)
	result, total, resultMaps := svc.List(oItemDef.Name, queryParams, limitParams, orderByParams)
	retList := extendUser2ItemMapList(resultMaps, s.Approver, s.Traveler)
	this.Data["json"] = &TableResult{result, int64(total), retList}
	this.ServeJson()
}
Esempio n. 2
0
func (this *ProductController) List() {
	item := s.Product
	oItemDef, _ := itemDef.EntityDefMap[item]
	queryParams, limitParams, orderByParams := this.GetParams(oItemDef)
	result, total, resultMaps := svc.List(oItemDef.Name, queryParams, limitParams, orderByParams)
	retList := transProductList(oItemDef, resultMaps)
	this.Data["json"] = &TableResult{result, int64(total), retList}
	this.ServeJson()
}
Esempio n. 3
0
func (this *ItemController) ListWithQuery(oItemDef itemDef.ItemDef, addQueryParam t.Params) {
	queryParams, limitParams, orderByParams := this.GetParams(oItemDef)
	for k, v := range addQueryParam {
		queryParams[k] = v
	}
	result, total, resultMaps := svc.List(oItemDef.Name, queryParams, limitParams, orderByParams)
	retList := transList(oItemDef, resultMaps)
	this.Data["json"] = &TableResult{result, int64(total), retList}
	this.ServeJson()
}
Esempio n. 4
0
func (this *ItemController) BaseAutocomplete(item string, keyword string) {
	oItemDef, _ := itemDef.EntityDefMap[item]
	term := this.GetString(s.Term)
	if strings.EqualFold(term, "") {
		this.Data["json"] = "[]"
		this.ServeJson()
		return
	}
	limitParams := t.LimitParams{
		s.Limit: t.LimitDefault,
	}

	orderByParams := t.Params{
		keyword: s.Asc,
	}
	addParams := this.GetFormValues(oItemDef)
	addParams["%"+keyword] = term
	_, _, resultMaps := svc.List(oItemDef.Name, addParams, limitParams, orderByParams)
	retList := TransAutocompleteList(resultMaps, keyword)
	this.Data["json"] = &retList
	this.ServeJson()
}