Просмотр исходного кода

feature(优化):储备客户分类查看客户

ZZH-wl 2 лет назад
Родитель
Сommit
6ab080e707

+ 3 - 3
opms_parent/app/model/cust/cust_customer.go

@@ -31,7 +31,7 @@ type CustCustomerSearchReq struct {
 	request.PageReq
 }
 
-//CustCustomerExport 导出参数
+// CustCustomerExport 导出参数
 type CustCustomerExport struct {
 	CustCustomerSearchReq
 	Columns []string `json:"columns"` // 导出列
@@ -44,7 +44,7 @@ type CustExport struct {
 	Content []byte `json:"content"` // 导出数据流
 }
 
-//CustomerAddSeq 单表添加客户信息表
+// CustomerAddSeq 单表添加客户信息表
 type CustomerAddSeq struct {
 	CustName         string      `p:"custName"        json:"custName"      v:"required#客户名称不能为空"` // 客户名称
 	AbbrName         string      `p:"abbrName"        json:"abbrName"   `                         // 助计名
@@ -147,7 +147,7 @@ type MergeCustomerRep struct {
 	ChooseId []int64 `json:"chooseId,omitempty"` //被合并的客户id
 }
 
-//UpdateCustomer 修改客户
+// UpdateCustomer 修改客户
 type UpdateCustomer struct {
 	Id int64 `json:"id,omitempty"` //客户id
 	*CustomerAddSeq

+ 10 - 6
opms_parent/app/service/cust/cust_customer.go

@@ -69,14 +69,18 @@ func NewCustomerService(ctx context.Context) (svc *CustomerService, err error) {
 // GetList 客户列表列表
 func (s *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int, customerList []*model.CustList, err error) {
 	Model := s.Dao.DataScope(s.Ctx, "sales_id")
-	if req.TargetType == "" {
-		if !req.IsPublic {
-			Model = Model.Where(s.Dao.C.SalesId, s.CxtUser.Id).Where(s.Dao.C.IsPublic, noPublic)
-		} else {
-
-			Model = Model.Where(s.Dao.C.IsPublic, isPublic)
+	if req.IsPublic {
+		Model = Model.Where(s.Dao.C.IsPublic, isPublic)
+	} else {
+		Model = Model.Where(s.Dao.C.IsPublic, noPublic)
+		if req.TargetType == "self" {
+			Model = Model.Where(s.Dao.C.SalesId, s.CxtUser.Id)
+		}
+		if req.TargetType == "other" {
+			Model = Model.WhereNot(s.Dao.C.SalesId, s.CxtUser.Id)
 		}
 	}
+
 	//客户名称
 	if req.CustName != "" {
 		Model = Model.Where(s.Dao.C.CustName+" like ?", "%"+req.CustName+"%")