【更新】更新restful

This commit is contained in:
PandaGoAdmin
2022-08-03 17:21:07 +08:00
parent 249ddd80b2
commit 518a3de903
18 changed files with 68 additions and 892 deletions

View File

@@ -17,14 +17,6 @@ type DeptApi struct {
RoleApp services.SysRoleModel
}
// @Summary 获取角色的部门树
// @Description 获取JSON
// @Tags 菜单
// @Param roleId path int false "roleId"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
// @Router /system/menu/menuTreRoleSelect/{roleId} [get]
// @Security X-TOKEN
func (m *DeptApi) GetDeptTreeRoleSelect(rc *restfulx.ReqCtx) {
roleId := restfulx.PathParamInt(rc, "roleId")
var dept entity.SysDept
@@ -43,15 +35,6 @@ func (m *DeptApi) GetDeptTreeRoleSelect(rc *restfulx.ReqCtx) {
}
}
// @Summary 部门列表数据
// @Description 分页列表
// @Tags 部门
// @Param deptName query string false "deptName"
// @Param status query string false "status"
// @Param deptId query int false "deptId"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /system/dept/deptList [get]
// @Security
func (a *DeptApi) GetDeptList(rc *restfulx.ReqCtx) {
//pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
//pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
@@ -69,12 +52,6 @@ func (a *DeptApi) GetDeptList(rc *restfulx.ReqCtx) {
}
}
// @Summary 所有部门列表数据
// @Description 部门列表
// @Tags 部门
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /system/dept/ordinaryDeptLis [get]
// @Security
func (a *DeptApi) GetOrdinaryDeptList(rc *restfulx.ReqCtx) {
var dept entity.SysDept
if !IsTenantAdmin(rc.LoginAccount.TenantId) {
@@ -84,15 +61,6 @@ func (a *DeptApi) GetOrdinaryDeptList(rc *restfulx.ReqCtx) {
rc.ResData = a.DeptApp.FindList(dept)
}
// @Summary 所有部门树数据
// @Description 部门树列表
// @Tags 部门
// @Param deptName query string false "deptName"
// @Param status query string false "status"
// @Param deptId query int false "deptId"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /system/dept/deptTree [get]
// @Security
func (a *DeptApi) GetDeptTree(rc *restfulx.ReqCtx) {
deptName := restfulx.QueryParam(rc, "deptName")
status := restfulx.QueryParam(rc, "status")
@@ -104,28 +72,11 @@ func (a *DeptApi) GetDeptTree(rc *restfulx.ReqCtx) {
rc.ResData = a.DeptApp.SelectDept(dept)
}
// @Summary 部门数据
// @Description 获取JSON
// @Tags 部门
// @Param deptId path string false "deptId"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /system/dept/{deptId} [get]
// @Security
func (a *DeptApi) GetDept(rc *restfulx.ReqCtx) {
deptId := restfulx.PathParamInt(rc, "deptId")
rc.ResData = a.DeptApp.FindOne(int64(deptId))
}
// @Summary 添加部门
// @Description 获取JSON
// @Tags 部门
// @Accept application/json
// @Product application/json
// @Param data body entity.SysDept true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
// @Router /system/dept [post]
// @Security Bearer
func (a *DeptApi) InsertDept(rc *restfulx.ReqCtx) {
var dept entity.SysDept
restfulx.BindQuery(rc, &dept)
@@ -134,16 +85,6 @@ func (a *DeptApi) InsertDept(rc *restfulx.ReqCtx) {
a.DeptApp.Insert(dept)
}
// @Summary 修改部门
// @Description 获取JSON
// @Tags 部门
// @Accept application/json
// @Product application/json
// @Param data body entity.SysDept true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /system/dept [put]
// @Security Bearer
func (a *DeptApi) UpdateDept(rc *restfulx.ReqCtx) {
var dept entity.SysDept
restfulx.BindQuery(rc, &dept)
@@ -152,13 +93,6 @@ func (a *DeptApi) UpdateDept(rc *restfulx.ReqCtx) {
a.DeptApp.Update(dept)
}
// @Summary 删除部门
// @Description 删除数据
// @Tags 部门
// @Param deptId path string true "deptId, 逗号隔开"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /system/dept/{deptId} [delete]
func (a *DeptApi) DeleteDept(rc *restfulx.ReqCtx) {
deptId := restfulx.PathParam(rc, "deptId")
deptIds := utils.IdsStrToIdsIntGroup(deptId)