Browse Source

Merge pull request '客户分页列表添加用户名称' (#285) from fix_searchHead into develop

Reviewed-on: http://101.201.121.115:3000/leo/LAPP_CHEERSSON_BACKEND/pulls/285
fix_import_bluk_params
徐腾飞 3 years ago
parent
commit
0f6a7b0eb2
3 changed files with 37 additions and 12 deletions
  1. +22
    -11
      dao/ap/implments/CustDemandVerHead.dao.impl.go
  2. +1
    -0
      models/ap/CustDemandVerHead.model.go
  3. +14
    -1
      models/common/common.go

+ 22
- 11
dao/ap/implments/CustDemandVerHead.dao.impl.go View File

@ -9,6 +9,7 @@ import (
meta "leit.com/LAPP_CHEERSSON_BACKEND/meta/ap"
model "leit.com/LAPP_CHEERSSON_BACKEND/models/ap"
baseModel "leit.com/LAPP_CHEERSSON_BACKEND/models/base"
"leit.com/LAPP_CHEERSSON_BACKEND/models/common"
"leit.com/LAPP_CHEERSSON_BACKEND/utils"
"xorm.io/core"
)
@ -434,7 +435,7 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(paging *grmi.Paging, group
//查询有效的版本
where := fmt.Sprintf("AP_CustDemandVerHead.PlantNr = %d", impl.plantNr)
joinstr := " INNER JOIN AP_UserCustlst ON AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId INNER JOIN AP_CustDemandHead ON AP_CustDemandVerHead.PlantNr = AP_CustDemandHead.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_CustDemandHead.CustomerId AND AP_CustDemandVerHead.VersionId = AP_CustDemandHead.VersionId "
joinstr := " INNER JOIN AP_UserCustlst ON AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId INNER JOIN AP_CustDemandHead ON AP_CustDemandVerHead.PlantNr = AP_CustDemandHead.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_CustDemandHead.CustomerId AND AP_CustDemandVerHead.VersionId = AP_CustDemandHead.VersionId INNER JOIN Customer ON AP_CustDemandVerHead.PlantNr = Customer.PlantNr And AP_CustDemandVerHead.CustomerId = Customer.CustomerId "
where += fmt.Sprintf(" AND AP_UserCustlst.UserId = '%s'", impl.userid)
@ -454,23 +455,29 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(paging *grmi.Paging, group
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', '%s', '%%')", artId)
}
if grouptype != "" {
joinstr += " INNER JOIN Customer ON AP_CustDemandVerHead.PlantNr = Customer.PlantNr And AP_CustDemandVerHead.CustomerId = Customer.CustomerId "
where += fmt.Sprintf(" AND Customer.CustomerType = '%s'", grouptype)
}
orderBy := " order by " + " AP_CustDemandVerHead.VersionId "
where = " where " + where
data := make([]model.CustDemandVerHead, 0, 10)
err := impl.session.Table(impl.meta.TableName).SQL("select DISTINCT AP_CustDemandVerHead.* from AP_CustDemandVerHead " + joinstr + where + orderBy + " offset " + utils.ValueToString(paging.Offset(), "") + " row fetch next " + utils.ValueToString(paging.Size, "") + " row only").Find(&data)
data := make([]common.CustOrderData, 0)
err := impl.session.Table(impl.meta.TableName).SQL("select * from AP_CustDemandVerHead " + joinstr + where + orderBy + " offset " + utils.ValueToString(paging.Offset(), "") + " row fetch next " + utils.ValueToString(paging.Size, "") + " row only").Find(&data)
if err != nil {
return grmi.EmptyPagingResult, grmi.NewDataBaseError(err)
}
return grmi.PagingResult{Records: data, Count: paging.Size, PageNumber: paging.Number, PageSize: paging.Size}, nil
datalst := make([]model.CustDemandVerHead, 0)
for _, item := range data {
custHead := item.CustDemandVerHead
custHead.CustomerName = item.Customer.Name1
datalst = append(datalst, custHead)
}
return grmi.PagingResult{Records: datalst, Count: paging.Size, PageNumber: paging.Number, PageSize: paging.Size}, nil
} else {
//查询有效的版本
where := fmt.Sprintf("AP_CustDemandVerHead.PlantNr = %d", impl.plantNr)
joinstr := " INNER JOIN AP_UserCustlst ON AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId "
joinstr := " INNER JOIN AP_UserCustlst ON AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId INNER JOIN Customer ON AP_CustDemandVerHead.PlantNr = Customer.PlantNr And AP_CustDemandVerHead.CustomerId = Customer.CustomerId "
where += fmt.Sprintf(" AND AP_UserCustlst.UserId = '%s'", impl.userid)
if customerId != "" {
where += fmt.Sprintf(" AND AP_CustDemandVerHead.CustomerId = '%s'", customerId)
@ -488,19 +495,23 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(paging *grmi.Paging, group
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', '%s', '%%')", artId)
}
if grouptype != "" {
joinstr += " INNER JOIN Customer ON AP_CustDemandVerHead.PlantNr = Customer.PlantNr And AP_CustDemandVerHead.CustomerId = Customer.CustomerId "
where += fmt.Sprintf(" AND Customer.CustomerType = '%s'", grouptype)
}
orderBy := " order by " + " AP_CustDemandVerHead.VersionId "
where = " where " + where
data := make([]model.CustDemandVerHead, 0, 10)
err := impl.session.Table(impl.meta.TableName).SQL("select DISTINCT AP_CustDemandVerHead.* from AP_CustDemandVerHead " + joinstr + where + orderBy + " offset " + utils.ValueToString(paging.Offset(), "") + " row fetch next " + utils.ValueToString(paging.Size, "") + " row only").Find(&data)
data := make([]common.CustOrderData, 0)
err := impl.session.Table(impl.meta.TableName).SQL("select * from AP_CustDemandVerHead " + joinstr + where + orderBy + " offset " + utils.ValueToString(paging.Offset(), "") + " row fetch next " + utils.ValueToString(paging.Size, "") + " row only").Find(&data)
if err != nil {
return grmi.EmptyPagingResult, grmi.NewDataBaseError(err)
}
return grmi.PagingResult{Records: data, Count: paging.Size, PageNumber: paging.Number, PageSize: paging.Size}, nil
datalst := make([]model.CustDemandVerHead, 0)
for _, item := range data {
custHead := item.CustDemandVerHead
custHead.CustomerName = item.Customer.Name1
datalst = append(datalst, custHead)
}
return grmi.PagingResult{Records: datalst, Count: paging.Size, PageNumber: paging.Number, PageSize: paging.Size}, nil
}
}


+ 1
- 0
models/ap/CustDemandVerHead.model.go View File

@ -45,6 +45,7 @@ type CustDemandVerHead struct {
CreateWeek int `xorm:"int 'CreateWeek'" json:"AP_CustDemandVerHead-CreateWeek"`
CreateModeDescr string `xorm:"-" json:"AP_CustDemandVerHead-CreateModeDescr"`
Valid bool `xorm:"-" json:"AP_CustDemandVerHead-Valid"`
CustomerName string `xorm:"-" json:"AP_CustDemandVerHead-CustomerName"`
PublishId string `xorm:"string 'PublishId'" json:"AP_CustDemandVerHead-PublishId"`
PublishNumber string `xorm:"nvarchar(255) 'PublishNumber'" json:"AP_CustDemandVerHead-PublishNumber"`
PublishStatus int `xorm:"int 'PublishStatus'" json:"AP_CustDemandVerHead-PublishStatus"`


+ 14
- 1
models/common/common.go View File

@ -8,5 +8,18 @@ import (
type CustomerDeviationDetailItemBomLst struct {
PerCustomerDeviationDetailItem []ap.PerCustomerDeviationDetailItem `json:"PerCustomerDeviationDetailItem" xorm:"-"`
CustomerDeviationDetailItem []ap.CustomerDeviationDetailItem `json:"CustomerDeviationDetailItem" xorm:"-"`
Article base.Article `json:"Article" xorm:"-"`
Article base.Article `json:"Article" xorm:"-"`
}
// CustOrderData 客户订单和状态、数量的联查
type CustOrderData struct {
CustDemandVerHead ap.CustDemandVerHead `xorm:"extends"`
Customer base.Customer `xorm:"extends"`
}
// CustOrderData 客户订单和状态、数量的联查
type ArticleStockData struct {
ArticleResource ap.ArticleResource `xorm:"extends"`
Resource ap.Resource `xorm:"extends"`
ArticleStockLevel ap.ArticleStockLevel `xorm:"extends"`
}

Loading…
Cancel
Save