zhangchuanxing 1 ヶ月 前
コミット
f514329e01

+ 1 - 1
controllers/statistic_company_merge.go

@@ -368,7 +368,7 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
 
 		//销售筛选条件
 		if adminId != "" {
-			condition1 += ` AND a.seller_id_last in  (` + adminId + `) `
+			condition1 += ` AND c.seller_id_last in  (` + adminId + `) `
 		} else {
 			condition1, pars1 = getQueryParamsLast(condition1, pars1, sysUser, "c.")
 		}

+ 2 - 2
controllers/statistic_report.go

@@ -199,7 +199,7 @@ func getQueryParamsLast(condition string, pars []interface{}, sysUser *system.Ad
 		//如果不是研究员,那么去找对应的 部门、小组、销售
 		if sysUser.Authority == 0 {
 			//普通用户
-			condition += " AND a.seller_id_last=?"
+			condition += " AND c.seller_id_last=?"
 			pars = append(pars, sysUser.AdminId)
 		} else if sysUser.Authority == 1 {
 			//部门主管
@@ -249,7 +249,7 @@ func getQueryParamsLast(condition string, pars []interface{}, sysUser *system.Ad
 			pars = append(pars, sysUser.GroupId)
 		} else {
 			//不知道什么类型的用户(后面新增的位置类型客户)
-			condition += " AND a.seller_id_last=?"
+			condition += " AND c.seller_id_last=?"
 			pars = append(pars, sysUser.AdminId)
 		}
 	}

+ 7 - 10
models/company/company_contract.go

@@ -386,14 +386,11 @@ func UpdateCompanyContractTypeinit16_1_02(seller_name_init string, seller_id_ini
 // 合同未生效更新对应销售的信息
 func UpdateCompanyContractSellerNotEffective(sellerId, shareSellerInit int, sellerName, shareSeller string, companyContractId int) (err error) {
 	o := orm.NewOrm()
-	sql := `UPDATE company_contract SET seller_id_init = ? ,
-                            seller_name_init = ? ,
-                            share_seller_init = ? ,
-                            share_seller_id_init = ? , 
-                            seller_id_last = ? , 
-                            seller_name_last = ? , 
-                            share_seller_last = ? , 
-                            share_seller_id_last = ?  WHERE company_contract_id = ?  AND product_id= 2 `
+	sql := `UPDATE company_contract SET seller_id_init = ? , seller_name_init = ? ,                         
+                            share_seller_id_init = ? , share_seller_init = ? ,
+                            seller_id_last = ? , seller_name_last = ? ,                          
+                           share_seller_id_last = ? ,    share_seller_last= ?
+                            WHERE company_contract_id = ?  AND product_id= 2 `
 	_, err = o.Raw(sql, sellerId, sellerName, shareSellerInit, shareSeller, sellerId, sellerName, shareSellerInit, shareSeller, companyContractId).Exec()
 	return
 }
@@ -404,8 +401,8 @@ func UpdateCompanyContractSellerUnexpired(sellerId, shareSellerInit int, sellerN
 	sql := `UPDATE company_contract SET
                             seller_id_last = ? , 
                             seller_name_last = ? , 
-                            share_seller_last = ? , 
-                            share_seller_id_last = ?  WHERE company_contract_id = ?  AND product_id= 2 `
+                            share_seller_id_last  = ? , 
+                            share_seller_last= ?  WHERE company_contract_id = ?  AND product_id= 2 `
 	_, err = o.Raw(sql, sellerId, sellerName, shareSellerInit, shareSeller, companyContractId).Exec()
 	return
 }

+ 1 - 1
models/statistic_report.go

@@ -930,7 +930,7 @@ func GetIncrementalCompanyListByOperationRecordMerge(condition string, pars []in
 	o := orm.NewOrm()
 
 	//查询真正的数据
-	sql := `SELECT a.company_contract_id,a.contract_type ,a.company_product_id ,a.contract_code ,a.pay_method ,a.pay_channel ,a.package_difference ,a.company_id, a.start_date, a.end_date, a.money, b.company_name, a.seller_id_last as seller_id, a.seller_name_last as  seller_name,a.share_seller_last as  share_seller, a.product_id, a.product_name, a.create_time, b.region_type, c.renewal_reason, c.renewal_todo, c.status  FROM company_contract a
+	sql := `SELECT a.company_contract_id,a.contract_type ,a.company_product_id ,a.contract_code ,a.pay_method ,a.pay_channel ,a.package_difference ,a.company_id, a.start_date, a.end_date, a.money, b.company_name, a.seller_id_last as seller_id, c.seller_name_last as  seller_name, c.share_seller_last as  share_seller, a.product_id, a.product_name, a.create_time, b.region_type, c.renewal_reason, c.renewal_todo, c.status  FROM company_contract a
 		RIGHT JOIN company b ON a.company_id = b.company_id
 		JOIN company_product c ON b.company_id = c.company_id 
 		AND a.product_id = c.product_id  where 1=1  `