From 50b5c9fccb6a5c952d16047c110f679b201dd5f4 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Sat, 20 Jun 2026 12:19:46 +0800 Subject: [PATCH] chore: release server-v1.0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(backend): 入库/出库列表 status 支持多状态 IN 查询 Co-Authored-By: Claude Opus 4.8 --- CHANGELOG-server.md | 5 +++++ backend/internal/handler/stock_in.go | 3 ++- backend/internal/handler/stock_in_test.go | 5 +++++ backend/internal/handler/stock_out.go | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-server.md b/CHANGELOG-server.md index ab74918..695a599 100644 --- a/CHANGELOG-server.md +++ b/CHANGELOG-server.md @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.65] - 2026-06-20 + +### 修复 +- 单据列表状态筛选支持一次查询多种状态,配合客户端修复让「入库审核 / 出库审核」标签页完整列出全部待审核单据,不再因分页只显示部分 + ## [1.0.64] - 2026-06-20 ### 改进 diff --git a/backend/internal/handler/stock_in.go b/backend/internal/handler/stock_in.go index 94bc670..471bdd4 100644 --- a/backend/internal/handler/stock_in.go +++ b/backend/internal/handler/stock_in.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" "strconv" + "strings" "time" "github.com/gin-gonic/gin" @@ -40,7 +41,7 @@ func (h *StockInHandler) List(c *gin.Context) { Where("shop_id = ? AND deleted_at IS NULL", shopID) if status := c.Query("status"); status != "" { - query = query.Where("status = ?", status) + query = query.Where("status IN ?", strings.Split(status, ",")) } if startDate := c.Query("start_date"); startDate != "" { query = query.Where("order_date >= ?", startDate) diff --git a/backend/internal/handler/stock_in_test.go b/backend/internal/handler/stock_in_test.go index 827f7c4..77be869 100644 --- a/backend/internal/handler/stock_in_test.go +++ b/backend/internal/handler/stock_in_test.go @@ -343,4 +343,9 @@ func TestStockInHandler_List_FilterByStatus(t *testing.T) { w = makeRequest(r, "GET", "/api/v1/stock-in/orders?status=draft", token, nil) resp = parseResponse(w) assert.Equal(t, float64(1), resp["total"].(float64)) + + // 逗号分隔的多状态:pending + draft 应返回两条(审核标签页用法) + w = makeRequest(r, "GET", "/api/v1/stock-in/orders?status=pending,draft", token, nil) + resp = parseResponse(w) + assert.Equal(t, float64(2), resp["total"].(float64)) } diff --git a/backend/internal/handler/stock_out.go b/backend/internal/handler/stock_out.go index a6470a8..b3a8bde 100644 --- a/backend/internal/handler/stock_out.go +++ b/backend/internal/handler/stock_out.go @@ -3,6 +3,7 @@ package handler import ( "net/http" "strconv" + "strings" "github.com/gin-gonic/gin" "gorm.io/gorm" @@ -33,7 +34,7 @@ func (h *StockOutHandler) List(c *gin.Context) { Where("shop_id = ? AND deleted_at IS NULL", shopID) if status := c.Query("status"); status != "" { - query = query.Where("status = ?", status) + query = query.Where("status IN ?", strings.Split(status, ",")) } if startDate := c.Query("start_date"); startDate != "" { query = query.Where("order_date >= ?", startDate)