Commit 8da0b5ec authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-db,litemall-wx-api]: 后端取消收货地址id查询,而是userId和id联合查询

parent edd03536
......@@ -22,8 +22,10 @@ public class LitemallAddressService {
return addressMapper.selectByExample(example);
}
public LitemallAddress findById(Integer id) {
return addressMapper.selectByPrimaryKey(id);
public LitemallAddress query(Integer userId, Integer id) {
LitemallAddressExample example = new LitemallAddressExample();
example.or().andIdEqualTo(id).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return addressMapper.selectOneByExample(example);
}
public int add(LitemallAddress address) {
......
......@@ -278,7 +278,7 @@ public class WxOrderService {
}
// 收货地址
LitemallAddress checkedAddress = addressService.findById(addressId);
LitemallAddress checkedAddress = addressService.query(userId, addressId);
if (checkedAddress == null) {
return ResponseUtil.badArgument();
}
......
......@@ -103,7 +103,7 @@ public class WxAddressController extends GetRegionService {
return ResponseUtil.unlogin();
}
LitemallAddress address = addressService.findById(id);
LitemallAddress address = addressService.query(userId, id);
if (address == null) {
return ResponseUtil.badArgumentValue();
}
......
......@@ -397,7 +397,7 @@ public class WxCartController {
}
} else {
checkedAddress = addressService.findById(addressId);
checkedAddress = addressService.query(userId, addressId);
// 如果null, 则报错
if (checkedAddress == null) {
return ResponseUtil.badArgumentValue();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment