| | |
| | | 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; |
| | |
| | | import com.oying.utils.PageUtil; |
| | | import com.oying.utils.SecurityUtils; |
| | | import com.oying.utils.StringUtils; |
| | | import com.oying.utils.enums.StoreRole; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | |
| | |
| | | StoreUser storeUser = new StoreUser(); |
| | | storeUser.setStoreId(storeId); |
| | | storeUser.setUserId(SecurityUtils.getCurrentUserId()); |
| | | storeUser.setRoleType(""); |
| | | storeUser.setRoleType(StoreRole.ADMIN.getRole()); |
| | | storeUser.setPermissions(""); |
| | | storeUserMapper.insert(storeUser); |
| | | return true; |