From dac214fa72dc2974954a4d8ee934695f548ad155 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期三, 02 八月 2023 14:14:30 +0800
Subject: [PATCH] fix
---
service/serviceFeeManage.go | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/service/serviceFeeManage.go b/service/serviceFeeManage.go
index 837ff59..5afaf9a 100644
--- a/service/serviceFeeManage.go
+++ b/service/serviceFeeManage.go
@@ -3,13 +3,14 @@
import (
"aps_crm/model"
"aps_crm/pkg/ecode"
+ "aps_crm/pkg/mysqlx"
)
type FeeManageService struct{}
func (FeeManageService) AddServiceFeeManage(serviceFeeManage *model.ServiceFeeManage) int {
- tx := model.NewContactSearch().Orm.Begin()
+ tx := mysqlx.GetDB().Begin()
err := model.NewClientSearch(tx).Create(serviceFeeManage.Client)
if err != nil {
@@ -42,15 +43,6 @@
return ecode.OK
}
-func (FeeManageService) GetServiceFeeManageList() ([]*model.ServiceFeeManage, int) {
- list, err := model.NewServiceFeeManageSearch(nil).FindAll()
- if err != nil {
- return nil, ecode.ServiceFeeManageListErr
- }
-
- return list, ecode.OK
-}
-
func (FeeManageService) UpdateServiceFeeManage(serviceFeeManage *model.ServiceFeeManage) int {
// check serviceFeeManage exist
_, err := model.NewServiceFeeManageSearch(nil).SetId(serviceFeeManage.Id).Find()
@@ -58,7 +50,7 @@
return ecode.ServiceFeeManageNotExist
}
- tx := model.NewContactSearch().Orm.Begin()
+ tx := mysqlx.GetDB().Begin()
err = model.NewServiceFeeManageSearch(tx).SetId(serviceFeeManage.Id).Update(serviceFeeManage)
if err != nil {
@@ -77,3 +69,12 @@
return ecode.OK
}
+
+func (FeeManageService) GetServiceFeeManageList(page, pageSize int, keyword string) ([]*model.ServiceFeeManage, int64, int) {
+ // get contact list
+ contacts, total, err := model.NewServiceFeeManageSearch(nil).SetKeyword(keyword).SetPage(page, pageSize).FindAll()
+ if err != nil {
+ return nil, 0, ecode.ServiceFeeManageListErr
+ }
+ return contacts, total, ecode.OK
+}
--
Gitblit v1.8.0