houyaf 3 rokov pred
rodič
commit
75b878f82e

+ 7 - 1
service/biz_object_mapping_service.go

@@ -10,7 +10,8 @@ import (
 type BizObjectMappingService interface {
     GetList(m map[string]interface{}) ([]viewmodels.BizObjectMappingInfo, error)
     GetPage(m map[string]interface{}) (*viewmodels.PageResult, error)
-    GetById(bizId, objectId, attrId int64) (*viewmodels.BizObjectMappingInfo, error)
+    GetById(bizId, objectId, mappingId int64) (*viewmodels.BizObjectMappingInfo, error)
+    GetListById(bizId, objectId int64) ([]viewmodels.BizObjectMappingInfo, error)
     Create(d *datamodels.BizObjectMapping) error
     Update(d *datamodels.BizObjectMapping) error
     Delete(m map[string]interface{}) error
@@ -30,6 +31,11 @@ func (s *bizObjectMappingService) GetList(m map[string]interface{}) ([]viewmodel
     return s.repo.GetList(m)
 }
 
+func (s *bizObjectMappingService) GetListById(bizId, objectId int64) ([]viewmodels.BizObjectMappingInfo, error) {
+    return s.repo.GetListById(bizId, objectId)
+}
+
+
 func (s *bizObjectMappingService) GetPage(m map[string]interface{}) (*viewmodels.PageResult, error) {
     return s.repo.GetPage(m)
 }

+ 13 - 0
web/controllers/biz_object_mapping_controller.go

@@ -15,6 +15,7 @@ func (c *BizObjectMappingController) BeforeActivation(b mvc.BeforeActivation) {
     b.Handle("GET",         "/",                                                    "GetList"   )
     b.Handle("GET",         "/page",                                                "GetPage"   )
     b.Handle("GET",         "/{bizId:int64}/{objectId:int64}/{mappingId:int64}",    "GetById"   )
+    b.Handle("GET",         "/{bizId:int64}/{objectId:int64}",                      "GetListById")
     b.Handle("POST",        "/add",                                                 "Create"    )
     b.Handle("DELETE",      "/{bizId:int64}/{objectId:int64}/{mappingId:int64}",    "DeleteByID")
 }
@@ -34,6 +35,18 @@ func (c *BizObjectMappingController) GetList() *JsonResult {
     }
 }
 
+func (c *BizObjectMappingController) GetListById(bizId, objectId int64) *JsonResult {
+    if bizId <= 0 {
+        return ResultErr("参数不完整", nil)
+    }
+    data, err := c.Service.GetListById(bizId, objectId)
+    if err != nil {
+        return ResultErr(err.Error(), nil)
+    } else {
+        return ResultOk("获取成功", data)
+    }
+}
+
 func (c *BizObjectMappingController) GetPage() *JsonResult {
     params  := c.buildParams()
     bizId   := c.Ctx.URLParamInt64Default("bizId", 0)