|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.cdf.common.ResultData;
|
|
|
import com.cdf.entity.Dept;
|
|
|
import com.cdf.entity.Shop;
|
|
|
+import com.cdf.entity.ShopCategory;
|
|
|
import com.cdf.entity.Video;
|
|
|
import com.cdf.service.IDeptService;
|
|
|
import com.cdf.service.IShopCategoryService;
|
|
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -33,12 +35,21 @@ public class ShopApiController {
|
|
|
|
|
|
@GetMapping("/getShopCategory")
|
|
|
public ResultData getShopCategory(){
|
|
|
- return ResultData.ok(shopCategoryService.list());
|
|
|
+ List<ShopCategory> list = shopCategoryService.list();
|
|
|
+ List<ShopCategory> listVo = new ArrayList<>();
|
|
|
+ for (ShopCategory category : list) {
|
|
|
+ List<Shop> byCategory = shopService.getByCategory(category.getId());
|
|
|
+ if(byCategory != null && byCategory.size() >0){
|
|
|
+ listVo.add(category);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultData.ok(listVo);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getShopByCategory")
|
|
|
public ResultData getShopByCategory(@RequestParam(required = false) Integer categoryId,
|
|
|
@RequestParam(required = false) String shopName,
|
|
|
+ @RequestParam(required = false) String sceneNum,
|
|
|
@RequestParam(required = false,defaultValue = "22") Integer deptId){
|
|
|
LambdaQueryWrapper<Shop> wrapper = new LambdaQueryWrapper<>();
|
|
|
if(categoryId != null){
|
|
@@ -52,6 +63,9 @@ public class ShopApiController {
|
|
|
if(StringUtils.isNotBlank(shopName)){
|
|
|
wrapper.like(Shop::getShopName,shopName);
|
|
|
}
|
|
|
+ if(StringUtils.isNotBlank(sceneNum)){
|
|
|
+ wrapper.eq(Shop::getSceneUrl,sceneNum);
|
|
|
+ }
|
|
|
wrapper.orderByAsc(Shop::getSort);
|
|
|
wrapper.orderByDesc(Shop::getCreateTime);
|
|
|
return ResultData.ok(shopService.list(wrapper));
|