houyaf hace 3 años
padre
commit
d21b8de6d4

+ 0 - 2
datamodels/account.go

@@ -2,7 +2,6 @@ package datamodels
 
 import "time"
 
-// Account Data Model
 type Account struct {
 	OcId            int64       `json:"ocId"             xorm:"'oc_id'             bigint         comment('组织ID:公司或机构或单位ID')"`
 	AccountId       int64       `json:"accountId"        xorm:"'account_id'        bigint not null pk comment('主键ID')"`
@@ -30,7 +29,6 @@ type Account struct {
 	DeletedAt       time.Time   `json:"deletedAt"        xorm:"'deleted_at'"`
 }
 
-// TableName table name
 func (t *Account) TableName() string {
 	return "account"
 }

+ 17 - 19
datamodels/app_permit.go

@@ -2,28 +2,26 @@ package datamodels
 
 import "time"
 
-// AppPermit Data Model
 type AppPermit struct {
-	AppId       int64     `json:"appId"           form:"appId"           xorm:"'app_id'            bigint     pk comment('APP ID')"`
-	RoleId      int64     `json:"roleId"          form:"roleId"          xorm:"'role_id'           bigint     pk comment('Role ID')"`
-	PermitId    int64     `json:"permitId"        form:"permitId"        xorm:"'permit_id'         bigint     pk comment('Permit ID')  "`
-	PermitTitle string    `json:"permitTitle"     form:"permitTitle"     xorm:"'permit_title'      varchar(127)  comment('标题')      "`
-	PermitCode  string    `json:"permitCode"      form:"permitCode"      xorm:"'permit_code'       varchar(127)  comment('CODE')     "`
-	PermitDesc  string    `json:"permitDesc"      form:"permitDesc"      xorm:"'permit_desc'       varchar(511)  comment('描述')      "`
-	PermitType  int64     `json:"permitType"      form:"permitType"      xorm:"'permit_type'       int           comment('Type') "`
-	RootId      int64     `json:"rootId"          form:"rootId"          xorm:"'root_id'           int           comment('Root Id') "`
-	ParentId    int64     `json:"parentId"        form:"parentId"        xorm:"'parent_id'         int           comment('Parent Id') "`
-	SortNo      int64     `json:"sortNo"          form:"sortNo"          xorm:"'sort_no'           int           comment('Sort No') "`
-	CreatedBy   int64     `json:"createdBy"       form:"-"               xorm:"'created_by'"`
-	CreatedAt   time.Time `json:"createdAt"       form:"-"               xorm:"'created_at'"`
-	UpdatedBy   int64     `json:"updatedBy"       form:"-"               xorm:"'updated_by'"`
-	UpdatedAt   time.Time `json:"updatedAt"       form:"-"               xorm:"'updated_at'"`
-	DeletedFlag int64     `json:"deletedFlag"     form:"-"               xorm:"'deleted_flag'"`
-	DeletedBy   int64     `json:"deletedBy"       form:"-"               xorm:"'deleted_by'"`
-	DeletedAt   time.Time `json:"deletedAt"       form:"-"               xorm:"'deleted_at'"`
+	AppId       int64     `json:"appId"           xorm:"'app_id'            bigint     pk comment('APP ID')"`
+	RoleId      int64     `json:"roleId"          xorm:"'role_id'           bigint     pk comment('Role ID')"`
+	PermitId    int64     `json:"permitId"        xorm:"'permit_id'         bigint     pk comment('Permit ID')  "`
+	PermitTitle string    `json:"permitTitle"     xorm:"'permit_title'      varchar(127)  comment('标题')      "`
+	PermitCode  string    `json:"permitCode"      xorm:"'permit_code'       varchar(127)  comment('CODE')     "`
+	PermitDesc  string    `json:"permitDesc"      xorm:"'permit_desc'       varchar(511)  comment('描述')      "`
+	PermitType  int64     `json:"permitType"      xorm:"'permit_type'       int           comment('Type') "`
+	RootId      int64     `json:"rootId"          xorm:"'root_id'           int           comment('Root Id') "`
+	ParentId    int64     `json:"parentId"        xorm:"'parent_id'         int           comment('Parent Id') "`
+	SortNo      int64     `json:"sortNo"          xorm:"'sort_no'           int           comment('Sort No') "`
+	CreatedBy   int64     `json:"createdBy"       xorm:"'created_by'"`
+	CreatedAt   time.Time `json:"createdAt"       xorm:"'created_at'"`
+	UpdatedBy   int64     `json:"updatedBy"       xorm:"'updated_by'"`
+	UpdatedAt   time.Time `json:"updatedAt"       xorm:"'updated_at'"`
+	DeletedFlag int64     `json:"deletedFlag"     xorm:"'deleted_flag'"`
+	DeletedBy   int64     `json:"deletedBy"       xorm:"'deleted_by'"`
+	DeletedAt   time.Time `json:"deletedAt"       xorm:"'deleted_at'"`
 }
 
-// TableName
 func (t *AppPermit) TableName() string {
 	return "app_permit"
 }

+ 28 - 0
datamodels/art.go

@@ -0,0 +1,28 @@
+package datamodels
+
+import "time"
+
+type Art struct {
+    OcId        int64     `json:"ocId"         xorm:"'oc_id'         bigint     pk  comment('OC ID')    "`
+    ArtId       int64     `json:"artId"        xorm:"'art_id'        bigint     pk  comment('ArtId')    "`
+    ArtCatId    int64     `json:"artCatId"     xorm:"'art_cat_id'    bigint     pk  comment('ArtCatId') "`
+    ArtTitle    string    `json:"artTitle"     xorm:"'art_title'     varchar(127)   comment('ArtTitle') "`
+    ArtContent  string    `json:"artContent"   xorm:"'art_content'   varchar(127)   comment('Content')  "`
+    ArtAuthor   string    `json:"artAuthor"    xorm:"'art_author'    varchar(127)   comment('Content')  "`
+
+    Status      int64     `json:"status"       xorm:"'status'        bigint         comment('Status')    "`
+    EditorId    int64     `json:"editorId"     xorm:"'editor_id'     bigint         comment('EditorId')  "`
+    IssuedAt    time.Time `json:"issuedAt"     xorm:"'issued_at'     datetime       comment('Datetime')  "`
+    IsFixed     int64     `json:"isFixed"      xorm:"'is_fixed'      bigint         comment('是否可修改')  "`
+    CreatedBy   int64     `json:"createdBy"    xorm:"'created_by'"`
+    CreatedAt   time.Time `json:"createdAt"    xorm:"'created_at'"`
+    UpdatedBy   int64     `json:"updatedBy"    xorm:"'updated_by'"`
+    UpdatedAt   time.Time `json:"updatedAt"    xorm:"'updated_at'"`
+    DeletedFlag int64     `json:"deletedFlag"  xorm:"'deleted_flag'"`
+    DeletedBy   int64     `json:"deletedBy"    xorm:"'deleted_by'"`
+    DeletedAt   time.Time `json:"deletedAt"    xorm:"'deleted_at'"`
+}
+
+func (t *Art) TableName() string {
+    return "art"
+}

+ 29 - 0
datamodels/art_cat.go

@@ -0,0 +1,29 @@
+package datamodels
+
+import "time"
+
+type ArtCat struct {
+    ArtCatId      int64     `json:"artCatId"        xorm:"'art_cat_id'      bigint        pk  comment('主键ID')       "`
+    ArtCatTitle   string    `json:"artCatTitle"     xorm:"'art_cat_title'   varchar(50)       comment('群组类型名称')  "`
+    ArtCatDesc    string    `json:"artCatDesc"      xorm:"'art_cat_desc'    varchar(50)       comment('描述')         "`
+    
+    RootId        int64     `json:"rootId"          xorm:"'root_id'         bigint not null   comment('Order')      " `
+    ParentId      int64     `json:"parentId"        xorm:"'parent_id'       bigint not null   comment('父群组ID')    " `
+    NodeLeft      int64     `json:"nodeLeft"        xorm:"'node_left'       bigint not null   comment('群组LEFT')    " `
+    NodeRight     int64     `json:"nodeRight"       xorm:"'node_right'      bigint not null   comment('群组RIGHT')   " `
+    NodeLevel     int64     `json:"nodeLevel"       xorm:"'node_level'      bigint not null   comment('群组LEVEL')   " `
+    IsLeaf        int64     `json:"isLeaf"          xorm:"'is_leaf'         bigint not null   comment('LEAF群组')    " `
+    IsFixed       int64     `json:"isFixed"         xorm:"'is_fixed'        bigint not null   comment('群组STATUS')  " `
+    
+    CreatedBy     int64     `json:"createdBy"       xorm:"'created_by'"`
+    CreatedAt     time.Time `json:"createdAt"       xorm:"'created_at'"`
+    UpdatedBy     int64     `json:"updatedBy"       xorm:"'updated_by'"`
+    UpdatedAt     time.Time `json:"updatedAt"       xorm:"'updated_at'"`
+    DeletedFlag   int64     `json:"deletedFlag"     xorm:"'deleted_flag'"`
+    DeletedBy     int64     `json:"deletedBy"       xorm:"'deleted_by'"`
+    DeletedAt     time.Time `json:"deletedAt"       xorm:"'deleted_at'"`
+}
+
+func (t *ArtCat) TableName() string {
+    return "art_cat"
+}

+ 23 - 0
datamodels/db_type.go

@@ -0,0 +1,23 @@
+package datamodels
+
+import "time"
+
+type DBType struct {
+    DbTypeId     int64     `json:"dbTypeId"         xorm:"'db_type_id'        bigint     pk comment('主键ID')      "`
+    DbTypeTitle  string    `json:"dbTypeTitle"      xorm:"'db-type_title'     varchar(50)   comment('模型名称')     "`
+    GetTables    string    `json:"getTables"        xorm:"'get_tables'        varchar(255)   comment('描述')        "`
+    GetTableDef  string    `json:"getTableDef"      xorm:"'get_table_def'     varchar(255)   comment('描述')        "`
+    DbTypeDesc   string    `json:"dbTypeDesc"       xorm:"'db-type_desc'      varchar(255)   comment('模型名称')     "`
+    CreatedBy    int64     `json:"createdBy"       xorm:"'created_by'"`
+    CreatedAt    time.Time `json:"createdAt"       xorm:"'created_at'"`
+    UpdatedBy    int64     `json:"updatedBy"       xorm:"'updated_by'"`
+    UpdatedAt    time.Time `json:"updatedAt"       xorm:"'updated_at'"`
+    DeletedFlag  int64     `json:"deletedFlag"     xorm:"'deleted_flag'"`
+    DeletedBy    int64     `json:"deletedBy"       xorm:"'deleted_by'"`
+    DeletedAt    time.Time `json:"deletedAt"       xorm:"'deleted_at'"`
+}
+
+func (t *DBType) TableName() string {
+    return "ds_db_type"
+}
+

+ 0 - 2
datamodels/ent.go

@@ -21,11 +21,9 @@ type Ent struct {
     EntJyfw             string      `json:"entJyfw"     xorm:"'ent_jyfw'          varchar(255)  comment('经营范围')"`
     EntQywzjd           string      `json:"entQywzjd"   xorm:"'ent_qywzjd'        decimal(9,6)  comment('企业位置经度')"`
     EntQywzwd           string      `json:"entQywzwd"   xorm:"'ent_qywzwd'        decimal(9,6)  comment('企业位置纬度')"`
-    
     EntScjydz           string      `json:"entScjydz"   xorm:"'ent_scjydz'        varchar(255)  comment('生产/经营地址')"`
     EntGmqk             int         `json:"entGmqk"     xorm:"'ent_gmqk'          int           comment('规模情况')"`
     EntQygm             int         `json:"entQygm"     xorm:"'ent_qygm'          int           comment('企业规模')"`
-    
     CreatedBy           int64       `json:"createdBy"   xorm:"'created_by'"`
     CreatedAt           time.Time   `json:"createdAt"   xorm:"'created_at'"`
     UpdatedBy           int64       `json:"updatedBy"   xorm:"'updated_by'"`

+ 23 - 24
datamodels/group.go

@@ -4,36 +4,35 @@ import "time"
 
 // Group Account Data Model
 type Group struct {
-	OcId             int64   `json:"ocId"            xorm:"'oc_id'               bigint not null pk     comment('公司组织ID')  " `
-	GroupId          int64   `json:"groupId"         xorm:"'group_id'            bigint not null pk     comment('群组ID')      " `
-	GroupName        string  `json:"groupName"       xorm:"'group_name'          varchar(127) not null  comment('群组名称')    " `
-	GroupCatId       int64   `json:"groupCatId"      xorm:"'group_cat_id'        bigint not null        comment('群组类型ID')  " `
-	GroupCatTitle    string  `json:"groupCatTitle"   xorm:"'group_cat_title'     varchar(127) not null  comment('群组类型名称') " `
+	OcId             int64     `json:"ocId"            xorm:"'oc_id'               bigint not null pk     comment('公司组织ID')  " `
+	GroupId          int64     `json:"groupId"         xorm:"'group_id'            bigint not null pk     comment('群组ID')      " `
+	GroupName        string    `json:"groupName"       xorm:"'group_name'          varchar(127) not null  comment('群组名称')    " `
+	GroupCatId       int64     `json:"groupCatId"      xorm:"'group_cat_id'        bigint not null        comment('群组类型ID')  " `
+	GroupCatTitle    string    `json:"groupCatTitle"   xorm:"'group_cat_title'     varchar(127) not null  comment('群组类型名称') " `
 	
-	GroupPath        string  `json:"groupPath"       xorm:"'group_path'          varchar(255) not null  comment('群组PATH')    " `
-	GroupDesc        string  `json:"groupDesc"       xorm:"'group_desc'          varchar(255) not null  comment('群组DESC')    " `
-	GroupCode        string  `json:"groupCode"       xorm:"'group_code'          varchar(127) not null  comment('群组CODE')    " `
-	GroupSelect      string  `json:"groupSelect"     xorm:"'group_select'        varchar(255) not null  comment('群组PATH')    " `
+	GroupPath        string    `json:"groupPath"       xorm:"'group_path'          varchar(255) not null  comment('群组PATH')    " `
+	GroupDesc        string    `json:"groupDesc"       xorm:"'group_desc'          varchar(255) not null  comment('群组DESC')    " `
+	GroupCode        string    `json:"groupCode"       xorm:"'group_code'          varchar(127) not null  comment('群组CODE')    " `
+	GroupSelect      string    `json:"groupSelect"     xorm:"'group_select'        varchar(255) not null  comment('群组PATH')    " `
 	
-	RootId           int64   `json:"rootId"          xorm:"'root_id'             bigint not null        comment('Order')       " `
-	ParentId         int64   `json:"parentId"        xorm:"'parent_id'           bigint not null        comment('父群组ID')      " `
-	NodeLeft         int64   `json:"nodeLeft"        xorm:"'node_left'           bigint not null        comment('群组LEFT')    " `
-	NodeRight        int64   `json:"nodeRight"       xorm:"'node_right'          bigint not null        comment('群组RIGHT')   " `
-	NodeLevel        int64   `json:"nodeLevel"       xorm:"'node_level'          bigint not null        comment('群组LEVEL')   " `
+	RootId           int64     `json:"rootId"          xorm:"'root_id'             bigint not null        comment('Order')       " `
+	ParentId         int64     `json:"parentId"        xorm:"'parent_id'           bigint not null        comment('父群组ID')      " `
+	NodeLeft         int64     `json:"nodeLeft"        xorm:"'node_left'           bigint not null        comment('群组LEFT')    " `
+	NodeRight        int64     `json:"nodeRight"       xorm:"'node_right'          bigint not null        comment('群组RIGHT')   " `
+	NodeLevel        int64     `json:"nodeLevel"       xorm:"'node_level'          bigint not null        comment('群组LEVEL')   " `
 	
-	IsLeaf           int64   `json:"isLeaf"          xorm:"'is_leaf'             bigint not null        comment('LEAF群组')    " `
-	IsFixed          int64   `json:"isFixed"         xorm:"'is_fixed'            bigint not null        comment('群组STATUS')  " `
+	IsLeaf           int64     `json:"isLeaf"          xorm:"'is_leaf'             bigint not null        comment('LEAF群组')    " `
+	IsFixed          int64     `json:"isFixed"         xorm:"'is_fixed'            bigint not null        comment('群组STATUS')  " `
 
-	CreatedBy   int64     `json:"createdBy"      xorm:"'created_by'  " `
-	CreatedAt   time.Time `json:"createdAt"      xorm:"'created_at'  " `
-	UpdatedBy   int64     `json:"updatedBy"      xorm:"'updated_by'  " `
-	UpdatedAt   time.Time `json:"updatedAt"      xorm:"'updated_at'  " `
-	DeletedFlag int64     `json:"deletedFlag"    xorm:"'deleted_flag'" `
-	DeletedBy   int64     `json:"deletedBy"      xorm:"'deleted_by'  " `
-	DeletedAt   time.Time `json:"deletedAt"      xorm:"'deleted_at'  " `
+	CreatedBy        int64     `json:"createdBy"       xorm:"'created_by'  " `
+	CreatedAt        time.Time `json:"createdAt"       xorm:"'created_at'  " `
+	UpdatedBy        int64     `json:"updatedBy"       xorm:"'updated_by'  " `
+	UpdatedAt        time.Time `json:"updatedAt"       xorm:"'updated_at'  " `
+	DeletedFlag      int64     `json:"deletedFlag"     xorm:"'deleted_flag'" `
+	DeletedBy        int64     `json:"deletedBy"       xorm:"'deleted_by'  " `
+	DeletedAt        time.Time `json:"deletedAt"       xorm:"'deleted_at'  " `
 }
 
-// TableName table name
 func (t *Group) TableName() string {
 	return "s_group"
 }

+ 7 - 7
web/controllers/app_permit_controller.go

@@ -12,18 +12,19 @@ type AppPermitController struct {
 }
 
 func (c *AppPermitController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("GET",     "/{appId:int64}/{roleId:int64}",                    "GetList"   )
+	b.Handle("GET",     "",                                                 "GetList"   )
 	b.Handle("GET",     "/{appId:int64}/{roleId:int64}/{permitId:int64}",   "GetById"   )
 	b.Handle("POST",    "/add",                                             "Create"    )
 	b.Handle("PUT",     "/update",                                          "Update"    )
 	b.Handle("DELETE",  "/{appId:int64}/{roleId:int64}/{permitId:int64}",   "DeleteByID")
 }
 
-func (c *AppPermitController) GetList(appId, roleId int64) *JsonResult {
+func (c *AppPermitController) GetList() *JsonResult {
 	params := c.buildParams()
-	params["appId"]  = appId
+	appId  := c.Ctx.URLParamInt64Default("appId", 0)
+	params["appId"] = appId
+	roleId  := c.Ctx.URLParamInt64Default("roleId", 0)
 	params["roleId"] = roleId
-
 	data, err := c.Service.GetList(params)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -50,7 +51,6 @@ func (c *AppPermitController) Create() *JsonResult {
 		return ResultErr("读取数据失败", nil)
 	}
 	
-	
 	if err := c.Service.Create(&appPermit); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {
@@ -64,8 +64,8 @@ func (c *AppPermitController) Update() *JsonResult {
 	if err := c.Ctx.ReadJSON(&appPermit); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
-	appPermit.UpdatedBy = userId
 	
+	appPermit.UpdatedBy = userId
 	if err := c.Service.Update(&appPermit); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {
@@ -75,12 +75,12 @@ func (c *AppPermitController) Update() *JsonResult {
 
 func (c *AppPermitController) DeleteByID(appId, roleId, permitId int64) *JsonResult {
 	userId := c.GetCurUserId()
+	
 	m := make(map[string]interface{})
 	m["appId"]     = appId
 	m["roleId"]    = roleId
 	m["permitId"]  = permitId
 	m["deletedBy"] = userId
-	
 	if err := c.Service.Delete(m); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {

+ 1 - 1
web/controllers/ent_cat_controller.go

@@ -51,9 +51,9 @@ func (c *EntCatController) GetById(entCatId int64) *JsonResult {
 
 func (c *EntCatController) Create() *JsonResult {
 	userId := c.GetCurUserId()
+	
 	entCat := datamodels.EntCat{}
 	entCat.CreatedBy = userId
-	
 	if err := c.Ctx.ReadJSON(&entCat); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}

+ 1 - 1
web/controllers/group_cat_controller.go

@@ -71,6 +71,7 @@ func (c *GroupCatController) Create() *JsonResult {
 func (c *GroupCatController) Update() *JsonResult {
     ocId     := c.GetCurOcId()
     userId   := c.GetCurUserId()
+    
     groupCat := datamodels.GroupCat{}
     if err := c.Ctx.ReadJSON(&groupCat); err != nil {
         return ResultErr("读取数据失败", nil)
@@ -93,7 +94,6 @@ func (c *GroupCatController) DeleteByID(groupCatId int64) *JsonResult {
     m["ocId"]       = ocId
     m["groupCatId"] = groupCatId
     m["deletedBy"]  = userId
-    
     if err := c.Service.Delete(m); err != nil {
         return ResultErr(err.Error(), nil)
     } else {

+ 1 - 3
web/controllers/group_controller.go

@@ -61,15 +61,14 @@ func (c *GroupController) Create() *JsonResult {
 func (c *GroupController) Update(groupId int64) *JsonResult {
     ocId   := c.GetCurOcId()
     userId := c.GetCurUserId()
-    group  := datamodels.Group{}
     
+    group  := datamodels.Group{}
     if err := c.Ctx.ReadJSON(&group); err != nil {
         return ResultErr("读取数据失败", nil)
     }
     
     group.OcId      = ocId
     group.UpdatedBy = userId
-    
     if err := c.Service.Update(&group); err != nil {
         return ResultErr(err.Error(), nil)
     } else {
@@ -85,7 +84,6 @@ func (c *GroupController) DeleteById(groupId int64) *JsonResult {
     m["ocId"]      = ocId
     m["groupId"]   = groupId
     m["deletedBy"] = userId
-    
     if err := c.Service.Delete(m); err != nil {
         return ResultErr(err.Error(), nil)
     } else {

+ 4 - 2
web/controllers/model_controller.go

@@ -41,6 +41,7 @@ func (c *ModelController) GetPage() *JsonResult {
 }
 
 func (c *ModelController) GetById(modelId int64) *JsonResult {
+	
 	data, err := c.Service.GetById(modelId)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -51,9 +52,9 @@ func (c *ModelController) GetById(modelId int64) *JsonResult {
 
 func (c *ModelController) Create() *JsonResult {
 	userId := c.GetCurUserId()
+	
 	mod := datamodels.Model{}
 	mod.CreatedBy = userId
-	
 	if err := c.Ctx.ReadJSON(&mod); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
@@ -68,6 +69,7 @@ func (c *ModelController) Create() *JsonResult {
 
 func (c *ModelController) Update() *JsonResult {
 	userId := c.GetCurUserId()
+	
 	mod  := datamodels.Model{}
 	if err := c.Ctx.ReadJSON(&mod); err != nil {
 		return ResultErr("读取数据失败", nil)
@@ -83,10 +85,10 @@ func (c *ModelController) Update() *JsonResult {
 
 func (c *ModelController) DeleteByID(modelId int64) *JsonResult {
 	userId := c.GetCurUserId()
+	
 	m := make(map[string]interface{})
 	m["modelId"]   = modelId
 	m["deletedBy"] = userId
-	
 	if err := c.Service.Delete(m); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {

+ 3 - 4
web/controllers/object_attr_controller.go

@@ -53,12 +53,11 @@ func (c *ObjectAttrController) Create() *JsonResult {
 	userId := c.GetCurUserId()
 	
 	attr   := datamodels.ObjectAttr{}
-	attr.CreatedBy = userId
 	if err := c.Ctx.ReadJSON(&attr); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
-
 	
+	attr.CreatedBy = userId
 	if err := c.Service.Create(&attr); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {
@@ -68,13 +67,13 @@ func (c *ObjectAttrController) Create() *JsonResult {
 
 func (c *ObjectAttrController) Update() *JsonResult {
 	userId := c.GetCurUserId()
+	
 	attr   := datamodels.ObjectAttr{}
 	if err := c.Ctx.ReadJSON(&attr); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
 
 	attr.UpdatedBy = userId
-	
 	if err := c.Service.Update(&attr); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {
@@ -84,12 +83,12 @@ func (c *ObjectAttrController) Update() *JsonResult {
 
 func (c *ObjectAttrController) DeleteByID(modelId, objectId, attrId int64) *JsonResult {
 	userId := c.GetCurUserId()
+	
 	m := make(map[string]interface{})
 	m["modelId"]   = modelId
 	m["objectId"]  = objectId
 	m["attrId"]    = attrId
 	m["deletedBy"] = userId
-	
 	if err := c.Service.Delete(m); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {

+ 6 - 5
web/controllers/object_controller.go

@@ -62,14 +62,14 @@ func (c *ObjectController) GetById(modelId, objectId int64) *JsonResult {
 
 func (c *ObjectController) Create() *JsonResult {
 	userId     := c.GetCurUserId()
+	
 	objectData := viewmodels.ObjectDataInfo{}
-	objectData.CreatedBy = userId
-	err := c.Ctx.ReadJSON(&objectData)
-	if err != nil {
+	if err := c.Ctx.ReadJSON(&objectData); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
 	
-	if err = c.Service.CreateObjectData(&objectData); err != nil {
+	objectData.CreatedBy = userId
+	if err := c.Service.CreateObjectData(&objectData); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {
 		return ResultOk("新增成功", nil)
@@ -78,6 +78,7 @@ func (c *ObjectController) Create() *JsonResult {
 
 func (c *ObjectController) Update() *JsonResult {
 	userId     := c.GetCurUserId()
+	
 	objectData := viewmodels.ObjectDataInfo{}
 	if err := c.Ctx.ReadJSON(&objectData); err != nil {
 		return ResultErr("读取数据失败", nil)
@@ -93,11 +94,11 @@ func (c *ObjectController) Update() *JsonResult {
 
 func (c *ObjectController) DeleteByID(modelId, objectId int64) *JsonResult {
 	userId := c.GetCurUserId()
+	
 	m := make(map[string]interface{})
 	m["modelId"]   = modelId
 	m["objectId"]  = objectId
 	m["deletedBy"] = userId
-	
 	if err := c.Service.Delete(m); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {

+ 4 - 3
web/controllers/partner_cat_controller.go

@@ -51,13 +51,13 @@ func (c *PartnerCatController) GetById(partnerCatId int64) *JsonResult {
 
 func (c *PartnerCatController) Create() *JsonResult {
 	userId     := c.GetCurUserId()
-	partnerCat := datamodels.PartnerCat{}
-	partnerCat.CreatedBy = userId
 	
+	partnerCat := datamodels.PartnerCat{}
 	if err := c.Ctx.ReadJSON(&partnerCat); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
 	
+	partnerCat.CreatedBy = userId
 	if err := c.Service.Create(&partnerCat); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {
@@ -67,6 +67,7 @@ func (c *PartnerCatController) Create() *JsonResult {
 
 func (c *PartnerCatController) Update() *JsonResult {
 	userId     := c.GetCurUserId()
+	
 	partnerCat := datamodels.PartnerCat{}
 	if err := c.Ctx.ReadJSON(&partnerCat); err != nil {
 		return ResultErr("读取数据失败", nil)
@@ -82,10 +83,10 @@ func (c *PartnerCatController) Update() *JsonResult {
 
 func (c *PartnerCatController) DeleteByID(partnerCatId int64) *JsonResult {
 	userId := c.GetCurUserId()
+	
 	m := make(map[string]interface{})
 	m["partnerCatId"] = partnerCatId
 	m["deletedBy"] = userId
-	
 	if err := c.Service.Delete(m); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {

+ 2 - 1
web/controllers/position_controller.go

@@ -54,7 +54,7 @@ func (c *PositionController) Create() *JsonResult {
 	userId   := c.GetCurUserId()
 	
 	position := datamodels.Position{}
-	position.OcId = ocId
+	position.OcId      = ocId
 	position.CreatedBy = userId
 	if err := c.Ctx.ReadJSON(&position); err != nil {
 		return ResultErr("读取数据失败", nil)
@@ -71,6 +71,7 @@ func (c *PositionController) Create() *JsonResult {
 func (c *PositionController) Update() *JsonResult {
 	ocId     := c.GetCurOcId()
 	userId   := c.GetCurUserId()
+	
 	position := datamodels.Position{}
 	if err := c.Ctx.ReadJSON(&position); err != nil {
 		return ResultErr("读取数据失败", nil)

+ 6 - 1
web/controllers/role_controller.go

@@ -50,12 +50,14 @@ func (c *RoleController) GetById(roleId int64) *JsonResult {
 }
 
 func (c *RoleController) Create() *JsonResult {
-	role := &datamodels.Role{}
+	userId := c.GetCurUserId()
 	
+	role := &datamodels.Role{}
 	if err := c.Ctx.ReadJSON(role); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
 	
+	role.CreatedBy = userId
 	if err := c.Service.Create(role); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {
@@ -64,11 +66,14 @@ func (c *RoleController) Create() *JsonResult {
 }
 
 func (c *RoleController) Update() *JsonResult {
+	userId := c.GetCurUserId()
+	
 	role := &datamodels.Role{}
 	if err := c.Ctx.ReadJSON(role); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
 	
+	role.UpdatedBy = userId
 	if err := c.Service.Update(role); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {

+ 3 - 3
web/controllers/task_cat_controller.go

@@ -25,8 +25,9 @@ func (c *TaskCatController) GetList() *JsonResult {
 	data, err := c.Service.GetList(params)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
+	} else {
+		return ResultOk("获取成功", data)
 	}
-	return ResultOk("获取成功", data)
 }
 
 func (c *TaskCatController) GetPage() *JsonResult {
@@ -41,6 +42,7 @@ func (c *TaskCatController) GetPage() *JsonResult {
 
 func (c *TaskCatController) GetById(taskCatId int64) *JsonResult {
 	ocId      := c.GetCurOcId()
+	
 	data, err := c.Service.GetById(ocId, taskCatId)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -60,7 +62,6 @@ func (c *TaskCatController) Create() *JsonResult {
 
 	taskCat.OcId      = ocId
 	taskCat.CreatedBy = userId
-	
 	if err := c.Service.Create(&taskCat); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {
@@ -79,7 +80,6 @@ func (c *TaskCatController) Update() *JsonResult {
 
 	taskCat.OcId      = ocId
 	taskCat.UpdatedBy = userId
-	
 	if err := c.Service.Update(&taskCat); err != nil {
 		return ResultErr(err.Error(), nil)
 	} else {

+ 6 - 2
web/controllers/user_controller.go

@@ -79,7 +79,6 @@ func (c *UserController) Create() *JsonResult {
 
 func (c *UserController) Update() *JsonResult {
     user := &viewmodels.UserInfo{}
-    
     if err := c.Ctx.ReadJSON(user); err != nil {
         return ResultErr("读取数据失败", nil)
     }
@@ -154,6 +153,7 @@ func (c *UserController) IsUserNameExist(userName string) *JsonResult {
 
 func (c *UserController) IsUserPhoneExist(userPhone string) *JsonResult {
     ocId := c.GetCurOcId()
+    
     bExist, err := c.Service.IsUserPhoneExist(ocId, userPhone)
     if err != nil {
         return ResultErr(err.Error(), nil)
@@ -167,6 +167,7 @@ func (c *UserController) IsUserPhoneExist(userPhone string) *JsonResult {
 
 func (c *UserController) IsStaffNoExist(staffNo string) *JsonResult {
     ocId := c.GetCurOcId()
+    
     bExist, err := c.Service.IsStaffNoExist(ocId, staffNo)
     if err != nil {
         return ResultErr(err.Error(), nil)
@@ -180,6 +181,7 @@ func (c *UserController) IsStaffNoExist(staffNo string) *JsonResult {
 
 func (c *UserController) IsEmailExist(email string) *JsonResult {
     ocId := c.GetCurOcId()
+    
     bExist, err := c.Service.IsEmailExist(ocId, email)
     if err != nil {
         return ResultErr(err.Error(), nil)
@@ -193,6 +195,7 @@ func (c *UserController) IsEmailExist(email string) *JsonResult {
 
 func (c *UserController) SelectUser() *JsonResult {
     ocId := c.GetCurOcId()
+    
     data, err := c.Service.SelectUser(ocId)
     if err != nil {
         return ResultErr(err.Error(), nil)
@@ -201,8 +204,9 @@ func (c *UserController) SelectUser() *JsonResult {
     }
 }
 
-func (c *UserController) GetPermit()*JsonResult{
+func (c *UserController) GetPermit()*JsonResult {
     userId := c.GetCurUserId()
+    
     appKey := c.GetAppKey()
     data, err := c.Service.GetPermit(userId, appKey)
     if err != nil {

+ 6 - 11
web/router/routes.go

@@ -74,16 +74,6 @@ func Configure(b *bootstrap.Bootstrapper) {
 		userApp.Handle(new(controllers.UserController))
 	}
 	
-	// Permit
-	permit := b.Party("/app", crs).AllowMethods(iris.MethodOptions)
-	{
-		// Permit
-		appPermitService := system.NewAppPermitService()
-		appPermitApp := mvc.New(permit.Party("/permit"))
-		appPermitApp.Register(appPermitService)
-		appPermitApp.Handle(new(controllers.AppPermitController))
-	}
-
 	// Position
 	position := b.Party("/position", crs).AllowMethods(iris.MethodOptions)
 	{
@@ -104,7 +94,7 @@ func Configure(b *bootstrap.Bootstrapper) {
 		groupCatApp.Handle(new(controllers.GroupCatController))
 	}
 
-	// AppCat
+	// App
 	app := b.Party("/app", crs).AllowMethods(iris.MethodOptions)
 	{
 		app.Use(middleware.AuthToken)
@@ -117,6 +107,11 @@ func Configure(b *bootstrap.Bootstrapper) {
 		appCatApp := mvc.New(app.Party("/cat"))
 		appCatApp.Register(appCatService)
 		appCatApp.Handle(new(controllers.AppCatController))
+		
+		appPermitService := system.NewAppPermitService()
+		appPermitApp := mvc.New(app.Party("/permit"))
+		appPermitApp.Register(appPermitService)
+		appPermitApp.Handle(new(controllers.AppPermitController))
 	}
 
 	// TaskCat