fix
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -64,22 +64,22 @@ func (p *FsProductModel) GetProductListByTypeIds(ctx context.Context, productTyp
|
||||
func (p *FsProductModel) GetRandomProductList(ctx context.Context, limit int) (resp []FsProduct, err error) {
|
||||
err = p.db.WithContext(ctx).Model(&FsProduct{}).
|
||||
Where("`is_del` =? and `is_shelf` = ?", 0, 1).Order("RAND()").Limit(limit).Find(&resp).Error
|
||||
return resp,err
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (p *FsProductModel) FindAllOnlyByIds(ctx context.Context, ids []int64) (resp []*FsProduct, err error) {
|
||||
err = p.db.WithContext(ctx).Model(&FsProduct{}).Where("`id` IN (?)", ids).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (p *FsProductModel) GetRandomProductListInIds(ctx context.Context,ids []int64, limit int,fields ...string) (resp []FsProduct, err error) {
|
||||
if len(ids) == 0{
|
||||
func (p *FsProductModel) GetRandomProductListInIds(ctx context.Context, ids []int64, limit int, fields ...string) (resp []FsProduct, err error) {
|
||||
if len(ids) == 0 {
|
||||
return
|
||||
}
|
||||
db := p.db.WithContext(ctx).Model(&FsProduct{}).
|
||||
Where("`id` in (?) and `is_del` =? and `is_shelf` = ?", ids,0, 1).Order("RAND()").Limit(limit)
|
||||
if len(fields) != 0{
|
||||
Where("`id` in (?) and `is_del` =? and `is_shelf` = ?", ids, 0, 1).Order("RAND()").Limit(limit)
|
||||
if len(fields) != 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Find(&resp).Error
|
||||
return resp,err
|
||||
}
|
||||
return resp, err
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -27,15 +27,16 @@ func (s *FsProductSizeModel) GetAllByIds(ctx context.Context, ids []int64, sort
|
||||
|
||||
type CountProductSizeByStatusRsp struct {
|
||||
ProductId int64 `json:"product_id"`
|
||||
Num int64 `json:"num"`
|
||||
Num int64 `json:"num"`
|
||||
}
|
||||
func (s *FsProductSizeModel) GetGroupProductSizeByStatus(ctx context.Context,productIds []int64, status int) (resp []CountProductSizeByStatusRsp, err error) {
|
||||
|
||||
func (s *FsProductSizeModel) GetGroupProductSizeByStatus(ctx context.Context, productIds []int64, status int) (resp []CountProductSizeByStatusRsp, err error) {
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).
|
||||
Select("product_id,count(*) as num").
|
||||
Where("`product_id` in (?) and `status` = ?",productIds ,status).
|
||||
Where("`product_id` in (?) and `status` = ?", productIds, status).
|
||||
Group("product_id").
|
||||
Find(&resp).Error
|
||||
return resp,err
|
||||
return resp, err
|
||||
}
|
||||
func (s *FsProductSizeModel) GetAllByProductIds(ctx context.Context, productIds []int64, sort string) (resp []FsProductSize, err error) {
|
||||
if len(productIds) == 0 {
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -75,28 +75,29 @@ func (t *FsProductTemplateV2Model) FindOneByModelId(ctx context.Context, modelId
|
||||
|
||||
type GetProductTemplateListByParamsReq struct {
|
||||
ProductIds []int64 //必传哦
|
||||
GroupBy string
|
||||
OrderBy string
|
||||
Fields string
|
||||
Status *int64
|
||||
GroupBy string
|
||||
OrderBy string
|
||||
Fields string
|
||||
Status *int64
|
||||
}
|
||||
|
||||
func (t *FsProductTemplateV2Model) GetProductTemplateListByParams(ctx context.Context, req GetProductTemplateListByParamsReq) (resp []FsProductTemplateV2, err error) {
|
||||
if len(req.ProductIds) == 0{
|
||||
if len(req.ProductIds) == 0 {
|
||||
return
|
||||
}
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`product_id` in (?)",req.ProductIds)
|
||||
if req.GroupBy != ""{
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`product_id` in (?)", req.ProductIds)
|
||||
if req.GroupBy != "" {
|
||||
db = db.Group(req.GroupBy)
|
||||
}
|
||||
if req.OrderBy != ""{
|
||||
if req.OrderBy != "" {
|
||||
db = db.Order(req.OrderBy)
|
||||
}
|
||||
if req.Fields != ""{
|
||||
if req.Fields != "" {
|
||||
db = db.Select(req.Fields)
|
||||
}
|
||||
if req.Status != nil{
|
||||
db = db.Where("`status` = ?",req.Status)
|
||||
if req.Status != nil {
|
||||
db = db.Where("`status` = ?", req.Status)
|
||||
}
|
||||
err = db.Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
Reference in New Issue
Block a user