|
|
@@ -10,28 +10,19 @@
|
|
|
|
|
|
package com.yami.shop.platform.controller;
|
|
|
|
|
|
-import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.yami.shop.bean.dto.ListCategoryDTO;
|
|
|
-import com.yami.shop.bean.model.Category;
|
|
|
-import com.yami.shop.bean.model.Product;
|
|
|
-import com.yami.shop.bean.model.ShopDetail;
|
|
|
-import com.yami.shop.bean.vo.ListCategoryVO;
|
|
|
-import com.yami.shop.common.annotation.SysLog;
|
|
|
-import com.yami.shop.common.config.Constant;
|
|
|
+import com.yami.shop.bean.model.CategoryProd;
|
|
|
+import com.yami.shop.common.util.PageParam;
|
|
|
import com.yami.shop.common.util.R;
|
|
|
import com.yami.shop.service.CategoryProdService;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -45,14 +36,32 @@ import java.util.Objects;
|
|
|
@RequestMapping("/platform/categoryProd")
|
|
|
public class CategoryPropController {
|
|
|
|
|
|
- @Autowired
|
|
|
- private CategoryProdService categoryProdService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过商品id查询分类绑定商品
|
|
|
- */
|
|
|
+ @Autowired
|
|
|
+ private CategoryProdService categoryProdService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 通过code查询分类绑定商品
|
|
|
+ */
|
|
|
+ @GetMapping("/listByCode")
|
|
|
+ public R<List<CategoryProd>> listByCode(CategoryProd categoryProd) {
|
|
|
+ List<CategoryProd> list = categoryProdService.list(new LambdaQueryWrapper<CategoryProd>()
|
|
|
+ .eq(CategoryProd::getCode, categoryProd.getCode())
|
|
|
+ .eq(CategoryProd::getIsDelete, 0)
|
|
|
+ .eq(ObjectUtil.isNotEmpty(categoryProd.getShopId()), CategoryProd::getShopId, categoryProd.getShopId()));
|
|
|
+ return R.SUCCESS(list);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 分页通过code查询分类绑定商品
|
|
|
+ */
|
|
|
+ @GetMapping("/pageByCode")
|
|
|
+ public R<IPage<CategoryProd>> pageByCode(CategoryProd categoryProd, PageParam<CategoryProd> page) {
|
|
|
+ IPage<CategoryProd> list = categoryProdService.page(page, new LambdaQueryWrapper<CategoryProd>()
|
|
|
+ .eq(CategoryProd::getCode, categoryProd.getCode())
|
|
|
+ .eq(CategoryProd::getIsDelete, 0)
|
|
|
+ .eq(ObjectUtil.isNotEmpty(categoryProd.getShopId()), CategoryProd::getShopId, categoryProd.getShopId()));
|
|
|
+ return R.SUCCESS(list);
|
|
|
+ }
|
|
|
|
|
|
}
|