houyaf 3 gadi atpakaļ
vecāks
revīzija
c618fe47cb

+ 13 - 13
datamodel/biz_object.go

@@ -3,19 +3,19 @@ package datamodel
 import "time"
 
 type BizObject struct {
-    BizId       int64     `json:"bizId"           xorm:"'biz_id'          bigint      pk comment('Biz ID')         "`
-    ObjectId    int64     `json:"objectId"        xorm:"'object_id'       bigint      pk comment('Object ID')      "`
-    ObjectType  int64     `json:"objectType"      xorm:"'object_type'     bigint         comment('Object Type')    "`
-    ObjectTitle string    `json:"objectTitle"     xorm:"'object_title'    varchar(127)   comment('Object Title')   "`
-    ObjectCode  string    `json:"objectCode"      xorm:"'object_code'     varchar(127)   comment('Object Code')    "`
-    Comment     string    `json:"comment"         xorm:"'comment'         varchar(255)   comment('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'"`
+    BizId       int64       `json:"bizId"           xorm:"'biz_id'          bigint      pk comment('Biz ID')         "`
+    ObjectId    int64       `json:"objectId"        xorm:"'object_id'       bigint      pk comment('Object ID')      "`
+    ObjectType  int64       `json:"objectType"      xorm:"'object_type'     bigint         comment('Object Type')    "`
+    ObjectTitle string      `json:"objectTitle"     xorm:"'object_title'    varchar(127)   comment('Object Title')   "`
+    ObjectCode  string      `json:"objectCode"      xorm:"'object_code'     varchar(127)   comment('Object Code')    "`
+    Comment     string      `json:"comment"         xorm:"'comment'         varchar(255)   comment('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 *BizObject) TableName() string {

+ 0 - 1
service/biz_service.go

@@ -60,7 +60,6 @@ func (s *bizService) GetTreeData() ([]viewmodel.BizTreeInfo, error) {
                     Comment: object.Comment,
                 }
                 
-                
                 treeNodes = append(treeNodes, treeNode)
             }
         }

+ 4 - 4
viewmodel/account_info.go

@@ -4,7 +4,7 @@ type AccountInfo struct {
 	OcId            int64  `json:"ocId"             xorm:"'oc_id'             bigint         comment('组织ID:公司或机构或单位ID')"`
 	OcTypeId        int64  `json:"ocTypeId"         xorm:"'oc_type_id'        bigint         comment('OC TYPE ID')"`
 	OcTypeTitle     string `json:"ocTypeTitle"      xorm:"'oc_type_title'     varchar(128)   comment('OC TYPE TITLE')"`
-	AccountId       int64  `json:"accountId"        xorm:"'account_id'        bigint not null pk comment('主键ID')"`
+	AccountId       int64  `json:"accountId"        xorm:"'account_id'        bigint         comment('主键ID')"`
 	AccountName     string `json:"accountName"      xorm:"'account_name'      varchar(128)   comment('帐号名称')"`
 	Password        string `json:"password"         xorm:"'password'          varchar(255)   comment('密码')"`
 	AccountType     int64  `json:"accountType"      xorm:"'account_type'      bigint         comment('帐号类型:0:系统用户,1:企业用户,2:集团用户,3:政府用户,4:合作伙伴')"`
@@ -17,9 +17,9 @@ type AccountInfo struct {
 	AccountLoc      string `json:"accountLoc"       xorm:"'account_loc'       varchar(64)    comment('区域')"`
 	AccountMail     string `json:"accountMail"      xorm:"'account_mail'      varchar(64)    comment('Email')"`
 	AccountStaffNo  string `json:"accountStaffNo"   xorm:"'account_staff_no'  varchar(64)    comment('Email')"`
-	Status          int64  `json:"status"           xorm:"'status'            bigint         default 1 comment('状态,默认值 1,[0:未激活; 1:正常; 2:锁定; -1:删除'])"`
-	WxId            int64  `json:"wxId"             xorm:"'wxId'              bigint         default 1 comment('状态,默认值 1,[0:未激活; 1:正常; 2:锁定; -1:删除'])"`
-	IsFixed         int64  `json:"isFixed"          xorm:"'isFixed'           bigint         default 1 comment('状态,默认值 1,[0:未激活; 1:正常; 2:锁定; -1:删除'])"`
+	Status          int64  `json:"status"           xorm:"'status'            bigint         default 1 comment('状态')"`
+	WxId            int64  `json:"wxId"             xorm:"'wxId'              bigint         default 1 comment('微信ID')"`
+	IsFixed         int64  `json:"isFixed"          xorm:"'isFixed'           bigint         default 1 comment('是否可删除')"`
 }
 
 func (t *AccountInfo) TableName() string {

+ 15 - 15
viewmodel/api_info.go

@@ -3,21 +3,21 @@ package viewmodel
 import "encoding/json"
 
 type ApiInfo struct {
-    BizId           int64     `json:"bizId"         xorm:"'biz_id'          bigint         comment('Biz Id')       "`
-    BizTitle        string    `json:"bizTitle"      xorm:"'biz_title'       varchar(127)   comment('Biz Title')    "`
-    ApiId           int64     `json:"apiId"         xorm:"'api_id'          bigint     pk  comment('Api ID')       "`
-    ApiType         int64     `json:"apiType"       xorm:"'api_type'        bigint         comment('Api Type')     "`
-    ApiMethod       int64     `json:"apiMethod"     xorm:"'api_method'      bigint         comment('Api Method')"`
-    ApiTitle        string    `json:"apiTitle"      xorm:"'api_title'       varchar(127)   comment('名称')          "`
-    ApiCode         string    `json:"apiCode"       xorm:"'api_code'        varchar(127)   comment('编码')          "`
-    ApiParams       string    `json:"apiParams"     xorm:"'api_params'      varchar(127)   comment('Param')         "`
-    Status          int64     `json:"status"        xorm:"'status'          bigint         comment('Status')        "`
-    ApiDesc         string    `json:"apiDesc"       xorm:"'api_desc'        varchar(50)    comment('描述')           "`
-    ObjectId        int64     `json:"objectId"      xorm:"'object_id'       bigint         comment('Object Id')     "`
-    ObjectTitle     string    `json:"objectTitle"   xorm:"'object_title'    varchar(127)   comment('Object Title')  "`
-    ObjectType      int64     `json:"objectType"    xorm:"'object_type'     bigint         comment('Object Type')   "`
-    ObjectCode      string    `json:"objectCode"    xorm:"'object_code'     varchar(127)   comment('Object Code')   "`
-    OamId           int64     `json:"oamId"         xorm:"'oam_id'          bigint         comment('Oam Id')        "`
+    BizId           int64     `json:"bizId"         xorm:"'biz_id'          bigint         comment('Biz Id')         "`
+    BizTitle        string    `json:"bizTitle"      xorm:"'biz_title'       varchar(127)   comment('Biz Title')      "`
+    ApiId           int64     `json:"apiId"         xorm:"'api_id'          bigint     pk  comment('Api ID')         "`
+    ApiType         int64     `json:"apiType"       xorm:"'api_type'        bigint         comment('Api Type')       "`
+    ApiMethod       int64     `json:"apiMethod"     xorm:"'api_method'      bigint         comment('Api Method')     "`
+    ApiTitle        string    `json:"apiTitle"      xorm:"'api_title'       varchar(127)   comment('名称')            "`
+    ApiCode         string    `json:"apiCode"       xorm:"'api_code'        varchar(127)   comment('编码')            "`
+    ApiParams       string    `json:"apiParams"     xorm:"'api_params'      varchar(127)   comment('Param')          "`
+    Status          int64     `json:"status"        xorm:"'status'          bigint         comment('Status')         "`
+    ApiDesc         string    `json:"apiDesc"       xorm:"'api_desc'        varchar(50)    comment('描述')            "`
+    ObjectId        int64     `json:"objectId"      xorm:"'object_id'       bigint         comment('Object Id')      "`
+    ObjectTitle     string    `json:"objectTitle"   xorm:"'object_title'    varchar(127)   comment('Object Title')   "`
+    ObjectType      int64     `json:"objectType"    xorm:"'object_type'     bigint         comment('Object Type')    "`
+    ObjectCode      string    `json:"objectCode"    xorm:"'object_code'     varchar(127)   comment('Object Code')    "`
+    OamId           int64     `json:"oamId"         xorm:"'oam_id'          bigint         comment('Oam Id')         "`
     OamTitle        string    `json:"oamTitle"      xorm:"'oam_title'       varchar(127)   comment('OAMTitle')       "`
     OamCode         string    `json:"oamCode"       xorm:"'oam_code'        varchar(127)   comment('OAMCode')        "`
     OamType         int64     `json:"oamType"       xorm:"'oam_type'        bigint         comment('Oam Type')       "`

+ 26 - 0
viewmodel/repo_object_tree_info.go

@@ -0,0 +1,26 @@
+package viewmodel
+
+type RepoObjectNodeInfo struct {
+    Label           string  `json:"label"           xorm:"'label'           varchar(50)   comment('Label 名称')    "`
+    Value           int64   `json:"value"           xorm:"'value'           bigint        comment('Value ID')      "`
+    IsLeaf          int64   `json:"isLeaf"          xorm:"'isLeaf'          bigint        comment('Is Leaf')       "`
+    ModelId         int64   `json:"modelId"         xorm:"'model_id'        bigint        comment('Model ID')      "`
+    ObjectId        int64   `json:"objectId"        xorm:"'object_id'       bigint        comment('Object ID')     "`
+    ObjectTitle     string  `json:"objectTitle"     xorm:"'object_title'    varchar(127)  comment('Object Title')  "`
+    ObjectType      string  `json:"objectType"      xorm:"'object_type'     bigint        comment('Object Type')   "`
+    ObjectCode      string  `json:"objectCode"      xorm:"'object_code'     varchar(127)  comment('Object Code')   "`
+}
+
+type RepoModelTreeInfo struct {
+    Label       string  `json:"label"               xorm:"'label'           varchar(50)   comment('Label 名称')    "`
+    Value       int64   `json:"value"               xorm:"'value'           bigint        comment('Value ID')      "`
+    IsLeaf      int64   `json:"isLeaf"              xorm:"'isLeaf'          bigint        comment('Is Leaf')       "`
+    ModelId     int64   `json:"modelId"             xorm:"'model_id'        bigint        comment('Model ID')      "`
+    ModelTitle  string  `json:"modelTitle"          xorm:"'model_title'     varchar(50)   comment('Model Title')   "`
+    Children    []RepoObjectNodeInfo `json:"children"`
+}
+
+func (t *RepoModelTreeInfo) TableName() string {
+    return "repo_object"
+}
+

+ 4 - 6
web/controller/repo_object_controller.go

@@ -12,9 +12,9 @@ type RepoObjectController struct {
 }
 
 func (c *RepoObjectController) BeforeActivation(b mvc.BeforeActivation) {
-    b.Handle("GET",         "/{repoId:int64}",                                  "GetListById"   )
-    b.Handle("POST",        "/add",                                             "Create"        )
-    b.Handle("DELETE",      "/{repoId:int64}/{modelId:int64}/{objectId:int64}", "DeleteByID"    )
+    b.Handle("GET",     "/{repoId:int64}",                                  "GetListById"   )
+    b.Handle("POST",    "/add",                                             "Create"        )
+    b.Handle("DELETE",  "/{repoId:int64}/{modelId:int64}/{objectId:int64}", "DeleteByID"    )
 }
 
 func (c *RepoObjectController) GetListById(repoId int64) *JsonResult {
@@ -28,14 +28,12 @@ func (c *RepoObjectController) GetListById(repoId int64) *JsonResult {
 
 func (c *RepoObjectController) Create() *JsonResult {
     userId := c.GetCurUserId()
-    
-    data := datamodel.RepoObject{}
+    data   := datamodel.RepoObject{}
     data.CreatedBy = userId
     if err := c.Ctx.ReadJSON(&data); err != nil {
         return ResultErr("读取数据失败", nil)
     }
     
-    
     if err := c.Service.Create(&data); err != nil {
         return ResultErr(err.Error(), nil)
     } else {