|
|
@ -1,33 +1,33 @@ |
|
|
|
package com.gxwebsoft.shop.controller; |
|
|
|
package com.gxwebsoft.shop.controller; |
|
|
|
|
|
|
|
import com.gxwebsoft.common.core.web.BaseController; |
|
|
|
import com.gxwebsoft.shop.service.ShopUserAddressService; |
|
|
|
import com.gxwebsoft.shop.entity.ShopUserAddress; |
|
|
|
import com.gxwebsoft.shop.param.ShopUserAddressParam; |
|
|
|
import com.gxwebsoft.common.core.web.ApiResult; |
|
|
|
import com.gxwebsoft.common.core.web.PageResult; |
|
|
|
import com.gxwebsoft.common.core.web.PageParam; |
|
|
|
import com.gxwebsoft.common.core.web.BatchParam; |
|
|
|
import com.gxwebsoft.common.core.annotation.OperationLog; |
|
|
|
import com.gxwebsoft.common.system.entity.User; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.gxwebsoft.common.core.web.BaseController; |
|
|
|
import com.gxwebsoft.shop.service.ShopUserAddressService; |
|
|
|
import com.gxwebsoft.shop.entity.ShopUserAddress; |
|
|
|
import com.gxwebsoft.shop.param.ShopUserAddressParam; |
|
|
|
import com.gxwebsoft.common.core.web.ApiResult; |
|
|
|
import com.gxwebsoft.common.core.web.PageResult; |
|
|
|
import com.gxwebsoft.common.core.web.BatchParam; |
|
|
|
import com.gxwebsoft.common.core.annotation.OperationLog; |
|
|
|
import com.gxwebsoft.common.system.entity.User; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.List; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 收货地址控制器 |
|
|
|
* |
|
|
|
* @author 科技小王子 |
|
|
|
* @since 2025-07-22 23:06:40 |
|
|
|
*/ |
|
|
|
@Api(tags = "收货地址管理") |
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/shop/shop-user-address") |
|
|
|
public class ShopUserAddressController extends BaseController { |
|
|
|
@Api(tags = "收货地址管理") |
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/shop/shop-user-address") |
|
|
|
public class ShopUserAddressController extends BaseController { |
|
|
|
@Resource |
|
|
|
private ShopUserAddressService shopUserAddressService; |
|
|
|
|
|
|
@ -64,6 +64,9 @@ public class ShopUserAddressController extends BaseController { |
|
|
|
User loginUser = getLoginUser(); |
|
|
|
if (loginUser != null) { |
|
|
|
shopUserAddress.setUserId(loginUser.getUserId()); |
|
|
|
if (shopUserAddressService.count(new LambdaQueryWrapper<ShopUserAddress>().eq(ShopUserAddress::getUserId, loginUser.getUserId()).eq(ShopUserAddress::getAddress, shopUserAddress.getAddress())) > 0) { |
|
|
|
return success("该地址已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (shopUserAddressService.save(shopUserAddress)) { |
|
|
|
return success("添加成功"); |
|
|
@ -126,4 +129,4 @@ public class ShopUserAddressController extends BaseController { |
|
|
|
return fail("删除失败"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|