|
@@ -6,7 +6,6 @@ import com.caimei365.user.model.dto.BaikeProductDto;
|
|
|
import com.caimei365.user.model.dto.ShopArticleDto;
|
|
|
import com.caimei365.user.model.dto.ShopBannerDto;
|
|
|
import com.caimei365.user.model.dto.ShopUpdateDto;
|
|
|
-import com.caimei365.user.model.po.BaikeProductPo;
|
|
|
import com.caimei365.user.model.vo.*;
|
|
|
import com.caimei365.user.service.ShopService;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -15,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -124,17 +124,123 @@ public class ShopApi {
|
|
|
return shopService.getShopHomeData(shopId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 供应商主页列表配置列表
|
|
|
+ * @param shopId
|
|
|
+ * @param category
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("供应商主页列表配置列表")
|
|
|
+ @GetMapping("/getShopCategory")
|
|
|
+ public ResponseJson<PaginationVo<CmShopCategoryVo>> getShopCategory(Integer shopId, String category,
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
|
|
|
+ if (null == shopId) {
|
|
|
+ return ResponseJson.error(-1, "供应商Id不能为空", null);
|
|
|
+ }
|
|
|
+ return shopService.getShopCategory(shopId, category, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 一键排序
|
|
|
+ * @param cmShopCategoryList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("一键排序")
|
|
|
+ @PostMapping("/renewShopCategory")
|
|
|
+ public ResponseJson renewShopCategory(@RequestBody List<CmShopCategoryVo> cmShopCategoryList) {
|
|
|
+ if (null == cmShopCategoryList) {
|
|
|
+ return ResponseJson.error(-1, "供应商类别信息不能为空", null);
|
|
|
+ }
|
|
|
+ return shopService.renewShopCategory(cmShopCategoryList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 供应商商品类别回显
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("供应商商品类别回显")
|
|
|
+ @GetMapping("/echoShopCategory")
|
|
|
+ public ResponseJson<Map<String, Object>> echoShopCategory(Integer id) {
|
|
|
+ if (null == id) {
|
|
|
+ return ResponseJson.error(-1, "供应商类别id不能为空", null);
|
|
|
+ }
|
|
|
+ return shopService.echoShopCategory(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 选择商品
|
|
|
+ * @param shopId
|
|
|
+ * @param naem
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("选择商品")
|
|
|
+ @GetMapping("/getShopProductList")
|
|
|
+ public ResponseJson<PaginationVo<ProductItemVo>> getShopProductList(Integer shopId, String naem,
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
|
|
|
+ if (null == shopId) {
|
|
|
+ return ResponseJson.error(-1, "供应商Id不能为空", null);
|
|
|
+ }
|
|
|
+ return shopService.getShopProductList(shopId, naem, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存供应商类别
|
|
|
+ * @param category
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("保存供应商类别")
|
|
|
+ @PostMapping("/saveShopCategory")
|
|
|
+ public ResponseJson saveShopCategory(@RequestBody CmShopCategoryVo category) {
|
|
|
+
|
|
|
+ if (null == category) {
|
|
|
+ return ResponseJson.error(-1, "类别信息不能为空", null);
|
|
|
+ }
|
|
|
+ if (null == category.getShopId()) {
|
|
|
+ return ResponseJson.error(-1, "供应商Id不能为空", null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(category.getCategory())) {
|
|
|
+ return ResponseJson.error(-1, "类别名称不能为空", null);
|
|
|
+ }
|
|
|
+ if (null == category.getSort()) {
|
|
|
+ return ResponseJson.error(-1, "类别排序不能为空", null);
|
|
|
+ }
|
|
|
+ return shopService.saveShopCategory(category);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除供应商商品类别
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("删除供应商商品类别")
|
|
|
+ @GetMapping("/removeCategoryId")
|
|
|
+ public ResponseJson removeCategoryId(Integer id) {
|
|
|
+ if (null == id) {
|
|
|
+ return ResponseJson.error(-1, "供应商类别Id不能为空", null);
|
|
|
+ }
|
|
|
+ return shopService.deleteCategory(id);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 供应商首页-轮播图片
|
|
|
* @param shopId 供应商Id
|
|
|
*/
|
|
|
@ApiOperation("供应商首页-轮播图片(旧:/supplier/home/images(supplierId))")
|
|
|
@GetMapping("/home/images")
|
|
|
- public ResponseJson<List<ShopBannerVo>> getShopHomeImages(Integer shopId) {
|
|
|
+ public ResponseJson<PaginationVo<ShopBannerVo>> getShopHomeImages(Integer shopId,
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
|
|
|
if (null == shopId) {
|
|
|
return ResponseJson.error("参数异常:供应商Id不能为空!", null);
|
|
|
}
|
|
|
- return shopService.getShopHomeImages(shopId);
|
|
|
+ return shopService.getShopHomeImages(shopId, pageNum, pageSize);
|
|
|
}
|
|
|
|
|
|
/**
|