|
@@ -7,6 +7,7 @@ import com.cdf.entity.Video;
|
|
import com.cdf.service.IShopCategoryService;
|
|
import com.cdf.service.IShopCategoryService;
|
|
import com.cdf.service.IShopService;
|
|
import com.cdf.service.IShopService;
|
|
import com.cdf.service.IVideoService;
|
|
import com.cdf.service.IVideoService;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -28,12 +29,17 @@ public class ShopApiController {
|
|
public ResultData getShopCategory(){
|
|
public ResultData getShopCategory(){
|
|
return ResultData.ok(shopCategoryService.list());
|
|
return ResultData.ok(shopCategoryService.list());
|
|
}
|
|
}
|
|
|
|
+
|
|
@GetMapping("/getShopByCategory")
|
|
@GetMapping("/getShopByCategory")
|
|
- public ResultData getShopByCategory(@RequestParam(required = false) Integer categoryId){
|
|
|
|
|
|
+ public ResultData getShopByCategory(@RequestParam(required = false) Integer categoryId,
|
|
|
|
+ @RequestParam(required = false) String shopName){
|
|
LambdaQueryWrapper<Shop> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<Shop> wrapper = new LambdaQueryWrapper<>();
|
|
if(categoryId != null){
|
|
if(categoryId != null){
|
|
wrapper.eq(Shop::getCategoryId,categoryId);
|
|
wrapper.eq(Shop::getCategoryId,categoryId);
|
|
}
|
|
}
|
|
|
|
+ if(StringUtils.isNotBlank(shopName)){
|
|
|
|
+ wrapper.like(Shop::getShopName,shopName);
|
|
|
|
+ }
|
|
wrapper.orderByAsc(Shop::getSort);
|
|
wrapper.orderByAsc(Shop::getSort);
|
|
wrapper.orderByDesc(Shop::getCreateTime);
|
|
wrapper.orderByDesc(Shop::getCreateTime);
|
|
return ResultData.ok(shopService.list(wrapper));
|
|
return ResultData.ok(shopService.list(wrapper));
|