This commit is contained in:
toom1996
2026-09-13 00:52:35 +08:00
parent 10d8a96e8c
commit dbee704c95
44 changed files with 755 additions and 1148 deletions

View File

@ -16,7 +16,7 @@ import (
type ArticleRepository interface {
// List 按筛选条件分页查询文章,同时返回符合条件的总数。
List(ctx context.Context, q dto.ArticleQuery) ([]model.RunwayRow, int64, error)
// ListAdmin 后台管理列表:投影列含 season/year/collection_type/season_code/source_url 等管理字段。
// ListAdmin 后台管理列表:投影列含 season/year/collection_type/season_code 等管理字段。
ListAdmin(ctx context.Context, q dto.ArticleQuery) ([]model.RunwayRow, int64, error)
// FindByID 查询单篇文章(含 JOIN 出的品牌名)。不存在时返回 ErrNotFound。
FindByID(ctx context.Context, id string) (*model.RunwayRow, error)
@ -62,12 +62,11 @@ const articleDetailColumns = `brand_runway.id, brand_runway.title_en, brand_runw
brand_runway.cover, b.name_en AS brand_name_en, b.name_cn AS brand_name_cn`
// articleAdminColumns 后台管理列表投影列:在列表列基础上补回 season / year /
// collection_type / season_code / source_url 等管理字段(前端列表不展示这些)。
// collection_type / season_code 等管理字段(前端列表不展示这些)。
const articleAdminColumns = `brand_runway.id, brand_runway.brand_id,
brand_runway.title_en, brand_runway.title_cn,
brand_runway.cover, brand_runway.image_count, brand_runway.year,
brand_runway.collection_type, brand_runway.season, brand_runway.season_code,
brand_runway.source_url,
b.name_en AS brand_name_en, b.name_cn AS brand_name_cn`
// brandJoin 关联品牌表取品牌名;LEFT JOIN 保证品牌被软删时文章依然可见。
@ -232,7 +231,7 @@ func (r *articleRepository) ImagesByRunwayIDs(ctx context.Context, ids []uint32)
var imgs []model.BrandRunwayImage
err := r.db.WithContext(ctx).
Select("runway_id, image, name, sort_order").
Where("runway_id IN ? AND is_deleted = 0", ids).
Where("runway_id IN ? AND is_deleted = 0 AND is_detail = 0", ids).
Order("sort_order ASC, id ASC").
Find(&imgs).Error
if err != nil {