| | |
| | | public ResponseEntity<?> updateAddress(@PathVariable("storeId") Long storeId, |
| | | @Validated(value = StoreFieldUpdateRequest.UpdateStoreAddressGroup.class) |
| | | @RequestBody StoreFieldUpdateRequest request) { |
| | | storeService.updateAddress(storeId, request.getAddress(), request.getVersion()); |
| | | storeService.updateAddress(storeId, request.getAddress(), request.getLongitude(), request.getLatitude(), request.getVersion()); |
| | | return ResponseEntity.noContent().build(); |
| | | } |
| | | |
| | |
| | | |
| | | boolean updateContactPhone(Long storeId, String contactPhone, Long version); |
| | | |
| | | boolean updateAddress(Long storeId, String address, Long version); |
| | | boolean updateAddress(Long storeId, String address, Double longitude, Double latitude, Long version); |
| | | |
| | | boolean updateLocation(Long storeId, Double longitude, Double latitude, Long version); |
| | | |
| | |
| | | package com.oying.modules.pc.store.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateAddress(Long storeId, String address, Long version) { |
| | | public boolean updateAddress(Long storeId, String address, Double longitude, Double latitude, Long version) { |
| | | Store existingStore = this.getOrThrow(storeId, version); |
| | | LambdaUpdateWrapper<Store> wrapper = this.createLambdaUpdateWrapper(storeId, existingStore.getVersion()) |
| | | .set(Store::getAddress, address); |
| | | if (ObjectUtil.isNotEmpty(longitude)) { |
| | | wrapper.set(Store::getLongitude, longitude); |
| | | } |
| | | if (ObjectUtil.isNotEmpty(latitude)) { |
| | | wrapper.set(Store::getLatitude, latitude); |
| | | } |
| | | return update(wrapper); |
| | | } |
| | | |