Commit d085da08 by YG8999

首页查询过慢,bug修复

parent 161f230d
...@@ -44,7 +44,7 @@ public class SRoomController extends BaseController ...@@ -44,7 +44,7 @@ public class SRoomController extends BaseController
public TableDataInfo list(SRoom sRoom) public TableDataInfo list(SRoom sRoom)
{ {
startPage(); startPage();
List<SRoomVo> list = sRoomService.selectSRoomList(sRoom); List<SRoom> list = sRoomService.selectSRoomList(sRoom);
return getDataTable(list); return getDataTable(list);
} }
...@@ -56,8 +56,8 @@ public class SRoomController extends BaseController ...@@ -56,8 +56,8 @@ public class SRoomController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SRoom sRoom) public void export(HttpServletResponse response, SRoom sRoom)
{ {
List<SRoomVo> list = sRoomService.selectSRoomList(sRoom); List<SRoom> list = sRoomService.selectSRoomList(sRoom);
ExcelUtil<SRoomVo> util = new ExcelUtil<SRoomVo>(SRoomVo.class); ExcelUtil<SRoom> util = new ExcelUtil<SRoom>(SRoom.class);
util.exportExcel(response, list, "房间数据"); util.exportExcel(response, list, "房间数据");
} }
......
...@@ -46,7 +46,7 @@ public class SRoomController extends BaseController { ...@@ -46,7 +46,7 @@ public class SRoomController extends BaseController {
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SRoom sRoom) { public TableDataInfo list(SRoom sRoom) {
startPage(); startPage();
List<SRoomVo> list = sRoomService.selectSRoomList(sRoom); List<SRoom> list = sRoomService.selectSRoomList(sRoom);
return getDataTable(list); return getDataTable(list);
} }
......
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
...@@ -19,6 +21,7 @@ public class Device extends BaseEntity ...@@ -19,6 +21,7 @@ public class Device extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 设备名称 */ /** 设备名称 */
......
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
...@@ -19,6 +21,7 @@ public class DeviceGateway extends BaseEntity ...@@ -19,6 +21,7 @@ public class DeviceGateway extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 设备名称 */ /** 设备名称 */
......
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
...@@ -19,6 +21,7 @@ public class DeviceLog extends BaseEntity ...@@ -19,6 +21,7 @@ public class DeviceLog extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 主键 */ /** 主键 */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 设备mac */ /** 设备mac */
......
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
...@@ -19,6 +21,7 @@ public class Protocol extends BaseEntity ...@@ -19,6 +21,7 @@ public class Protocol extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 协议ID */ /** 协议ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 协议标题 */ /** 协议标题 */
......
...@@ -2,7 +2,9 @@ package share.system.domain; ...@@ -2,7 +2,9 @@ package share.system.domain;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -20,6 +22,7 @@ public class SCleanRecords extends BaseEntity ...@@ -20,6 +22,7 @@ public class SCleanRecords extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** ID */ /** ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 门店ID */ /** 门店ID */
......
...@@ -4,7 +4,9 @@ import java.io.Serializable; ...@@ -4,7 +4,9 @@ import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
...@@ -19,12 +21,13 @@ import share.common.core.domain.BaseEntity; ...@@ -19,12 +21,13 @@ import share.common.core.domain.BaseEntity;
* @date 2023-09-27 * @date 2023-09-27
*/ */
@Data @Data
public class SConsumer public class SConsumer implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 会员用户ID */ /** 会员用户ID */
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@TableId(type = IdType.AUTO)
private Long id; private Long id;
@ApiModelProperty(value = "用户账号") @ApiModelProperty(value = "用户账号")
......
...@@ -2,6 +2,9 @@ package share.system.domain; ...@@ -2,6 +2,9 @@ package share.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -22,6 +25,7 @@ public class SConsumerCoupon extends BaseEntity ...@@ -22,6 +25,7 @@ public class SConsumerCoupon extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** ID */ /** ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 用户ID */ /** 用户ID */
......
package share.system.domain; package share.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
...@@ -17,6 +20,7 @@ public class SConsumptionRecords extends BaseEntity ...@@ -17,6 +20,7 @@ public class SConsumptionRecords extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** ID */ /** ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 会员用户ID */ /** 会员用户ID */
......
...@@ -2,6 +2,9 @@ package share.system.domain; ...@@ -2,6 +2,9 @@ package share.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
...@@ -21,6 +24,7 @@ public class SCoupon extends BaseEntity ...@@ -21,6 +24,7 @@ public class SCoupon extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 优惠券ID */ /** 优惠券ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 优惠券名称 */ /** 优惠券名称 */
......
...@@ -3,7 +3,9 @@ package share.system.domain; ...@@ -3,7 +3,9 @@ package share.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -27,6 +29,7 @@ public class SOrder extends BaseEntity ...@@ -27,6 +29,7 @@ public class SOrder extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 订单ID */ /** 订单ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 订单流水号 */ /** 订单流水号 */
......
...@@ -2,6 +2,8 @@ package share.system.domain; ...@@ -2,6 +2,8 @@ package share.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
...@@ -21,6 +23,7 @@ public class SPack extends BaseEntity { ...@@ -21,6 +23,7 @@ public class SPack extends BaseEntity {
/** /**
* ID * ID
*/ */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** /**
......
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -22,6 +25,7 @@ public class SRoom extends BaseEntity ...@@ -22,6 +25,7 @@ public class SRoom extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 房间ID */ /** 房间ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 门店ID */ /** 门店ID */
...@@ -107,6 +111,8 @@ public class SRoom extends BaseEntity ...@@ -107,6 +111,8 @@ public class SRoom extends BaseEntity
@TableField(exist = false) @TableField(exist = false)
private Long recordsId; private Long recordsId;
/** 门店名称 */
@TableField(exist = false)
private String storeName;
} }
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
...@@ -20,6 +22,7 @@ public class SRoomPack extends BaseEntity { ...@@ -20,6 +22,7 @@ public class SRoomPack extends BaseEntity {
/** /**
* ID * ID
*/ */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** /**
......
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -21,6 +23,7 @@ public class SStore extends BaseEntity ...@@ -21,6 +23,7 @@ public class SStore extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 门店ID */ /** 门店ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 门店名称 */ /** 门店名称 */
......
package share.system.domain.vo; package share.system.domain.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -27,6 +29,7 @@ public class SOrderVo ...@@ -27,6 +29,7 @@ public class SOrderVo
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 订单ID */ /** 订单ID */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 订单流水号 */ /** 订单流水号 */
......
...@@ -61,4 +61,5 @@ public interface RoomPackMapper extends BaseMapper<SRoomPack> { ...@@ -61,4 +61,5 @@ public interface RoomPackMapper extends BaseMapper<SRoomPack> {
public int deleteRoomPackByIds(Long[] ids); public int deleteRoomPackByIds(Long[] ids);
List<Long> selectPackListByRoomId(Long id); List<Long> selectPackListByRoomId(Long id);
} }
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SRoom; import share.system.domain.SRoom;
import share.system.domain.vo.SRoomVo;
/** /**
* 房间Mapper接口 * 房间Mapper接口
......
...@@ -31,7 +31,7 @@ public interface ISRoomService extends IService<SRoom> ...@@ -31,7 +31,7 @@ public interface ISRoomService extends IService<SRoom>
* @param sRoom 房间 * @param sRoom 房间
* @return 房间集合 * @return 房间集合
*/ */
public List<SRoomVo> selectSRoomList(SRoom sRoom); public List<SRoom> selectSRoomList(SRoom sRoom);
/** /**
* 新增房间 * 新增房间
......
...@@ -3,6 +3,7 @@ package share.system.service.impl; ...@@ -3,6 +3,7 @@ package share.system.service.impl;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -60,9 +61,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -60,9 +61,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
SRoom sRoom = sRoomMapper.selectSRoomById(id); SRoom sRoom = sRoomMapper.selectSRoomById(id);
sRoom.setPackIds(roomPackService.selectPackListByRoomId(id).stream().map(String::valueOf).collect(Collectors.joining(","))); sRoom.setPackIds(roomPackService.selectPackListByRoomId(id).stream().map(String::valueOf).collect(Collectors.joining(",")));
if (Objects.nonNull(sRoom) && sRoom.getId() != null) { if (Objects.nonNull(sRoom) && sRoom.getId() != null) {
return convertVoList(new ArrayList<SRoom>() {{ SRoom room = convertVoList(new ArrayList<SRoom>() {{
add(sRoom); add(sRoom);
}}).get(0); }}).get(0);
SRoomVo sRoomVo = new SRoomVo();
BeanUtils.copyProperties(room, sRoomVo);
return sRoomVo;
} }
return new SRoomVo(); return new SRoomVo();
} }
...@@ -74,7 +78,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -74,7 +78,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
* @return 房间 * @return 房间
*/ */
@Override @Override
public List<SRoomVo> selectSRoomList(SRoom sRoom) { public List<SRoom> selectSRoomList(SRoom sRoom) {
List<SRoom> roomList = sRoomMapper.selectSRoomList(sRoom); List<SRoom> roomList = sRoomMapper.selectSRoomList(sRoom);
roomList.forEach(o -> { roomList.forEach(o -> {
List<Long> roomId = roomPackService.selectPackListByRoomId(o.getId()); List<Long> roomId = roomPackService.selectPackListByRoomId(o.getId());
...@@ -84,23 +88,19 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -84,23 +88,19 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
return convertVoList(roomList); return convertVoList(roomList);
} }
private List<SRoomVo> convertVoList(List<SRoom> roomList) { private List<SRoom> convertVoList(List<SRoom> roomList) {
List<SRoomVo> voList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(roomList)) { if (CollectionUtils.isNotEmpty(roomList)) {
List<Long> storeIds = roomList.stream().map(SRoom::getStoreId).collect(Collectors.toList()); List<Long> storeIds = roomList.stream().map(SRoom::getStoreId).collect(Collectors.toList());
List<Map> storeList = sStoreService.optionList(storeIds); List<Map> storeList = sStoreService.optionList(storeIds);
roomList.stream().forEach(sRoom -> { roomList.stream().forEach(sRoom -> {
SRoomVo vo = new SRoomVo();
BeanUtils.copyProperties(sRoom, vo);
storeList.stream().forEach(store -> { storeList.stream().forEach(store -> {
if (vo.getStoreId().compareTo(Long.parseLong(store.get("id").toString())) == 0) { if (sRoom.getStoreId().compareTo(Long.parseLong(store.get("id").toString())) == 0) {
vo.setStoreName(store.getOrDefault("name", "").toString()); sRoom.setStoreName(store.getOrDefault("name", "").toString());
} }
}); });
voList.add(vo);
}); });
} }
return voList; return roomList;
} }
/** /**
...@@ -148,7 +148,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -148,7 +148,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
@Override @Override
public int updateSRoom(SRoom sRoom) { public int updateSRoom(SRoom sRoom) {
//判断套餐ID //判断套餐ID
if (!sRoom.getPackIds().isEmpty()) { if (!StrUtil.isEmpty(sRoom.getPackIds())) {
//判断套餐ID //判断套餐ID
List<SPack> SPackList = packService.selectPackListByIds(Arrays.asList(sRoom.getPackIds().split(",")).stream().map(Long::valueOf).collect(Collectors.toList())); List<SPack> SPackList = packService.selectPackListByIds(Arrays.asList(sRoom.getPackIds().split(",")).stream().map(Long::valueOf).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(SPackList)) { if (CollectionUtils.isEmpty(SPackList)) {
......
...@@ -231,10 +231,33 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme ...@@ -231,10 +231,33 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
if (CollectionUtils.isNotEmpty(voList)) { if (CollectionUtils.isNotEmpty(voList)) {
List<Long> storeIds = voList.stream().map(SStoreVo::getId).collect(Collectors.toList()); List<Long> storeIds = voList.stream().map(SStoreVo::getId).collect(Collectors.toList());
List<SRoomVo> roomVoList = sRoomService.listByStoreIds(storeIds); List<SRoomVo> roomVoList = sRoomService.listByStoreIds(storeIds);
List<Long> roomIds = new ArrayList<>();
roomVoList.stream().forEach(sRoomVo -> {
roomIds.add(sRoomVo.getId());
});
List<SRoomPack> roomPacks = roomPackMapper.selectBatchIds(roomIds);
List<Long> packIds = new ArrayList<>();
roomPacks.stream().forEach(sRoomPack -> {
packIds.add(sRoomPack.getPackId());
});
List<SPack> packs = packService.selectPackListByIds(packIds);
Map<Long,SPack> map = new HashMap<>();
packs.stream().forEach(sPack -> {
map.put(sPack.getId(), sPack);
});
roomVoList.stream().forEach(sRoomVo -> {
List<SPack> sPacks = new ArrayList<>();
roomPacks.stream().forEach(sRoomPack -> {
if (Long.compare(sRoomVo.getId(), sRoomPack.getRoomId()) == 0) {
sPacks.add(map.get(sRoomPack.getPackId()));
}
});
sRoomVo.setPackList(sPacks);
});
voList.stream().forEach(storeVo -> { voList.stream().forEach(storeVo -> {
storeVo.setRoomVoList(roomVoList.stream().filter(roomVo -> { storeVo.setRoomVoList(roomVoList.stream().filter(roomVo -> {
List<Long> roomId = roomPackMapper.selectPackListByRoomId(roomVo.getId()); // List<Long> roomId = roomPackMapper.selectPackListByRoomId(roomVo.getId());
roomVo.setPackList(packService.selectPackListByIds(roomId)); // roomVo.setPackList(packService.selectPackListByIds(roomId));
if (Long.compare(roomVo.getStoreId(), storeVo.getId()) == 0) { if (Long.compare(roomVo.getStoreId(), storeVo.getId()) == 0) {
return true; return true;
} }
......
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