|
@@ -14,6 +14,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.enums.*;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
@@ -21,6 +22,7 @@ import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.modules.api.request.GoodsListRequest;
|
|
|
+import org.springblade.modules.business.service.IFacilityService;
|
|
|
import org.springblade.modules.mall.entity.CategoryInfo;
|
|
|
import org.springblade.modules.mall.entity.GoodsInfo;
|
|
|
import org.springblade.modules.mall.service.ICategoryInfoService;
|
|
@@ -40,14 +42,14 @@ import java.util.List;
|
|
|
* Description
|
|
|
*/
|
|
|
@RestController
|
|
|
+@AllArgsConstructor
|
|
|
@RequestMapping(CommonConstant.API_URL)
|
|
|
@Api(value = "商城模块接口", tags = "05.商城模块接口")
|
|
|
public class ApiGoodsController extends BladeController {
|
|
|
|
|
|
- @Resource
|
|
|
- private ICategoryInfoService categoryInfoService;
|
|
|
- @Resource
|
|
|
- private IGoodsInfoService goodsInfoService;
|
|
|
+ private final ICategoryInfoService categoryInfoService;
|
|
|
+ private final IGoodsInfoService goodsInfoService;
|
|
|
+ private final IFacilityService iFacilityService;
|
|
|
|
|
|
@GetMapping("/category/list")
|
|
|
@ApiOperationSupport(order = 1)
|
|
@@ -84,4 +86,23 @@ public class ApiGoodsController extends BladeController {
|
|
|
return R.data(goodsInfoVOS);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/goods")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "查询平台商品列表")
|
|
|
+ public R<IPage<GoodsInfo>> getPlatGoods(GoodsListRequest request, Query query) {
|
|
|
+ LambdaQueryWrapper<GoodsInfo> wrapper = Wrappers.lambdaQuery(GoodsInfo.class);
|
|
|
+ wrapper.eq(GoodsInfo::getIsSale, GoodsStateEnum.ON_SALE.getValue());
|
|
|
+ wrapper.like(StrUtil.isNotBlank(request.getGoodsName()), GoodsInfo::getGoodsName, request.getGoodsName());
|
|
|
+ IPage<GoodsInfo> pages = goodsInfoService.page(Condition.getPage(query), wrapper);
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/goods/byDeviceId")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "查询设备商品")
|
|
|
+ public R<List<GoodsInfo>> getByDeviceId(Long deviceId) {
|
|
|
+ List<GoodsInfo> goods = iFacilityService.getGoods(deviceId);
|
|
|
+ return R.data(goods);
|
|
|
+ }
|
|
|
+
|
|
|
}
|