This commit is contained in:
苏尹岚
2021-01-06 09:46:54 +08:00
parent 756b39711d
commit 5753470c8b
4 changed files with 10 additions and 4 deletions

View File

@@ -3775,8 +3775,8 @@ func GetDiffJxStoreAndMTWMStoreInfo(ctx *jxcontext.Context, storeIDs []int) (err
return err return err
} }
func GetBrands(ctx *jxcontext.Context, name string) (brands []*model.Brand, err error) { func GetBrands(ctx *jxcontext.Context, name string, brandID int) (brands []*model.Brand, err error) {
return dao.GetBrands(dao.GetDB(), name) return dao.GetBrands(dao.GetDB(), name, brandID)
} }
func AddBrand(ctx *jxcontext.Context, brand *model.Brand) (err error) { func AddBrand(ctx *jxcontext.Context, brand *model.Brand) (err error) {

View File

@@ -926,7 +926,7 @@ func GetStoreAuditPage(db *DaoDB, statuss []int, keyword string, applyTimeStart,
return pagedInfo, err return pagedInfo, err
} }
func GetBrands(db *DaoDB, name string) (brands []*model.Brand, err error) { func GetBrands(db *DaoDB, name string, brandID int) (brands []*model.Brand, err error) {
sql := ` sql := `
SELECT * SELECT *
FROM brand FROM brand
@@ -939,6 +939,10 @@ func GetBrands(db *DaoDB, name string) (brands []*model.Brand, err error) {
sql += " AND name LIKE ?" sql += " AND name LIKE ?"
sqlParams = append(sqlParams, "%"+name+"%") sqlParams = append(sqlParams, "%"+name+"%")
} }
if brandID != 0 {
sql += " AND id = ?"
sqlParams = append(sqlParams, brandID)
}
err = GetRows(db, &brands, sql, sqlParams) err = GetRows(db, &brands, sql, sqlParams)
return brands, err return brands, err
} }

View File

@@ -57,6 +57,7 @@ type User struct {
LastLoginAt *time.Time `orm:"null" json:"lastLoginAt"` LastLoginAt *time.Time `orm:"null" json:"lastLoginAt"`
LastLoginIP string `orm:"size(64);column(last_login_ip)" json:"lastLoginIP"` LastLoginIP string `orm:"size(64);column(last_login_ip)" json:"lastLoginIP"`
LastLoginType string `orm:"size(16)" json:"lastLoginType"` LastLoginType string `orm:"size(16)" json:"lastLoginType"`
LastBrandID int `orm:"column(last_brand_id)" json:"lastBrandID"`
ParentMobile string `orm:"size(32)" json:"parentMobile"` ParentMobile string `orm:"size(32)" json:"parentMobile"`
DividePercentage int `json:"dividePercentage"` DividePercentage int `json:"dividePercentage"`

View File

@@ -943,13 +943,14 @@ func (c *StoreController) GetJddjStoreInfo() {
// @Title 查询品牌 // @Title 查询品牌
// @Description 查询品牌 // @Description 查询品牌
// @Param token header string true "认证token" // @Param token header string true "认证token"
// @Param brandID query int false "品牌ID"
// @Param name query string false "品牌名" // @Param name query string false "品牌名"
// @Success 200 {object} controllers.CallResult // @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult
// @router /GetBrands [get] // @router /GetBrands [get]
func (c *StoreController) GetBrands() { func (c *StoreController) GetBrands() {
c.callGetBrands(func(params *tStoreGetBrandsParams) (retVal interface{}, errCode string, err error) { c.callGetBrands(func(params *tStoreGetBrandsParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetBrands(params.Ctx, params.Name) retVal, err = cms.GetBrands(params.Ctx, params.Name, params.BrandID)
return retVal, "", err return retVal, "", err
}) })
} }