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

Merge branch 'develop' of http://code.dashoo.cn/chengjian/opms_backend into develop

liuyaqi 2 лет назад
Родитель
Сommit
1aef8112ae

+ 1 - 1
opms_admin/app/model/base_product_auth.go

@@ -41,7 +41,7 @@ type SaveBaseProductAuthReq struct {
 	UserName  string         `orm:"user_name"  json:"userName"    v:"required#用户姓名不能为空"`                // 用户姓名
 	UserPost  string         `orm:"user_post"  json:"userPost"`                                         // 岗位
 	UserPhone string         `orm:"user_phone" json:"userPhone"`                                        // 电话
-	Lines     []*ProductLine `json:"lines"     v:"required#产品线不能为空"`
+	Lines     []*ProductLine `json:"lines"`
 }
 
 // ProductLine 产品线

+ 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"   `                         // 助计名
@@ -146,7 +146,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+"%")