Commit 1a0d2321 by zhiwj

门店照片

parent 1f24a7ed
...@@ -54,7 +54,7 @@ public interface TabStorePhotoMapper { ...@@ -54,7 +54,7 @@ public interface TabStorePhotoMapper {
*/ */
int updateByPrimaryKey(TabStorePhoto record); int updateByPrimaryKey(TabStorePhoto record);
List<TabStorePhoto> listStorePhoto(@Param("enterpriseId") Integer enterpriseId, @Param("storeInfoId") Integer storeId); List<TabStorePhoto> listStorePhoto(@Param("enterpriseId") Integer enterpriseId, @Param("storeInfoId") Integer storeInfoId);
int updateAllStorePhoto(@Param("imageCode") String imageCode, @Param("imageUrl")String imageUrl, @Param("sort") int sort, @Param("enterpriseId") Integer enterpriseId); int updateAllStorePhoto(@Param("imageCode") String imageCode, @Param("imageUrl")String imageUrl, @Param("sort") int sort, @Param("enterpriseId") Integer enterpriseId);
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
* @date 2019/6/27 * @date 2019/6/27
*/ */
public interface StorePhotoService { public interface StorePhotoService {
void editStoreImage(Integer enterpriseId, Integer storeId, List<StorePhotoDTO> photoList, List<Integer> delPhotos); void editStoreImage(Integer enterpriseId, Integer storeInfoId, List<StorePhotoDTO> photoList, List<Integer> delPhotos);
List<TabStorePhoto> listStorePhoto(Integer enterpriseId, Integer storeId); List<TabStorePhoto> listStorePhoto(Integer enterpriseId, Integer storeInfoId);
} }
...@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -30,12 +31,10 @@ public class StoreBusinessTimeServiceImpl implements StoreBusinessTimeService { ...@@ -30,12 +31,10 @@ public class StoreBusinessTimeServiceImpl implements StoreBusinessTimeService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void editStoreBusinessTime(Integer enterpriseId, Integer storeInfoId, List<StoreBusinessTimeDTO> businessTimeList, List<Integer> delBusinessTimes) { public void editStoreBusinessTime(Integer enterpriseId, Integer storeInfoId, List<StoreBusinessTimeDTO> businessTimeList, List<Integer> delBusinessTimes) {
if (CollectionUtils.isNotEmpty(delBusinessTimes)) { if (CollectionUtils.isNotEmpty(businessTimeList) || CollectionUtils.isNotEmpty(delBusinessTimes)) {
for (Integer delId : delBusinessTimes) { tabStoreBusinessTimeMapper.deleteBystoreInfoIds(enterpriseId, Collections.singletonList(storeInfoId));
tabStoreBusinessTimeMapper.deleteByPrimaryKey(delId);
}
} }
// tabStoreBusinessTimeMapper.deleteBystoreInfoIds(enterpriseId, Collections.singletonList(storeInfoId));
if (CollectionUtils.isNotEmpty(businessTimeList)) { if (CollectionUtils.isNotEmpty(businessTimeList)) {
for (StoreBusinessTimeDTO storeBusinessTimeDTO : businessTimeList) { for (StoreBusinessTimeDTO storeBusinessTimeDTO : businessTimeList) {
if (StringUtils.isNotBlank(storeBusinessTimeDTO.getWeekday())) { if (StringUtils.isNotBlank(storeBusinessTimeDTO.getWeekday())) {
......
...@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -25,17 +26,13 @@ public class StorePhotoServiceImpl implements StorePhotoService { ...@@ -25,17 +26,13 @@ public class StorePhotoServiceImpl implements StorePhotoService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void editStoreImage(Integer enterpriseId, Integer storeId, List<StorePhotoDTO> photoList, List<Integer> delPhotos) { public void editStoreImage(Integer enterpriseId, Integer storeInfoId, List<StorePhotoDTO> photoList, List<Integer> delPhotos) {
if (CollectionUtils.isNotEmpty(delPhotos)) {
for (Integer delId : delPhotos) { if (CollectionUtils.isNotEmpty(photoList) || CollectionUtils.isNotEmpty(delPhotos)) {
TabStorePhoto storePhoto = new TabStorePhoto(); // 删除老的
storePhoto.setStorePhotoId(delId); tabStorePhotoMapper.deleteBystoreInfoIds(enterpriseId, Collections.singletonList(storeInfoId));
storePhoto.setStatus(GlobalInfo.DATA_STATUS_DELETE);
tabStorePhotoMapper.updateByPrimaryKeySelective(storePhoto);
}
} }
// 删除老的
// tabStorePhotoMapper.deleteBystoreInfoIds(enterpriseId, Collections.singletonList(storeId));
if (CollectionUtils.isNotEmpty(photoList)) { if (CollectionUtils.isNotEmpty(photoList)) {
for (int i = 0; i < photoList.size(); i++) { for (int i = 0; i < photoList.size(); i++) {
...@@ -47,7 +44,7 @@ public class StorePhotoServiceImpl implements StorePhotoService { ...@@ -47,7 +44,7 @@ public class StorePhotoServiceImpl implements StorePhotoService {
storePhoto.setImageUrl(storePhotoDTO.getImageUrl()); storePhoto.setImageUrl(storePhotoDTO.getImageUrl());
storePhoto.setSort(storePhotoDTO.getSort()); storePhoto.setSort(storePhotoDTO.getSort());
storePhoto.setStatus(GlobalInfo.DATA_STATUS_NORMAL); storePhoto.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
storePhoto.setStoreInfoId(storeId); storePhoto.setStoreInfoId(storeInfoId);
storePhoto.setSort(i); storePhoto.setSort(i);
if (storePhotoDTO.getStorePhotoId() == null) { if (storePhotoDTO.getStorePhotoId() == null) {
storePhoto.setCreateTime(new Date()); storePhoto.setCreateTime(new Date());
...@@ -60,7 +57,7 @@ public class StorePhotoServiceImpl implements StorePhotoService { ...@@ -60,7 +57,7 @@ public class StorePhotoServiceImpl implements StorePhotoService {
} }
@Override @Override
public List<TabStorePhoto> listStorePhoto(Integer enterpriseId, Integer storeId) { public List<TabStorePhoto> listStorePhoto(Integer enterpriseId, Integer storeInfoId) {
return tabStorePhotoMapper.listStorePhoto(enterpriseId, storeId); return tabStorePhotoMapper.listStorePhoto(enterpriseId, storeInfoId);
} }
} }
\ No newline at end of file
Markdown is supported
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