- GetPlaces support keyword.
This commit is contained in:
@@ -29,40 +29,6 @@ var (
|
||||
ErrCanNotFindVendor = errors.New("vendorID参数不合法")
|
||||
)
|
||||
|
||||
func GetPlaces(parentCode int, includeDisabled bool) ([]*model.Place, error) {
|
||||
db := dao.GetDB()
|
||||
places := []*model.Place{}
|
||||
cond := map[string]interface{}{
|
||||
"ParentCode": parentCode,
|
||||
}
|
||||
if !includeDisabled {
|
||||
cond["Enabled"] = 1
|
||||
}
|
||||
return places, dao.GetEntities(db, &places, cond, false)
|
||||
}
|
||||
|
||||
func UpdatePlaces(places []map[string]interface{}, userName string) (num int64, err error) {
|
||||
if len(places) == 0 {
|
||||
return 0, ErrMissingInput
|
||||
}
|
||||
for _, place := range places {
|
||||
if place["code"] == nil {
|
||||
return 0, ErrMissingInput
|
||||
}
|
||||
placeid := &model.Place{}
|
||||
valid := dao.NormalMakeMapByFieldList(place, []string{"jdCode", "enabled", "mtpsPrice"}, userName)
|
||||
if num, err = dao.UpdateEntityByKV(nil, placeid, valid, utils.Params2Map("Code", place["code"])); err != nil {
|
||||
return num, err
|
||||
}
|
||||
}
|
||||
return num, err
|
||||
}
|
||||
|
||||
func UpdatePlace(placeCode int, payload map[string]interface{}, userName string) (num int64, err error) {
|
||||
payload["code"] = placeCode
|
||||
return UpdatePlaces([]map[string]interface{}{payload}, userName)
|
||||
}
|
||||
|
||||
// todo 门店绑定信息可以考虑以数组形式返回,而不是现在这样
|
||||
func GetStores(keyword string, params map[string]interface{}, offset, pageSize int) (retVal *StoresInfo, err error) {
|
||||
sqlFrom := `
|
||||
|
||||
Reference in New Issue
Block a user