package com.farriver.bwf.web.controller.wechat; import com.farriver.bwf.common.model.ApiData; import com.farriver.bwf.common.model.ApiPageData; import com.farriver.bwf.common.statics.LangConstants; import com.farriver.bwf.data.transferobject.queryobject.product.ProductCategoryQueryObject; import com.farriver.bwf.data.transferobject.queryobject.product.ProductMasterQueryObject; import com.farriver.bwf.service.product.ProductService; import com.farriver.bwf.web.controller.admin.AdminControllerBase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.*; import jakarta.annotation.Resource; @RestController @RequestMapping("/api/wechat/product") public class WeChatProductController extends AdminControllerBase { private static final Logger logger = LoggerFactory.getLogger(WeChatProductController.class); @Resource ProductService productService; @PostMapping("/master/list") public ApiPageData GetProductMasterList(@RequestBody ProductMasterQueryObject queryObject) { if (queryObject == null) { return ApiPageData.error(LangConstants.MSG_ERROR_PARAMETERS); } return productService.GetProductMasterList(queryObject); } @GetMapping("/listbycategoryid") public ApiPageData GetProductListByCategoryId(@RequestParam(defaultValue = "") String categoryid) { if (categoryid == null || categoryid.isEmpty()) return null; return productService.GetProductListByCategoryId(categoryid); } @GetMapping("/detailbymasterid") public ApiData GetProductDetailByMasterId(@RequestParam(defaultValue = "") String masterid) { if (masterid == null || masterid.isEmpty()) return null; return productService.GetProductDetailByMasterId(masterid); } @PostMapping("/category/list") public ApiPageData GetProductCategoryList(@RequestBody ProductCategoryQueryObject queryObject) { if (queryObject == null) { return ApiPageData.error(LangConstants.MSG_ERROR_PARAMETERS); } return productService.GetProductCategoryList(queryObject); } @PostMapping("/category/listwithproducts") public ApiPageData GetProductCategoryWithProductList(@RequestBody ProductCategoryQueryObject queryObject) { if (queryObject == null) { return ApiPageData.error(LangConstants.MSG_ERROR_PARAMETERS); } return productService.GetProductCategoryWithProductList(queryObject); } @GetMapping("/category/listbyparent") public ApiData GetProductCategoryListByParentName(@RequestParam(defaultValue = "") String parentname) { if (parentname == null || parentname.isEmpty()) return null; return productService.GetProductCategoryListByParentName(parentname); } }