Commit 1a0d2321 by zhiwj

门店照片

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