package com.hwrj.cloud.portal.controller;

import com.hwrj.cloud.common.api.CommonPage;
import com.hwrj.cloud.common.api.CommonResult;
import com.hwrj.cloud.portal.domain.AreaVo;
import com.hwrj.cloud.portal.model.PmsProduct;
import com.hwrj.cloud.portal.service.PmsBasePositiontService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@Api(tags = "地址管理")
@RequestMapping("/positiont")
public class PmsBasePositiontController {
    @Autowired
    private PmsBasePositiontService pmsBasePositiontService;

    @ApiOperation(value = "综合搜索、筛选、排序")
    @ApiImplicitParam(name = "sort", value = "排序字段:0->按相关度；1->按新品；2->按销量；3->价格从低到高；4->价格从高到低",
            defaultValue = "0", allowableValues = "0,1,2,3,4", paramType = "query", dataType = "integer")
    @RequestMapping(value = "/search", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult search(String parentId) {
        List<AreaVo> list = pmsBasePositiontService.search(parentId);
        return CommonResult.success(list);
    }

}
