|
@@ -449,14 +449,6 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
page.SetCurrent(1)
|
|
|
}
|
|
|
|
|
|
- //if req.SellerIds != "" {
|
|
|
- // sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
- // cond += ` AND (a.seller_id in ? ) `
|
|
|
- // historyCond += ` AND (seller_id in ? ) `
|
|
|
- // pars = append(pars, sellerIds)
|
|
|
- // historyPars = append(historyPars, sellerIds)
|
|
|
- //}
|
|
|
-
|
|
|
var departmentId int
|
|
|
if req.SellerType == 1 {
|
|
|
departmentId = crm.SellerDepartmentId
|
|
@@ -498,28 +490,36 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
historyCond += ` AND new_company = 0 `
|
|
|
}
|
|
|
|
|
|
- groupIds := make([]int, 0)
|
|
|
- if req.GroupId > 0 {
|
|
|
- // 筛选组别时, 查询当前组别的下级组(因为admin表存的group_id, 有三级的存的是子ID, 只有二级的存的才是父ID =_=!)
|
|
|
- groupCond := `parent_id = ?`
|
|
|
- groupPars := make([]interface{}, 0)
|
|
|
- groupPars = append(groupPars, req.GroupId)
|
|
|
- groupOB := new(crm.SysGroup)
|
|
|
- groupList, e := groupOB.List(groupCond, groupPars)
|
|
|
- if e != nil {
|
|
|
- resp.FailMsg("获取失败", "获取组别下级组列表失败, Err: "+e.Error(), c)
|
|
|
- return
|
|
|
- }
|
|
|
- groupIds = append(groupIds, req.GroupId)
|
|
|
- for i := range groupList {
|
|
|
- groupIds = append(groupIds, groupList[i].GroupId)
|
|
|
- }
|
|
|
- cond += ` AND (c.seller_group_id IN (?) OR d.seller_group_id IN (?))`
|
|
|
- pars = append(pars, groupIds, groupIds)
|
|
|
- historyCond += ` AND group_id IN (?) `
|
|
|
- historyPars = append(historyPars, groupIds)
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ cond += ` AND (a.seller_id in ? ) `
|
|
|
+ historyCond += ` AND (seller_id in ? ) `
|
|
|
+ pars = append(pars, sellerIds)
|
|
|
+ historyPars = append(historyPars, sellerIds)
|
|
|
}
|
|
|
|
|
|
+ //groupIds := make([]int, 0)
|
|
|
+ //if req.GroupId > 0 {
|
|
|
+ // // 筛选组别时, 查询当前组别的下级组(因为admin表存的group_id, 有三级的存的是子ID, 只有二级的存的才是父ID =_=!)
|
|
|
+ // groupCond := `parent_id = ?`
|
|
|
+ // groupPars := make([]interface{}, 0)
|
|
|
+ // groupPars = append(groupPars, req.GroupId)
|
|
|
+ // groupOB := new(crm.SysGroup)
|
|
|
+ // groupList, e := groupOB.List(groupCond, groupPars)
|
|
|
+ // if e != nil {
|
|
|
+ // resp.FailMsg("获取失败", "获取组别下级组列表失败, Err: "+e.Error(), c)
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // groupIds = append(groupIds, req.GroupId)
|
|
|
+ // for i := range groupList {
|
|
|
+ // groupIds = append(groupIds, groupList[i].GroupId)
|
|
|
+ // }
|
|
|
+ // cond += ` AND (c.seller_group_id IN (?) OR d.seller_group_id IN (?))`
|
|
|
+ // pars = append(pars, groupIds, groupIds)
|
|
|
+ // historyCond += ` AND group_id IN (?) `
|
|
|
+ // historyPars = append(historyPars, groupIds)
|
|
|
+ //}
|
|
|
+
|
|
|
if req.CompanyType == 1 {
|
|
|
cond += ` AND b.contract_type = 1 `
|
|
|
historyCond += ` AND new_company = 1 `
|
|
@@ -560,10 +560,10 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
|
amountPars = append(amountPars, summaryIds)
|
|
|
- if len(groupIds) > 0 {
|
|
|
- amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
|
|
|
- amountPars = append(amountPars, groupIds)
|
|
|
- }
|
|
|
+ //if len(groupIds) > 0 {
|
|
|
+ // amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
|
|
|
+ // amountPars = append(amountPars, groupIds)
|
|
|
+ //}
|
|
|
|
|
|
if req.SellerIds != "" {
|
|
|
sellerIds := strings.Split(req.SellerIds, ",")
|
|
@@ -645,10 +645,10 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
|
amountPars = append(amountPars, summaryIds)
|
|
|
- if len(groupIds) > 0 {
|
|
|
- amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
|
|
|
- amountPars = append(amountPars, groupIds)
|
|
|
- }
|
|
|
+ //if len(groupIds) > 0 {
|
|
|
+ // amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
|
|
|
+ // amountPars = append(amountPars, groupIds)
|
|
|
+ //}
|
|
|
if req.SellerIds != "" {
|
|
|
sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
@@ -743,10 +743,10 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
|
amountPars = append(amountPars, summaryIds)
|
|
|
- if len(groupIds) > 0 {
|
|
|
- amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
|
|
|
- amountPars = append(amountPars, groupIds)
|
|
|
- }
|
|
|
+ //if len(groupIds) > 0 {
|
|
|
+ // amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
|
|
|
+ // amountPars = append(amountPars, groupIds)
|
|
|
+ //}
|
|
|
if req.SellerIds != "" {
|
|
|
sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|