|
@@ -7,9 +7,9 @@ import (
|
|
|
"strings"
|
|
"strings"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
- "git.qianqiusoft.com/qianqiusoft/light-apiengine/models"
|
|
|
|
|
-
|
|
|
|
|
|
|
+ "git.qianqiusoft.com/qianqiusoft/light-apiengine/db"
|
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys"
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys"
|
|
|
|
|
+ "git.qianqiusoft.com/qianqiusoft/light-apiengine/models"
|
|
|
sysmodel "git.qianqiusoft.com/qianqiusoft/light-apiengine/models"
|
|
sysmodel "git.qianqiusoft.com/qianqiusoft/light-apiengine/models"
|
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/utils"
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/utils"
|
|
|
)
|
|
)
|
|
@@ -98,9 +98,9 @@ func System_GetNavTree(c *entitys.CtrlContext) {
|
|
|
user_id := c.Ctx.GetString("user_id")
|
|
user_id := c.Ctx.GetString("user_id")
|
|
|
|
|
|
|
|
var menus []sysmodel.SysMenuTree
|
|
var menus []sysmodel.SysMenuTree
|
|
|
- if user_id == "187c50a4-caad-4557-80c8-aca81af9f370"{
|
|
|
|
|
|
|
+ if user_id == "187c50a4-caad-4557-80c8-aca81af9f370" {
|
|
|
c.Db.SQL(sysmodel.Selectall_nav_tree_admin).Find(&menus)
|
|
c.Db.SQL(sysmodel.Selectall_nav_tree_admin).Find(&menus)
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
c.Db.SQL(sysmodel.Selectall_nav_tree, user_id).Find(&menus)
|
|
c.Db.SQL(sysmodel.Selectall_nav_tree, user_id).Find(&menus)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -289,9 +289,9 @@ func System_AddUser(c *entitys.CtrlContext) {
|
|
|
|
|
|
|
|
var user sysmodel.SysUser
|
|
var user sysmodel.SysUser
|
|
|
err := c.Ctx.ShouldBindJSON(&user)
|
|
err := c.Ctx.ShouldBindJSON(&user)
|
|
|
- if err != nil{
|
|
|
|
|
|
|
+ if err != nil {
|
|
|
c.Ctx.JSON(500, sysmodel.SysReturn{200, "c.Ctx.ShouldBindJSON error " + err.Error(), nil})
|
|
c.Ctx.JSON(500, sysmodel.SysReturn{200, "c.Ctx.ShouldBindJSON error " + err.Error(), nil})
|
|
|
- return;
|
|
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(user.LoginId, "-----add user-----", user.Password, " --- ", user.OrgId)
|
|
fmt.Println(user.LoginId, "-----add user-----", user.Password, " --- ", user.OrgId)
|
|
@@ -396,9 +396,9 @@ func System_UpdateUser(c *entitys.CtrlContext) {
|
|
|
|
|
|
|
|
var userInfo sysmodel.UserInfo
|
|
var userInfo sysmodel.UserInfo
|
|
|
err := c.Ctx.BindJSON(&userInfo)
|
|
err := c.Ctx.BindJSON(&userInfo)
|
|
|
- if err != nil{
|
|
|
|
|
|
|
+ if err != nil {
|
|
|
c.Ctx.JSON(500, sysmodel.SysReturn{500, err.Error(), nil})
|
|
c.Ctx.JSON(500, sysmodel.SysReturn{500, err.Error(), nil})
|
|
|
- return;
|
|
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
session := c.Db.NewSession()
|
|
session := c.Db.NewSession()
|
|
@@ -433,7 +433,7 @@ func System_UpdateUser(c *entitys.CtrlContext) {
|
|
|
userRole.CreateTime = time.Now()
|
|
userRole.CreateTime = time.Now()
|
|
|
userRole.LastUpdateDate = time.Now()
|
|
userRole.LastUpdateDate = time.Now()
|
|
|
userRole.DelFlag = 0
|
|
userRole.DelFlag = 0
|
|
|
- userRoles = append(userRoles,userRole)
|
|
|
|
|
|
|
+ userRoles = append(userRoles, userRole)
|
|
|
}
|
|
}
|
|
|
_, err = c.Db.Insert(userRoles)
|
|
_, err = c.Db.Insert(userRoles)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -812,7 +812,7 @@ func System_UpdateMenu(c *entitys.CtrlContext) {
|
|
|
// @Success 200 {object} models.Account
|
|
// @Success 200 {object} models.Account
|
|
|
// @Failure 403 :id is empty
|
|
// @Failure 403 :id is empty
|
|
|
func System_AddOrg(c *entitys.CtrlContext) {
|
|
func System_AddOrg(c *entitys.CtrlContext) {
|
|
|
- var sysorg models.SysOrg
|
|
|
|
|
|
|
+ var sysorg models.SysOrganization
|
|
|
c.Ctx.BindJSON(&sysorg)
|
|
c.Ctx.BindJSON(&sysorg)
|
|
|
|
|
|
|
|
user_id := c.Ctx.GetString("user_id")
|
|
user_id := c.Ctx.GetString("user_id")
|
|
@@ -857,7 +857,7 @@ func System_DelOrg(c *entitys.CtrlContext) {
|
|
|
ids = append(ids, param.Id)
|
|
ids = append(ids, param.Id)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- _, err := c.Db.Table(new(models.SysOrg)).In("id", ids).Update(map[string]interface{}{"del_flag": 0})
|
|
|
|
|
|
|
+ _, err := c.Db.Table(new(models.SysOrganization)).In("id", ids).Update(map[string]interface{}{"del_flag": 0})
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.Ctx.JSON(200, sysmodel.SysReturn{500, err.Error(), nil})
|
|
c.Ctx.JSON(200, sysmodel.SysReturn{500, err.Error(), nil})
|
|
|
return
|
|
return
|
|
@@ -878,7 +878,7 @@ func System_DelOrg(c *entitys.CtrlContext) {
|
|
|
// @Success 200 {object} models.Account
|
|
// @Success 200 {object} models.Account
|
|
|
// @Failure 403 :id is empty
|
|
// @Failure 403 :id is empty
|
|
|
func System_UpdateOrg(c *entitys.CtrlContext) {
|
|
func System_UpdateOrg(c *entitys.CtrlContext) {
|
|
|
- var sysorg models.SysOrg
|
|
|
|
|
|
|
+ var sysorg models.SysOrganization
|
|
|
c.Ctx.BindJSON(&sysorg)
|
|
c.Ctx.BindJSON(&sysorg)
|
|
|
|
|
|
|
|
user_id := c.Ctx.GetString("user_id")
|
|
user_id := c.Ctx.GetString("user_id")
|
|
@@ -915,8 +915,8 @@ func System_GetOrg(c *entitys.CtrlContext) {
|
|
|
c.Ctx.BindJSON(¶m)
|
|
c.Ctx.BindJSON(¶m)
|
|
|
fmt.Println(param, "-----------")
|
|
fmt.Println(param, "-----------")
|
|
|
|
|
|
|
|
- org := models.SysOrg{}
|
|
|
|
|
- err := c.Db.Table(new(sysmodel.SysOrg)).ID(param.Id).Find(&org)
|
|
|
|
|
|
|
+ org := models.SysOrganization{}
|
|
|
|
|
+ err := c.Db.Table(new(sysmodel.SysOrganization)).ID(param.Id).Find(&org)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.Ctx.JSON(200, sysmodel.SysReturn{500, err.Error(), nil})
|
|
c.Ctx.JSON(200, sysmodel.SysReturn{500, err.Error(), nil})
|
|
|
return
|
|
return
|
|
@@ -943,7 +943,7 @@ func System_PageOrg(c *entitys.CtrlContext) {
|
|
|
ret := __none_func_system__(getpageinfo)
|
|
ret := __none_func_system__(getpageinfo)
|
|
|
|
|
|
|
|
page := sysmodel.PageResult{}
|
|
page := sysmodel.PageResult{}
|
|
|
- var orgs []sysmodel.SysOrg
|
|
|
|
|
|
|
+ var orgs []sysmodel.SysOrganization
|
|
|
dbSession := c.Db.Table("sys_org")
|
|
dbSession := c.Db.Table("sys_org")
|
|
|
dbSession = dbSession.Select("sys_org.*")
|
|
dbSession = dbSession.Select("sys_org.*")
|
|
|
|
|
|
|
@@ -999,6 +999,54 @@ func System_PageOrg(c *entitys.CtrlContext) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func System_TreeList(c *entitys.CtrlContext) {
|
|
|
|
|
+ tbName := c.Ctx.Query("tb_name")
|
|
|
|
|
+ parentFiled := c.Ctx.Query("parent_filed")
|
|
|
|
|
+ if parentFiled == "" {
|
|
|
|
|
+ parentFiled = c.Ctx.Query("parent_field")
|
|
|
|
|
+ }
|
|
|
|
|
+ parentValue := c.Ctx.Query("parent_value")
|
|
|
|
|
+ textFiled := c.Ctx.Query("text_filed")
|
|
|
|
|
+ if textFiled == "" {
|
|
|
|
|
+ textFiled = c.Ctx.Query("text_field")
|
|
|
|
|
+ if textFiled == "" {
|
|
|
|
|
+ textFiled = c.Ctx.Query("name_field")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ valueFiled := c.Ctx.Query("value_filed")
|
|
|
|
|
+ if valueFiled == "" {
|
|
|
|
|
+ valueFiled = c.Ctx.Query("value_field")
|
|
|
|
|
+ if valueFiled == "" {
|
|
|
|
|
+ valueFiled = c.Ctx.Query("id_field")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ domainchk := c.Ctx.Query("domainchk")
|
|
|
|
|
+ if domainchk == "" {
|
|
|
|
|
+ domainchk = "1" // 默认需要domain过滤
|
|
|
|
|
+ }
|
|
|
|
|
+ cntparent := c.Ctx.Query("cnt_parent")
|
|
|
|
|
+ if cntparent == "" {
|
|
|
|
|
+ cntparent = "0"
|
|
|
|
|
+ }
|
|
|
|
|
+ filter := c.Ctx.Query("filters")
|
|
|
|
|
+ if filter == "" {
|
|
|
|
|
+ filter = c.Ctx.Query("filter")
|
|
|
|
|
+ }
|
|
|
|
|
+ sord := c.Ctx.Query("sord")
|
|
|
|
|
+
|
|
|
|
|
+ user, exists := c.Ctx.Get("token")
|
|
|
|
|
+ if !exists {
|
|
|
|
|
+ c.Ctx.JSON(200, sysmodel.SysReturn{500, "token is not exists", nil})
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ nodes, err := sysdb.TreeList(c, user.(*entitys.Token), tbName, parentFiled, parentValue, textFiled, valueFiled, cntparent, domainchk, filter, sord)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nodes})
|
|
|
|
|
+ } else {
|
|
|
|
|
+ c.Ctx.JSON(200, sysmodel.SysReturn{500, "", nil})
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func __none_func_system__(params ...interface{}) bool {
|
|
func __none_func_system__(params ...interface{}) bool {
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|