You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0 KiB

2 years ago
package vivib
import (
"strconv"
"viviman.top/controllers"
"viviman.top/models"
"viviman.top/vo"
)
// LiCaiController 财务记录 API
type LiCaiController struct {
controllers.BaseController
}
func (c *LiCaiController) URLMapping() {
c.Mapping("GetAll", c.GetAll)
2 years ago
c.Mapping("GetOne", c.GetOne)
2 years ago
}
// GetOne @Title获取单个财务记录
// @Description 获取单个财务记录
// @Param id path int true "角色ID"
// @Success 200 {object} models.Role
// @router /:id [get]
func (c *LiCaiController) GetOne() {
id := c.Ctx.Input.Param(":id")
id64, _ := strconv.ParseInt(id, 10, 64)
role := models.GetOneRole(id64)
c.Data["json"] = controllers.SuccessData(role)
_ = c.ServeJSON()
}
// GetAll @Title角色列表
// @Description 角色列表
// @Success 200 {object} controllers.Result
// @router / [get]
func (c *LiCaiController) GetAll() {
total, list := models.GetAllRole(c.GetParams())
c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: list, TotalElements: total})
_ = c.ServeJSON()
}