- GetStores API增加POST方式以方便传入大量参数
新增storeIDs参数,可传入要查询的城市列表,storeID参数与新参数是或的关系。
This commit is contained in:
@@ -272,9 +272,20 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
|||||||
sqlWhere += ")"
|
sqlWhere += ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
if params["storeID"] != nil {
|
if params["storeID"] != nil || params["storeIDs"] != nil {
|
||||||
sqlWhere += " AND t1.id = ?"
|
var storeIDs []int
|
||||||
sqlWhereParams = append(sqlWhereParams, params["storeID"].(int))
|
if params["storeIDs"] != nil {
|
||||||
|
if err = jxutils.Strings2Objs(utils.Interface2String("storeIDs"), &storeIDs); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if params["storeID"] != nil {
|
||||||
|
storeIDs = append(storeIDs, params["storeID"].(int))
|
||||||
|
}
|
||||||
|
if len(storeIDs) > 0 {
|
||||||
|
sqlWhere += " AND t1.id IN (" + dao.GenQuestionMarks(len(storeIDs)) + ")"
|
||||||
|
sqlWhereParams = append(sqlWhereParams, storeIDs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if params["name"] != nil {
|
if params["name"] != nil {
|
||||||
sqlWhere += " AND t1.name LIKE ?"
|
sqlWhere += " AND t1.name LIKE ?"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ type StoreController struct {
|
|||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||||||
// @Param storeID query int false "门店ID"
|
// @Param storeID query int false "门店ID"
|
||||||
|
// @Param storeIDs query string false "门店ID列表"
|
||||||
// @Param name query string false "门店名称(不要求完全一致)"
|
// @Param name query string false "门店名称(不要求完全一致)"
|
||||||
// @Param placeID query int false "所属地点ID"
|
// @Param placeID query int false "所属地点ID"
|
||||||
// @Param placeLevel query int false "所属地点级别"
|
// @Param placeLevel query int false "所属地点级别"
|
||||||
@@ -39,7 +40,7 @@ type StoreController struct {
|
|||||||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetStores [get]
|
// @router /GetStores [get,post]
|
||||||
func (c *StoreController) GetStores() {
|
func (c *StoreController) GetStores() {
|
||||||
c.callGetStores(func(params *tStoreGetStoresParams) (retVal interface{}, errCode string, err error) {
|
c.callGetStores(func(params *tStoreGetStoresParams) (retVal interface{}, errCode string, err error) {
|
||||||
timeList, err := jxutils.BatchStr2Time(params.OrderTimeFrom, params.OrderTimeTo)
|
timeList, err := jxutils.BatchStr2Time(params.OrderTimeFrom, params.OrderTimeTo)
|
||||||
@@ -129,16 +130,6 @@ func (c *StoreController) CreateStore() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Title 空方法,占位用
|
|
||||||
// @Description 空方法,占位用
|
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param payload formData string true "json数据,store对象"
|
|
||||||
// @Success 200 {object} controllers.CallResult
|
|
||||||
// @Failure 200 {object} controllers.CallResult
|
|
||||||
// @router /ZZZZZ [put]
|
|
||||||
func (c *StoreController) ZZZZZ() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Title 得到门店映射信息
|
// @Title 得到门店映射信息
|
||||||
// @Description 得到门店映射信息
|
// @Description 得到门店映射信息
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
|
|||||||
@@ -1298,7 +1298,7 @@ func init() {
|
|||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "GetStores",
|
Method: "GetStores",
|
||||||
Router: `/GetStores`,
|
Router: `/GetStores`,
|
||||||
AllowHTTPMethods: []string{"get"},
|
AllowHTTPMethods: []string{"get","post"},
|
||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
@@ -1375,15 +1375,6 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
|
||||||
beego.ControllerComments{
|
|
||||||
Method: "ZZZZZ",
|
|
||||||
Router: `/ZZZZZ`,
|
|
||||||
AllowHTTPMethods: []string{"put"},
|
|
||||||
MethodParams: param.Make(),
|
|
||||||
Filters: nil,
|
|
||||||
Params: nil})
|
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "CopyStoreSkus",
|
Method: "CopyStoreSkus",
|
||||||
|
|||||||
Reference in New Issue
Block a user