|
@@ -1,9 +1,7 @@
|
|
package org.springblade.modules.api.controller;
|
|
package org.springblade.modules.api.controller;
|
|
|
|
|
|
-import cn.hutool.core.date.DateTime;
|
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
import cn.hutool.core.lang.Assert;
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
@@ -11,6 +9,7 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
+import org.springblade.common.base.BaseEntity;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.utils.DistanceUtils;
|
|
import org.springblade.common.utils.DistanceUtils;
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Condition;
|
|
@@ -24,6 +23,7 @@ import org.springblade.modules.business.service.IFacilityService;
|
|
import org.springblade.modules.business.service.IShopService;
|
|
import org.springblade.modules.business.service.IShopService;
|
|
import org.springblade.modules.business.vo.ShopVO;
|
|
import org.springblade.modules.business.vo.ShopVO;
|
|
import org.springblade.modules.business.wrapper.ShopWrapper;
|
|
import org.springblade.modules.business.wrapper.ShopWrapper;
|
|
|
|
+import org.springblade.modules.system.service.IUserMerchantService;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
@@ -33,10 +33,11 @@ import java.util.List;
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
@RequestMapping(CommonConstant.API_URL + "/shop")
|
|
@RequestMapping(CommonConstant.API_URL + "/shop")
|
|
@Api(value = "门店管理接口", tags = "门店管理接口")
|
|
@Api(value = "门店管理接口", tags = "门店管理接口")
|
|
-public class ApiShopController {
|
|
|
|
|
|
+public class ApiShopController extends BaseController {
|
|
|
|
|
|
private final IShopService iShopService;
|
|
private final IShopService iShopService;
|
|
private final IFacilityService iFacilityService;
|
|
private final IFacilityService iFacilityService;
|
|
|
|
+ private final IUserMerchantService iUserMerchantService;
|
|
|
|
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
@ApiOperationSupport(order = 1)
|
|
@ApiOperationSupport(order = 1)
|
|
@@ -60,9 +61,14 @@ public class ApiShopController {
|
|
@ApiOperationSupport(order = 3)
|
|
@ApiOperationSupport(order = 3)
|
|
@ApiOperation(value = "分页查询门店列表", notes = "传入shop")
|
|
@ApiOperation(value = "分页查询门店列表", notes = "传入shop")
|
|
public R<IPage<ShopVO>> page(ShopVO shop, Query query) {
|
|
public R<IPage<ShopVO>> page(ShopVO shop, Query query) {
|
|
|
|
+ LambdaQueryWrapper<Shop> wrapper = Wrappers.lambdaQuery(Shop.class);
|
|
|
|
+ wrapper.eq(Shop::getMerchantId, AuthUtil.getUserId());
|
|
shop.setMerchantId(AuthUtil.getUserId());
|
|
shop.setMerchantId(AuthUtil.getUserId());
|
|
- IPage<ShopVO> pages = iShopService.selectShopPage(Condition.getPage(query), shop);
|
|
|
|
- return R.data(pages);
|
|
|
|
|
|
+ if (!isMerchant()) {
|
|
|
|
+ wrapper.in(BaseEntity::getId, iUserMerchantService.getByUserId(AuthUtil.getUserId()));
|
|
|
|
+ }
|
|
|
|
+ IPage<Shop> pages = iShopService.page(Condition.getPage(query), wrapper);
|
|
|
|
+ return R.data(ShopWrapper.build().pageVO(pages));
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/detail")
|
|
@GetMapping("/detail")
|