package partial import ( "fmt" "git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys" "git.qianqiusoft.com/qianqiusoft/light-apiengine/models" sysmodel "git.qianqiusoft.com/qianqiusoft/light-apiengine/models" sysutils "git.qianqiusoft.com/qianqiusoft/light-apiengine/utils" "strconv" ) // _Sidebar // @Title _Sidebar // @Description 获取导航菜单 // @Param user string false "用户id" // @Success 200 {object} Account // @Failure 403 :id is empty func System_Sidebar(c *entitys.CtrlContext) { fmt.Println(c.Db.DataSourceName()) paramMap_i_t := map[string]interface{}{"sort": "name"} result, err := sysutils.TreeSearch(c.Db, "system", "sidebar", "sys_menu", 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}) } } // _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) { page, _ := strconv.Atoi(c.Ctx.DefaultQuery("page", "1")) rows, _ := strconv.Atoi(c.Ctx.DefaultQuery("rows", "10")) name := c.Ctx.DefaultQuery("name", "") login_id := c.Ctx.DefaultQuery("login_id", "") paramMap_i_t := map[string]interface{}{"page": page, "rows": rows, "name": name, "login_id": login_id} 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 }