package com.ruoyi.member.controller.inner; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.security.annotation.InnerAuth; import com.ruoyi.member.service.IMemberAddressService; import com.ruoyi.system.api.domain.MemberAddress; import io.swagger.annotations.ApiModelProperty; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; /** *

* 会员地址表 前端控制器 *

* * @author mitao * @since 2024-05-16 */ @RestController @RequestMapping("/member-address") public class MemberAddressController { /** * 获取当前商品信息 * */ @Resource private IMemberAddressService iMemberAddressService; @PostMapping("/getMemberAddressOne") @ResponseBody @InnerAuth public R getMemberAddressOne(@RequestBody Long userId) { LambdaQueryWrapper wrapper2= Wrappers.lambdaQuery(); wrapper2.eq(MemberAddress::getMemberId,userId); wrapper2.eq(MemberAddress::getDelFlag,0); wrapper2.eq(MemberAddress::getIsDefault,2); MemberAddress memberAddress=iMemberAddressService.getOne(wrapper2); if (memberAddress==null){ LambdaQueryWrapper wrapper= Wrappers.lambdaQuery(); wrapper.eq(MemberAddress::getMemberId,userId); wrapper.eq(MemberAddress::getDelFlag,0); wrapper.last("limit 1"); memberAddress=iMemberAddressService.getOne(wrapper2); } return R.ok(memberAddress); } }