This commit is contained in:
邹宗楠
2024-12-27 09:26:23 +08:00
parent bc2b1349da
commit b758d04a9d
2 changed files with 6 additions and 14 deletions

View File

@@ -380,16 +380,13 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b
} else if stock == 2 {
sql += " AND c.stock <> 0"
}
if locationCode2 != "" {
sql += " AND c.location_code = ?"
sqlParams = append(sqlParams, locationCode2)
} else if locationCode {
if locationCode {
sql += " AND (c.location_code = '' OR c.location_code = 'EMPTY_VALUE') "
}
if keyword != "" {
sql += " AND a.name LIKE ?"
sqlParams = append(sqlParams, "%"+keyword+"%")
sql += " AND a.name LIKE ? OR c.location_code LIKE ?"
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%")
}
sql += `
@@ -615,8 +612,8 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin
}
if keyword != "" {
keywordLike := "%" + keyword + "%"
sql += " AND (t1.name LIKE ? OR t1.prefix LIKE ? OR t1.upc LIKE ? OR t2.comment LIKE ?"
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike)
sql += " AND (t1.name LIKE ? OR t1.prefix LIKE ? OR t1.upc LIKE ? OR t2.comment LIKE ? OR t4.location_code LIKE ? "
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil {
sql += `
@@ -762,10 +759,7 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin
sql += " AND t4.stock <= ? "
sqlParams = append(sqlParams, params["maxStock"])
}
if params["locationCode"] != "" && params["locationCode"] != nil {
sql += " AND t4.location_code LIKE ? "
sqlParams = append(sqlParams, "%"+params["locationCode"].(string)+"%")
} else if params["isLocationCode"] != "" && params["isLocationCode"] != nil {
if params["isLocationCode"] != "" && params["isLocationCode"] != nil {
sql += " AND (t4.location_code = '' OR t4.location_code = 'EMPTY_VALUE') "
}
return sql, sqlParams, err