| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- package partial
- import (
- "git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys"
- sysmodel "git.qianqiusoft.com/qianqiusoft/light-apiengine/models"
- sysutils "git.qianqiusoft.com/qianqiusoft/light-apiengine/utils"
- "git.qianqiusoft.com/qianqiusoft/light-apiengine/models"
- )
- // _GetNavTree
- // @Title _GetNavTree
- // @Description 获取导航菜单
- // @Param user string false "用户id"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_GetNavTree(c *entitys.CtrlContext) {
- user := c.Ctx.Query("user")
- ret := __none_func_system__(user)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _GetMenuTree
- // @Title _GetMenuTree
- // @Description 获取系统菜单
- // @Param user string false "用户id"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_GetMenuTree(c *entitys.CtrlContext) {
- user := c.Ctx.Query("user")
- ret := __none_func_system__(user)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _FindUserPage
- // @Title _FindUserPage
- // @Description 获取用户分页数
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_FindUserPage(c *entitys.CtrlContext) {
-
- var page int64 = c.Ctx.GetInt64("page")
- var rows int64 = c.Ctx.GetInt64("rows")
-
- paramMap_i_t := map[string]interface{}{"page": page, "rows": rows}
- result, err := sysutils.PageSearch(c.Db,"system","find_user_page", "sys_user", paramMap_i_t)
- if err == nil {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", result})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, err.Error(), nil})
- }
- }
- // _GetOrgTree
- // @Title _GetOrgTree
- // @Description 获取组织架构树
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_GetOrgTree(c *entitys.CtrlContext) {
-
-
- paramMap_i_t := map[string]interface{}{"sort": "name"}
- result, err := sysutils.TreeSearch(c.Db, "system","get_org_tree", "sys_org", paramMap_i_t)
-
- if err == nil {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", result})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, err.Error(), nil})
- }
- }
- // _AddUser
- // @Title _AddUser
- // @Description 添加用户
- // @Param login_id string false "登录ID"
- // @Param password string false "密码"
- // @Param org_id string false "组织ID"
- // @Param email string false "邮箱"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_AddUser(c *entitys.CtrlContext) {
- login_id := c.Ctx.Query("login_id")
- password := c.Ctx.Query("password")
- org_id := c.Ctx.Query("org_id")
- email := c.Ctx.Query("email")
- ret := __none_func_system__(login_id,password,org_id,email)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _DelUser
- // @Title _DelUser
- // @Description 删除用户
- // @Param id string false "用户ID"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_DelUser(c *entitys.CtrlContext) {
- id := c.Ctx.Query("id")
- ret := __none_func_system__(id)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _UpdateUser
- // @Title _UpdateUser
- // @Description 修改用户
- // @Param login_id string false "登录ID"
- // @Param password string false "密码"
- // @Param org_id string false "组织ID"
- // @Param email string false "邮箱"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_UpdateUser(c *entitys.CtrlContext) {
- login_id := c.Ctx.Query("login_id")
- password := c.Ctx.Query("password")
- org_id := c.Ctx.Query("org_id")
- email := c.Ctx.Query("email")
- ret := __none_func_system__(login_id,password,org_id,email)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _AddRole
- // @Title _AddRole
- // @Description 添加角色
- // @Param name string false "角色名称"
- // @Param remark string false "备注"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_AddRole(c *entitys.CtrlContext) {
- name := c.Ctx.Query("name")
- remark := c.Ctx.Query("remark")
- ret := __none_func_system__(name,remark)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _DelRole
- // @Title _DelRole
- // @Description 添加角色
- // @Param id string false "角色ID"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_DelRole(c *entitys.CtrlContext) {
- id := c.Ctx.Query("id")
- ret := __none_func_system__(id)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _UpdateRole
- // @Title _UpdateRole
- // @Description 修改角色
- // @Param id string false "角色ID"
- // @Param name string false "角色名称"
- // @Param remark string false "备注"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_UpdateRole(c *entitys.CtrlContext) {
- id := c.Ctx.Query("id")
- name := c.Ctx.Query("name")
- remark := c.Ctx.Query("remark")
- ret := __none_func_system__(id,name,remark)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _FindRolePage
- // @Title _FindRolePage
- // @Description 角色分页
- // @Param page false "分页参数"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_FindRolePage(c *entitys.CtrlContext) {
- var paramObj0 models.GetPageInfo
- c.Ctx.BindJSON(¶mObj0)
- ret := __none_func_system__(paramObj0)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _FindRoleMenu
- // @Title _FindRoleMenu
- // @Description 查找角色权限
- // @Param role_id string false "角色id"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_FindRoleMenu(c *entitys.CtrlContext) {
- role_id := c.Ctx.Query("role_id")
- ret := __none_func_system__(role_id)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _SaveRoleMenu
- // @Title _SaveRoleMenu
- // @Description 保存角色权限
- // @Param role_menu string false "角色权限"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_SaveRoleMenu(c *entitys.CtrlContext) {
- var paramObj0 []models.SaveRoleMenu
- c.Ctx.BindJSON(¶mObj0)
- ret := __none_func_system__(paramObj0)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _RoleAll
- // @Title _RoleAll
- // @Description 查找所有角色
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_RoleAll(c *entitys.CtrlContext) {
-
- ret := __none_func_system__()
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _FindPermissions
- // @Title _FindPermissions
- // @Description 查找用户权限
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_FindPermissions(c *entitys.CtrlContext) {
-
- ret := __none_func_system__()
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _AddMenu
- // @Title _AddMenu
- // @Description 添加菜单
- // @Param string false "菜单"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_AddMenu(c *entitys.CtrlContext) {
- var paramObj0 models.SysMenu
- c.Ctx.BindJSON(¶mObj0)
- ret := __none_func_system__(paramObj0)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _DelMenu
- // @Title _DelMenu
- // @Description 删除菜单
- // @Param id string false "菜单ID"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_DelMenu(c *entitys.CtrlContext) {
- id := c.Ctx.Query("id")
- ret := __none_func_system__(id)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- // _UpdateMenu
- // @Title _UpdateMenu
- // @Description 更新菜单
- // @Param string false "菜单"
- // @Success 200 {object} Account
- // @Failure 403 :id is empty
- func System_UpdateMenu(c *entitys.CtrlContext) {
- var paramObj0 models.SysMenu
- c.Ctx.BindJSON(¶mObj0)
- ret := __none_func_system__(paramObj0)
- if ret {
- c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
- }else{
- c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
- }
- }
- func __none_func_system__(params ... interface{}) bool{
- return true
- }
|