-
Notifications
You must be signed in to change notification settings - Fork 0
/
industry_service.go
executable file
·72 lines (56 loc) · 1.73 KB
/
industry_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package platform_services
import (
"fmt"
"log"
"github.com/zapscloud/golib-dbutils/db_utils"
"github.com/zapscloud/golib-platform/platform_repository"
"github.com/zapscloud/golib-utils/utils"
)
type IndustryService interface {
List(filter string, sort string, skip int64, limit int64) (utils.Map, error)
GetIndustryById(industryid string) (utils.Map, error)
EndService()
}
type industryBaseService struct {
db_utils.DatabaseService
daoIndustry platform_repository.IndustryDao
child IndustryService
}
func NewIndustryService(props utils.Map) (IndustryService, error) {
p := industryBaseService{}
err := p.OpenDatabaseService(props)
if err != nil {
log.Println("NewIndustryDBService ", err)
return nil, err
}
log.Printf("IndustryDBService ")
p.child = &p
p.daoIndustry = platform_repository.NewIndustryDao(p.GetClient())
return &p, nil
}
// EndIndustryService - Close all the services
func (p *industryBaseService) EndService() {
log.Printf("EndIndustryDBService ")
p.CloseDatabaseService()
}
// List - List All records
func (p *industryBaseService) List(filter string, sort string, skip int64, limit int64) (utils.Map, error) {
log.Println("CustomerService::FindAll - Begin")
listdata, err := p.daoIndustry.List(filter, sort, skip, limit)
if err != nil {
fmt.Println("Error ", err)
return nil, err
}
log.Println("CustomerService::FindAll - End ")
return listdata, nil
}
func (p *industryBaseService) GetIndustryById(industryid string) (utils.Map, error) {
log.Println("CustomerService::FindAll - Begin")
industryData, err := p.daoIndustry.GetIndustryById(industryid)
if err != nil {
fmt.Println("Error ", err)
return nil, err
}
log.Println("CustomerService::FindAll - End ")
return industryData, nil
}