Commit 7c5f8f73 by zhiwj

修改批量错误

parent 91f1ba54
......@@ -67,4 +67,6 @@ public interface TabStoreMapper {
List<Integer> listStoreIdByFromEnterpriseId(@Param("fromEnterpriseId") Integer fromEnterpriseId);
int cancelAuthStore(@Param("storeInfoIdList") List<Integer> storeInfoIdList, @Param("toEnterpriseId") Integer toEnterpriseId);
List<Integer> listStoreInfoIdByStoreIds(@Param("ids") List<Integer> ids, @Param("enterpriseId") Integer enterpriseId);
}
\ No newline at end of file
package com.gic.store.service;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreInfoDTO;
import com.gic.store.dto.StoreSearchDBDTO;
import com.gic.store.entity.TabStoreInfo;
import com.github.pagehelper.Page;
import java.util.List;
......@@ -96,4 +94,6 @@ public interface StoreService {
int cancelAuthStore(List<Integer> storeInfoIdList, Integer toEnterpriseId);
Integer getStoreOwnerByStoreInfoId(Integer enterpriseId, Integer storeInfoId);
String listStoreInfoIdByStoreIds(String storeIds, Integer enterpriseId);
}
......@@ -23,9 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author zhiwj
......@@ -432,4 +432,11 @@ public class StoreServiceImpl implements StoreService {
return this.tabStoreInfoMapper.getStoreOwnerByStoreInfoId(enterpriseId, storeInfoId);
}
@Override
public String listStoreInfoIdByStoreIds(String storeIds, Integer enterpriseId) {
List<Integer> list = Stream.of(storeIds.split(GlobalInfo.FLAG_COMMA)).map(Integer::valueOf).collect(Collectors.toList());
List<Integer> ids = tabStoreMapper.listStoreInfoIdByStoreIds(list, enterpriseId);
return Optional.ofNullable(ids).orElse(Collections.emptyList()).stream().map(String::valueOf).reduce((x,y)-> x + GlobalInfo.FLAG_COMMA + y).orElse("");
}
}
......@@ -474,7 +474,11 @@ public class StoreApiServiceImpl implements StoreApiService {
}
int i = 0;
try {
i = storeStrtegyMap.get(type).bulkUpdateStore(storeIds, enterpriseId, value, storeService);
String storeInfoIds = storeService.listStoreInfoIdByStoreIds(storeIds, enterpriseId);
if (StringUtils.isBlank(storeInfoIds)) {
return ServiceResponse.success();
}
i = storeStrtegyMap.get(type).bulkUpdateStore(storeInfoIds, enterpriseId, value, storeService);
List<Integer> storeIdList = new ArrayList<>();
if ("all".equals(storeIds)) {
this.removeCache(enterpriseId);
......
......@@ -182,4 +182,14 @@
#{storeInfoId}
</foreach>
</update>
<select id="listStoreInfoIdByStoreIds" resultType="java.lang.Integer">
select store_info_id
from tab_store where own_type = 0 and enterprise_id = #{enterpriseId}
<if test="null != ids and ids.size > 0">
and store_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ 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