package models

import "github.com/beego/beego/v2/client/orm"

type ApiUriTest struct {
	ApiUri         string
	ParentUri      string
	Method         string
	Description    string
	MenuId         string
	ParentMenu     string // 一级菜单
	ChildMenu      string // 二级菜单
	ButtonName     string // 按钮名称
	Id             int    `orm:"column(id);pk"`
	IsPublic       int    // 是否公共api，0否，1是
	ChildChildMenu string // 三级菜单
}

func GetApiUriTest() (items []*ApiUriTest, err error) {
	o := orm.NewOrmUsingDB("weekly")
	sql := ` SELECT * FROM api_uri_test `
	_,err = o.Raw(sql).QueryRows(&items)
	return
}

func UpdateApiUriTest(api string, menuId int) (err error) {
	o := orm.NewOrm()
	sql := ` UPDATE sys_menu SET api = ? where menu_id = ?`
	_, err = o.Raw(sql, api, menuId).Exec()
	return
}