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.

102 lines
2.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package BaseRolePersonController
import (
"dsBaseWeb/Business/BaseRolePerson/BaseRolePersonService"
"dsBaseWeb/Model"
"dsBaseWeb/Utils/CommonUtil"
"github.com/gin-gonic/gin"
"net/http"
)
//模块的路由配置
func Routers(r *gin.RouterGroup) {
rr := r.Group("/role")
//教育局相关接口
rr.GET("/GetManageAreaInfo", GetManageAreaInfo)
rr.GET("/GetPersonRoleInfo", GetPersonRoleInfo)
return
}
// @Summary 根据人员ID获取所管辖的地区信息
// @Description 根据人员ID获取所管辖的地区信息
// @Tags 角色信息
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Success 200 {object} Model.Res
// @Router /base/role/GetManageAreaInfo [get]
// @X-InterfaceName ["GetBaseRolePerson"]
// @X-RoleLimit ["1","2","3","4","5","6","7"]
// @X-Sort [1]
func GetManageAreaInfo(c *gin.Context) {
//人员ID
personId, err := c.Cookie("person_id")
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "未获取到Cookie中的人员编码",
})
return
}
//操作IP
actionIpAddress := c.ClientIP()
r, err := BaseRolePersonService.GetManageAreaInfo(personId, personId, actionIpAddress)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "调用RPC服务失败",
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: r.Success,
Message: r.Message,
List: CommonUtil.ConvertJsonStringToMapArray(r.List),
Count: r.Count,
})
}
// @Summary 获取人员角色信息
// @Description 获取人员角色信息
// @Tags 角色信息
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Success 200 {object} Model.Res
// @Router /base/role/GetPersonRoleInfo [get]
// @X-InterfaceName ["GetBaseRolePerson"]
// @X-RoleLimit ["1","2","3","4","5","6","7"]
// @X-TableName ["t_base_role_person"]
// @X-ExtendSwaggerField [{"column_name":"person_name","sample_data":"李老师","column_comment":"登录人名称"}]
// @X-RemoveSwaggerField ["id","id_int","identity_id","b_use","last_updated_time","person_id"]
// @X-Sort [2]
func GetPersonRoleInfo(c *gin.Context) {
//人员ID
personId, err := c.Cookie("person_id")
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "未获取到Cookie中的人员编码",
})
return
}
//操作IP
actionIpAddress := c.ClientIP()
r, err := BaseRolePersonService.GetPersonRoleInfo(personId, personId, actionIpAddress)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "调用RPC服务失败",
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: r.Success,
Message: r.Message,
List: CommonUtil.ConvertJsonStringToMapArray(r.List),
Count: r.Count,
})
}