Browse Source

Merge pull request '项目描述,模糊搜索,客户和用户关联赛选' (#136) from fix_daolu into develop

Reviewed-on: http://101.201.121.115:3000/leo/LAPP_CHEERSSON_BACKEND/pulls/136
pull/137/head
zhangxin 3 years ago
parent
commit
fe3dc270bc
7 changed files with 28 additions and 15 deletions
  1. +1
    -1
      dao/ap/CustDemandVerHead.dao.go
  2. +14
    -3
      dao/ap/implments/CustDemandVerHead.dao.impl.go
  3. +4
    -4
      dao/base/implments/Customer.dao.impl.go
  4. +1
    -1
      services/ap/CustDemandVerHead.service.go
  5. +2
    -2
      services/ap/implments/CustDemandVerHead.service.impl.go
  6. +3
    -2
      services/base/implments/Customer.service.impl.go
  7. +3
    -2
      web/controllers/ap/CustDemandVerHead.rest.go

+ 1
- 1
dao/ap/CustDemandVerHead.dao.go View File

@ -186,7 +186,7 @@ type CustDemandVerHeadDAO interface {
* @Date : 2021-08-20 11:11:05
*
******************************************************************************/
SelectData(customerId string,artId string,Valid bool) ([]model.CustDemandVerHead, error)
SelectData(customerId string, versionId string, artId string, Valid bool) ([]model.CustDemandVerHead, error)
/******************************************************************************
*
* @Function Name : SelectUnique


+ 14
- 3
dao/ap/implments/CustDemandVerHead.dao.impl.go View File

@ -357,13 +357,19 @@ func (impl *CustDemandVerHeadDAOImplement) IssueGlobalVersion(entity *model.Cust
* @Reference leit.com/LAPP_CHEERSSON_BACKEND/dao/ap/CustDemandHeadDAO.SelectData
*
******************************************************************************/
func (impl *CustDemandVerHeadDAOImplement) SelectData(customerId string, artId string, Valid bool) ([]model.CustDemandVerHead, error) {
func (impl *CustDemandVerHeadDAOImplement) SelectData(customerId string, versionId string, artId string, Valid bool) ([]model.CustDemandVerHead, error) {
if Valid {
session := impl.session.Table("AP_CustDemandVerHead").Select("AP_CustDemandVerHead.*").Distinct("AP_CustDemandVerHead.VersionId").Join("INNER", "AP_CustDemandHead", "AP_CustDemandHead.PlantNr = AP_CustDemandVerHead.PlantNr And AP_CustDemandHead.CustomerId = AP_CustDemandVerHead.CustomerId And AP_CustDemandHead.VersionId = AP_CustDemandVerHead.VersionId").Where("AP_CustDemandVerHead.PlantNr = ?", impl.plantNr)
session := impl.session.Table("AP_CustDemandVerHead").Select("AP_CustDemandVerHead.*").Distinct("AP_CustDemandVerHead.VersionId")
session = session.Join("INNER", "AP_CustDemandHead", "AP_CustDemandHead.PlantNr = AP_CustDemandVerHead.PlantNr And AP_CustDemandHead.CustomerId = AP_CustDemandVerHead.CustomerId And AP_CustDemandHead.VersionId = AP_CustDemandVerHead.VersionId")
session = session.Join("INNER", "AP_UserCustlst", "AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr And AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId").Where("AP_CustDemandVerHead.PlantNr = ? and AP_UserCustlst.UserId = ?", impl.plantNr, impl.userid)
if customerId != "" {
session = session.And("AP_CustDemandVerHead.CustomerId = ?", customerId)
}
if versionId != "" {
session = session.And("AP_CustDemandVerHead.VersionId = ?", versionId)
}
if artId != "" {
session = session.Join("INNER", meta.CustDemandVerDetail.TableName, "AP_CustDemandVerHead.PlantNr = AP_CustDemandVerDetail.PlantNr And AP_CustDemandVerHead.CustomerId = AP_CustDemandVerDetail.CustomerId And AP_CustDemandVerHead.VersionId = AP_CustDemandVerDetail.VersionId")
session = session.And("AP_CustDemandVerDetail.ArtId like concat('%%', ?, '%%')", artId)
@ -377,10 +383,15 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(customerId string, artId s
}
return data, nil
} else {
session := impl.session.Table(impl.meta.TableName).Select("AP_CustDemandVerHead.*").Distinct("AP_CustDemandVerHead.VersionId").Where("AP_CustDemandVerHead.PlantNr = ?", impl.plantNr)
session := impl.session.Table(impl.meta.TableName).Select("AP_CustDemandVerHead.*").Distinct("AP_CustDemandVerHead.VersionId")
session = session.Join("INNER", "AP_UserCustlst", "AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr And AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId").Where("AP_CustDemandVerHead.PlantNr = ? and AP_UserCustlst.UserId = ?", impl.plantNr, impl.userid)
if customerId != "" {
session = session.And("AP_CustDemandVerHead.CustomerId = ?", customerId)
}
if versionId != "" {
session = session.And("AP_CustDemandVerHead.VersionId = ?", versionId)
}
if artId != "" {
session = session.Join("INNER", meta.CustDemandVerDetail.TableName, "AP_CustDemandVerHead.PlantNr = AP_CustDemandVerDetail.PlantNr And AP_CustDemandVerHead.CustomerId = AP_CustDemandVerDetail.CustomerId And AP_CustDemandVerHead.VersionId = AP_CustDemandVerDetail.VersionId")
session = session.And("AP_CustDemandVerDetail.ArtId like concat('%%', ?, '%%')", artId)


+ 4
- 4
dao/base/implments/Customer.dao.impl.go View File

@ -312,13 +312,13 @@ func (impl *CustomerDAOImplement) UpdateWhere(predicates []grmi.Predicate, entit
******************************************************************************/
func (impl *CustomerDAOImplement) SelectTree(CustomerIds []string) ([]model.Customer, error) {
session := impl.session.Table(impl.meta.TableName)
session := impl.session.Table(impl.meta.TableName).Join("INNER","AP_UserCustlst","Customer.PlantNr = AP_UserCustlst.PlantNr And Customer.CustomerId = AP_UserCustlst.CustomerId")
session.Where("PlantNr = ?", impl.plantNr)
session.Where("Customer.PlantNr = ?", impl.plantNr).And("AP_UserCustlst.UserId = ?",impl.userid)
if len(CustomerIds) > 0 {
session = session.In("CustomerId", CustomerIds)
session = session.In("Customer.CustomerId", CustomerIds)
}
session = session.OrderBy(meta.Customer_PlantNr.ColumnName)
session = session.OrderBy("Customer.CustomerId")
data := make([]model.Customer, 0, 10)
err := session.Find(&data)
if err != nil {


+ 1
- 1
services/ap/CustDemandVerHead.service.go View File

@ -492,7 +492,7 @@ type CustDemandVerHeadService interface {
* @Date : 2021-08-20 11:11:05
*
******************************************************************************/
SelectData(*global.User, string, string,bool) ([]model.CustDemandVerHead, error)
SelectData(*global.User, string, string,string,bool) ([]model.CustDemandVerHead, error)
/******************************************************************************
*
* @Function Name : SelectData


+ 2
- 2
services/ap/implments/CustDemandVerHead.service.impl.go View File

@ -733,7 +733,7 @@ func (impl *CustDemandVerHeadServiceImplement) Select(user *global.User, urlPara
* @Reference leit.com/LAPP_CHEERSSON_BACKEND/services/ap/CustDemandVerHeadService.SelectData
*
******************************************************************************/
func (impl *CustDemandVerHeadServiceImplement) SelectData(user *global.User, customerId string, artId string, Valid bool) ([]model.CustDemandVerHead, error) {
func (impl *CustDemandVerHeadServiceImplement) SelectData(user *global.User, customerId string, versionId string, artId string, Valid bool) ([]model.CustDemandVerHead, error) {
grmi.Log(user, "/services/ap/implments/CustDemandVerHead.service.impl.go", "SelectCustDemandVerHead", "查询CustDemandVerHead")
@ -743,7 +743,7 @@ func (impl *CustDemandVerHeadServiceImplement) SelectData(user *global.User, cus
engine.ShowSQL(true)
dao := dal.NewCustDemandVerHeadDAO(session, user.PlantNr, user.UserId)
globalDao := dal.NewCustDemandHeadDAO(session, user.PlantNr, user.UserId)
result, err := dao.SelectData(customerId, artId, Valid)
result, err := dao.SelectData(customerId, versionId, artId, Valid)
if err != nil {
return nil, err
}


+ 3
- 2
services/base/implments/Customer.service.impl.go View File

@ -508,7 +508,8 @@ func (impl *CustomerServiceImplement) SaveArtAllot(user *global.User, entity *mo
if article == nil {
return grmi.NewBusinessError("不存在对应的物料,请检查")
}
val.Descr1 = article.Descr1
val.Descr2 = article.ProjectId
val.CustomerId = entity.CustomerId
val.Pos = index + 1
CustData[index] = val
@ -604,7 +605,7 @@ func (impl *CustomerServiceImplement) CustomerTree(user *global.User, CustomerId
engine := db.Eloquent.Master()
session := engine.NewSession()
defer session.Close()
engine.ShowSQL(true)
dao := dal.NewCustomerDAO(session, user.PlantNr, user.UserId)
plantDao := dal.NewPlantDAO(session, user.UserId)
artDao := apDal.NewCustArtlstDAO(session, user.PlantNr, user.UserId)


+ 3
- 2
web/controllers/ap/CustDemandVerHead.rest.go View File

@ -1342,7 +1342,7 @@ func RegisterRemoveIssueOneCustDemandVerHead(party router.Party, httpMethod stri
* @Date : 2021-08-20 11:11:05
*
******************************************************************************/
func RegisterSearchCustDemandVerHead(party router.Party, path string, method func(*global.User, string, string, bool) ([]model.CustDemandVerHead, error)) {
func RegisterSearchCustDemandVerHead(party router.Party, path string, method func(*global.User, string, string, string, bool) ([]model.CustDemandVerHead, error)) {
party.Get(path, func(ctx iris.Context) {
user, ok := jwts.ParseToken(ctx)
@ -1352,8 +1352,9 @@ func RegisterSearchCustDemandVerHead(party router.Party, path string, method fun
}
customerId := ctx.URLParam("customerId")
artId := ctx.URLParam("artId")
versionId := ctx.URLParam("versionId")
valid, _ := ctx.URLParamBool("valid")
result, err := method(user, customerId, artId, valid)
result, err := method(user, customerId, versionId, artId, valid)
if err != nil {
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
return


Loading…
Cancel
Save