Dockerfile
This commit is contained in:
56
controller/asset/asset_controller.go
Normal file
56
controller/asset/asset_controller.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
dto "assets/model/dto/asset"
|
||||
service "assets/service/asset"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type asset struct{}
|
||||
|
||||
// Asset 资产控制器
|
||||
var Asset = new(asset)
|
||||
|
||||
// init 初始化表单配置
|
||||
func init() {
|
||||
}
|
||||
|
||||
// CreateAsset 创建资产
|
||||
func (c *asset) CreateAsset(ctx context.Context, req *dto.CreateAssetReq) (res *dto.CreateAssetRes, err error) {
|
||||
return service.Asset.Create(ctx, req)
|
||||
}
|
||||
|
||||
// ListAsset 获取资产列表
|
||||
func (c *asset) ListAsset(ctx context.Context, req *dto.ListAssetReq) (res *dto.ListAssetRes, err error) {
|
||||
return service.Asset.List(ctx, req)
|
||||
}
|
||||
|
||||
// GetAsset 获取资产详情
|
||||
func (c *asset) GetAsset(ctx context.Context, req *dto.GetAssetReq) (res *dto.GetAssetRes, err error) {
|
||||
return service.Asset.GetOne(ctx, req)
|
||||
}
|
||||
|
||||
// GetAssetAndSuk 获取资产详情
|
||||
func (c *asset) GetAssetAndSuk(ctx context.Context, req *dto.GetAssetAndSkuReq) (res *dto.GetAssetAndSkuRes, err error) {
|
||||
return service.Asset.GetAssetAndSku(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateAsset 更新资产
|
||||
func (c *asset) UpdateAsset(ctx context.Context, req *dto.UpdateAssetReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.Asset.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateAssetStatus 更新资产状态
|
||||
func (c *asset) UpdateAssetStatus(ctx context.Context, req *dto.UpdateAssetStatusReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.Asset.UpdateStatus(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteAsset 删除资产
|
||||
func (c *asset) DeleteAsset(ctx context.Context, req *dto.DeleteAssetReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.Asset.Delete(ctx, req)
|
||||
return
|
||||
}
|
||||
45
controller/asset/asset_sku_controller.go
Normal file
45
controller/asset/asset_sku_controller.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
dto "assets/model/dto/asset"
|
||||
service "assets/service/asset"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type assetSku struct{}
|
||||
|
||||
// AssetSku 资产SKU控制器
|
||||
var AssetSku = new(assetSku)
|
||||
|
||||
// init 初始化表单配置
|
||||
func init() {
|
||||
}
|
||||
|
||||
// CreateAssetSku 创建SKU
|
||||
func (c *assetSku) CreateAssetSku(ctx context.Context, req *dto.CreateAssetSkuReq) (res *dto.CreateAssetSkuRes, err error) {
|
||||
return service.AssetSku.CreateAssetSku(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateAssetSku 更新SKU
|
||||
func (c *assetSku) UpdateAssetSku(ctx context.Context, req *dto.UpdateAssetSkuReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.AssetSku.UpdateAssetSku(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteAssetSku 删除SKU
|
||||
func (c *assetSku) DeleteAssetSku(ctx context.Context, req *dto.DeleteAssetSkuReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.AssetSku.DeleteAssetSku(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// GetAssetSku 获取SKU详情
|
||||
func (c *assetSku) GetAssetSku(ctx context.Context, req *dto.GetAssetSkuReq) (res *dto.GetAssetSkuRes, err error) {
|
||||
return service.AssetSku.GetAssetSku(ctx, req)
|
||||
}
|
||||
|
||||
// ListAssetSkus 获取SKU列表
|
||||
func (c *assetSku) ListAssetSkus(ctx context.Context, req *dto.ListAssetSkuReq) (res *dto.ListAssetSkuRes, err error) {
|
||||
return service.AssetSku.ListAssetSkus(ctx, req)
|
||||
}
|
||||
56
controller/asset/category_controller.go
Normal file
56
controller/asset/category_controller.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
dto "assets/model/dto/asset"
|
||||
service "assets/service/asset"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type category struct{}
|
||||
|
||||
// Category 分类控制器
|
||||
var Category = new(category)
|
||||
|
||||
// init 初始化表单配置
|
||||
func init() {
|
||||
}
|
||||
|
||||
// GetCategory 获取分类详情
|
||||
func (c *category) GetCategory(ctx context.Context, req *dto.GetCategoryReq) (res *dto.GetCategoryRes, err error) {
|
||||
return service.Category.GetOne(ctx, req)
|
||||
}
|
||||
|
||||
// ListCategory 获取分类列表
|
||||
func (c *category) ListCategory(ctx context.Context, req *dto.ListCategoryReq) (res *dto.ListCategoryRes, err error) {
|
||||
return service.Category.List(ctx, req)
|
||||
}
|
||||
|
||||
// GetCategoryTree 获取分类树
|
||||
func (c *category) GetCategoryTree(ctx context.Context, req *dto.GetCategoryTreeReq) (res *dto.GetCategoryTreeRes, err error) {
|
||||
return service.Category.GetTree(ctx, req)
|
||||
}
|
||||
|
||||
// CreateCategory 创建分类
|
||||
func (c *category) CreateCategory(ctx context.Context, req *dto.CreateCategoryReq) (res *dto.CreateCategoryRes, err error) {
|
||||
return service.Category.Create(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateCategory 更新分类
|
||||
func (c *category) UpdateCategory(ctx context.Context, req *dto.UpdateCategoryReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.Category.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateCategoryStatus 更新分类状态
|
||||
func (c *category) UpdateCategoryStatus(ctx context.Context, req *dto.UpdateCategoryStatusReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.Category.UpdateStatus(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteCategory 删除分类
|
||||
func (c *category) DeleteCategory(ctx context.Context, req *dto.DeleteCategoryReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.Category.Delete(ctx, req)
|
||||
return
|
||||
}
|
||||
116
controller/asset/private_category_controller.go
Normal file
116
controller/asset/private_category_controller.go
Normal file
@@ -0,0 +1,116 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
dto "assets/model/dto/asset"
|
||||
service "assets/service/asset"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type privateCategory struct{}
|
||||
|
||||
// PrivateCategory 私域分类控制器
|
||||
var PrivateCategory = new(privateCategory)
|
||||
|
||||
// CreatePrivateCategory 创建私域分类
|
||||
// @Summary 创建私域分类
|
||||
// @Tags 私域分类管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body asset.CreatePrivateCategoryReq true "创建私域分类请求"
|
||||
// @Success 200 {object} asset.CreatePrivateCategoryRes
|
||||
// @Router /privateCategory/createPrivateCategory [post]
|
||||
func (c *privateCategory) CreatePrivateCategory(ctx context.Context, req *dto.CreatePrivateCategoryReq) (res *dto.CreatePrivateCategoryRes, err error) {
|
||||
return service.PrivateCategory.CreatePrivateCategory(ctx, req)
|
||||
}
|
||||
|
||||
// BatchCreatePrivateCategory 批量创建私域分类
|
||||
// @Summary 批量创建私域分类
|
||||
// @Tags 私域分类管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body asset.BatchCreatePrivateCategoryReq true "批量创建私域分类请求"
|
||||
// @Success 200 {object} asset.BatchCreatePrivateCategoryRes
|
||||
// @Router /privateCategory/batchCreatePrivateCategory [post]
|
||||
func (c *privateCategory) BatchCreatePrivateCategory(ctx context.Context, req *dto.BatchCreatePrivateCategoryReq) (res *dto.BatchCreatePrivateCategoryRes, err error) {
|
||||
return service.PrivateCategory.BatchCreatePrivateCategory(ctx, req)
|
||||
}
|
||||
|
||||
// UpdatePrivateCategory 更新私域分类
|
||||
// @Summary 更新私域分类
|
||||
// @Tags 私域分类管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body asset.UpdatePrivateCategoryReq true "更新私域分类请求"
|
||||
// @Success 200 {object} beans.ResponseEmpty
|
||||
// @Router /privateCategory/updatePrivateCategory [put]
|
||||
func (c *privateCategory) UpdatePrivateCategory(ctx context.Context, req *dto.UpdatePrivateCategoryReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.PrivateCategory.UpdatePrivateCategory(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePrivateCategory 删除私域分类
|
||||
// @Summary 删除私域分类
|
||||
// @Tags 私域分类管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id query string true "私域分类ID"
|
||||
// @Success 200 {object} beans.ResponseEmpty
|
||||
// @Router /privateCategory/deletePrivateCategory [delete]
|
||||
func (c *privateCategory) DeletePrivateCategory(ctx context.Context, req *dto.DeletePrivateCategoryReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.PrivateCategory.DeletePrivateCategory(ctx, req.ID)
|
||||
return
|
||||
}
|
||||
|
||||
// GetPrivateCategory 获取私域分类详情
|
||||
// @Summary 获取私域分类详情
|
||||
// @Tags 私域分类管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id query string true "私域分类ID"
|
||||
// @Success 200 {object} asset.GetPrivateCategoryRes
|
||||
// @Router /privateCategory/getPrivateCategory [get]
|
||||
func (c *privateCategory) GetPrivateCategory(ctx context.Context, req *dto.GetPrivateCategoryReq) (res *dto.GetPrivateCategoryRes, err error) {
|
||||
return service.PrivateCategory.GetPrivateCategory(ctx, req.ID)
|
||||
}
|
||||
|
||||
// ListPrivateCategory 获取私域分类列表
|
||||
// @Summary 获取私域分类列表
|
||||
// @Tags 私域分类管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param name query string false "分类名称"
|
||||
// @Param parentId query string false "父分类ID"
|
||||
// @Param level query int false "分类层级"
|
||||
// @Param isLeafNode query bool false "是否叶子节点"
|
||||
// @Param pageNum query int false "页码" default(1)
|
||||
// @Param pageSize query int false "每页大小" default(10)
|
||||
// @Success 200 {object} asset.ListPrivateCategoryRes
|
||||
// @Router /privateCategory/listPrivateCategory [get]
|
||||
func (c *privateCategory) ListPrivateCategory(ctx context.Context, req *dto.ListPrivateCategoryReq) (res *dto.ListPrivateCategoryRes, err error) {
|
||||
return service.PrivateCategory.ListPrivateCategory(ctx, req)
|
||||
}
|
||||
|
||||
// GetPrivateCategoryTree 获取私域分类树
|
||||
// @Summary 获取私域分类树
|
||||
// @Tags 私域分类管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} asset.GetPrivateCategoryTreeRes
|
||||
// @Router /privateCategory/getPrivateCategoryTree [get]
|
||||
func (c *privateCategory) GetPrivateCategoryTree(ctx context.Context, req *dto.GetPrivateCategoryTreeReq) (res *dto.GetPrivateCategoryTreeRes, err error) {
|
||||
return service.PrivateCategory.GetPrivateCategoryTree(ctx)
|
||||
}
|
||||
|
||||
// GenerateTestData 生成测试数据
|
||||
// @Summary 生成测试数据
|
||||
// @Tags 私域分类管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} beans.ResponseEmpty
|
||||
// @Router /privateCategory/generateTestData [post]
|
||||
func (c *privateCategory) GenerateTestData(ctx context.Context, req *dto.GeneratePrivateCategoryTestDataReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.PrivateCategory.GenerateTestData(ctx)
|
||||
return
|
||||
}
|
||||
118
controller/asset/private_sku_controller.go
Normal file
118
controller/asset/private_sku_controller.go
Normal file
@@ -0,0 +1,118 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
dto "assets/model/dto/asset"
|
||||
service "assets/service/asset"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type privateSku struct{}
|
||||
|
||||
// PrivateSku 私域SKU控制器
|
||||
var PrivateSku = new(privateSku)
|
||||
|
||||
// CreatePrivateSku 创建私域SKU
|
||||
// @Summary 创建私域SKU
|
||||
// @Tags 私域SKU管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body asset.CreatePrivateSkuReq true "创建私域SKU请求"
|
||||
// @Success 200 {object} asset.CreatePrivateSkuRes
|
||||
// @Router /privateSku/createPrivateSku [post]
|
||||
func (c *privateSku) CreatePrivateSku(ctx context.Context, req *dto.CreatePrivateSkuReq) (res *dto.CreatePrivateSkuRes, err error) {
|
||||
return service.PrivateSku.CreatePrivateSku(ctx, req)
|
||||
}
|
||||
|
||||
// BatchCreatePrivateSku 批量创建私域SKU
|
||||
// @Summary 批量创建私域SKU
|
||||
// @Tags 私域SKU管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body asset.BatchCreatePrivateSkuReq true "批量创建私域SKU请求"
|
||||
// @Success 200 {object} asset.BatchCreatePrivateSkuRes
|
||||
// @Router /privateSku/batchCreatePrivateSku [post]
|
||||
func (c *privateSku) BatchCreatePrivateSku(ctx context.Context, req *dto.BatchCreatePrivateSkuReq) (res *dto.BatchCreatePrivateSkuRes, err error) {
|
||||
return service.PrivateSku.BatchCreatePrivateSku(ctx, req)
|
||||
}
|
||||
|
||||
// UpdatePrivateSku 更新私域SKU
|
||||
// @Summary 更新私域SKU
|
||||
// @Tags 私域SKU管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body asset.UpdatePrivateSkuReq true "更新私域SKU请求"
|
||||
// @Success 200 {object} beans.ResponseEmpty
|
||||
// @Router /privateSku/updatePrivateSku [put]
|
||||
func (c *privateSku) UpdatePrivateSku(ctx context.Context, req *dto.UpdatePrivateSkuReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.PrivateSku.UpdatePrivateSku(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePrivateSku 删除私域SKU
|
||||
// @Summary 删除私域SKU
|
||||
// @Tags 私域SKU管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id query string true "私域SKU ID"
|
||||
// @Success 200 {object} beans.ResponseEmpty
|
||||
// @Router /privateSku/deletePrivateSku [delete]
|
||||
func (c *privateSku) DeletePrivateSku(ctx context.Context, req *dto.DeletePrivateSkuReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.PrivateSku.DeletePrivateSku(ctx, req.ID)
|
||||
return
|
||||
}
|
||||
|
||||
// GetPrivateSku 获取私域SKU详情
|
||||
// @Summary 获取私域SKU详情
|
||||
// @Tags 私域SKU管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id query string true "私域SKU ID"
|
||||
// @Success 200 {object} asset.GetPrivateSkuRes
|
||||
// @Router /privateSku/getPrivateSku [get]
|
||||
func (c *privateSku) GetPrivateSku(ctx context.Context, req *dto.GetPrivateSkuReq) (res *dto.GetPrivateSkuRes, err error) {
|
||||
return service.PrivateSku.GetPrivateSku(ctx, req.ID)
|
||||
}
|
||||
|
||||
// ListPrivateSku 获取私域SKU列表
|
||||
// @Summary 获取私域SKU列表
|
||||
// @Tags 私域SKU管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param skuName query string false "SKU名称"
|
||||
// @Param privateCategoryPath query string false "分类路径"
|
||||
// @Param minPrice query int false "最低价格"
|
||||
// @Param maxPrice query int false "最高价格"
|
||||
// @Param pageNum query int false "页码" default(1)
|
||||
// @Param pageSize query int false "每页大小" default(10)
|
||||
// @Success 200 {object} asset.ListPrivateSkuRes
|
||||
// @Router /privateSku/listPrivateSku [get]
|
||||
func (c *privateSku) ListPrivateSku(ctx context.Context, req *dto.ListPrivateSkuReq) (res *dto.ListPrivateSkuRes, err error) {
|
||||
return service.PrivateSku.ListPrivateSku(ctx, req)
|
||||
}
|
||||
|
||||
// UpdatePrivateSkuStock 更新私域SKU库存
|
||||
// @Summary 更新私域SKU库存
|
||||
// @Tags 私域SKU管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body asset.UpdatePrivateSkuStockReq true "更新库存请求"
|
||||
// @Success 200 {object} beans.ResponseEmpty
|
||||
// @Router /privateSku/updatePrivateSkuStock [put]
|
||||
func (c *privateSku) UpdatePrivateSkuStock(ctx context.Context, req *dto.UpdatePrivateSkuStockReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.PrivateSku.UpdatePrivateSkuStock(ctx, req.ID, req.StockChange)
|
||||
return
|
||||
}
|
||||
|
||||
// GenerateTestData 生成测试数据
|
||||
// @Summary 生成测试数据
|
||||
// @Tags 私域SKU管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} beans.ResponseEmpty
|
||||
// @Router /privateSku/generateTestData [post]
|
||||
func (c *privateSku) GenerateTestData(ctx context.Context, req *dto.GeneratePrivateSkuTestDataReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.PrivateSku.GenerateTestData(ctx)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user