提交时间

This commit is contained in:
苏竹红
2024-05-08 11:34:26 +08:00
parent 731c5cc189
commit 2d88827ecb
5 changed files with 42 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ package com.cool.store.dao;
import com.cool.store.entity.LinePayDO;
import com.cool.store.mapper.LinePayMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
@@ -56,12 +57,19 @@ public class LinePayDAO {
}
public Map<Long,LinePayDO> getLinePayByLineIds(List<Long> lineIds) {
if(Objects.isNull(lineIds) || lineIds.size() == 0){
public Map<Long,LinePayDO> getLinePayByLineIds(List<Long> lineIds,Integer payBusinessType) {
if(CollectionUtils.isEmpty(lineIds)){
return new HashMap<>();
}
List<LinePayDO> linePayDO = linePayMapper.getLinePayByLineIds(lineIds);
List<LinePayDO> linePayDO = linePayMapper.getLinePayByLineIds(lineIds,null,payBusinessType);
return linePayDO.stream().collect(Collectors.toMap(LinePayDO::getLineId, linePayDO1 -> linePayDO1, (o, n) -> o));
}
public Map<Long,LinePayDO> getLinePayByShopIds(List<Long> shopIds,Integer payBusinessType) {
if(CollectionUtils.isEmpty(shopIds)){
return new HashMap<>();
}
List<LinePayDO> linePayDO = linePayMapper.getLinePayByLineIds(null,shopIds,payBusinessType);
return linePayDO.stream().collect(Collectors.toMap(LinePayDO::getShopId, linePayDO1 -> linePayDO1, (o, n) -> o));
}
}

View File

@@ -50,7 +50,7 @@ public interface LinePayMapper {
* @param lineIds
* @return
*/
List<LinePayDO> getLinePayByLineIds(@Param("lineIds") List<Long> lineIds);
List<LinePayDO> getLinePayByLineIds(@Param("lineIds") List<Long> lineIds, @Param("shopIds") List<Long> shopIds, @Param("businessType") Integer businessType);
void updateByPidAndLid(@Param("lineId") Long lineId,
@Param("partnerId") String partnerId,

View File

@@ -316,10 +316,20 @@
<select id="getLinePayByLineIds" resultMap="BaseResultMap">
select * from xfsg_line_pay where deleted = 0
<if test="lineIds !=null and lineIds.size>0">
<foreach collection="lineIds" item="lineId" open="and line_id in (" close=")" separator=",">
#{lineId}
</foreach>
</if>
<where>
<if test="businessType!=null">
and pay_business_type = #{businessType}
</if>
<if test="lineIds !=null and lineIds.size>0">
<foreach collection="lineIds" item="lineId" open="and line_id in (" close=")" separator=",">
#{lineId}
</foreach>
</if>
<if test="shopIds !=null and shopIds.size>0">
<foreach collection="shopIds" item="shopId" open="and shop_id in (" close=")" separator=",">
#{shopId}
</foreach>
</if>
</where>
</select>
</mapper>