解决任务分析中的景区映射问题
This commit is contained in:
parent
593c534cfc
commit
b0f3d7e066
@ -10,6 +10,7 @@ import com.aircraft.modules.order.service.IOrderDetailService;
|
||||
import com.aircraft.modules.order.service.OrderDetailAnalysisService;
|
||||
import com.aircraft.modules.route.domain.CpRoute;
|
||||
import com.aircraft.modules.route.mapper.CpRouteMapper;
|
||||
import com.aircraft.modules.system.domain.EmScenic;
|
||||
import com.aircraft.modules.system.mapper.EmScenicMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -523,8 +524,12 @@ public class OrderDetailAnalysisServiceImpl implements OrderDetailAnalysisServic
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 批量查询景区名称
|
||||
Map<Long, String> scenicNameMap = emScenicMapper.getScenicNameMap(new ArrayList<>(scenicIds));
|
||||
|
||||
Map<Long, String> scenicNameMap = new HashMap<>();
|
||||
if (!scenicIds.isEmpty()) {
|
||||
List<EmScenic> scenics = emScenicMapper.listByIds(new ArrayList<>(scenicIds));
|
||||
scenicNameMap = scenics.stream()
|
||||
.collect(Collectors.toMap(EmScenic::getId, EmScenic::getName, (existing, replacement) -> existing));
|
||||
}
|
||||
// 4. 组装结果
|
||||
for (Map.Entry<Long, Long> entry : routeCountMap.entrySet()) {
|
||||
Long routeId = entry.getKey();
|
||||
@ -553,7 +558,6 @@ public class OrderDetailAnalysisServiceImpl implements OrderDetailAnalysisServic
|
||||
result.add(stat);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -36,4 +36,6 @@ public interface EmScenicMapper extends BaseMapper<EmScenic> {
|
||||
List<AreaNumStatisVo> countByAreaId();
|
||||
|
||||
Map<Long, String> getScenicNameMap(ArrayList<Long> scenicIds);
|
||||
|
||||
List<EmScenic> listByIds(ArrayList<Long> ids);
|
||||
}
|
||||
|
@ -1,6 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.aircraft.modules.system.mapper.EmAreaMapper">
|
||||
<!-- 基础ResultMap定义,全面映射EmScenic实体类字段 -->
|
||||
<resultMap id="BaseResultMap" type="com.aircraft.modules.system.domain.EmScenic">
|
||||
<id column="id" property="id" jdbcType="BIGINT" />
|
||||
<result column="area_id" property="areaId" jdbcType="BIGINT" />
|
||||
<result column="name" property="name" jdbcType="VARCHAR" />
|
||||
<result column="people_num" property="peopleNum" jdbcType="INTEGER" />
|
||||
<result column="remark" property="remark" jdbcType="VARCHAR" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
||||
<result column="price" property="price" jdbcType="DECIMAL" />
|
||||
<result column="create_by" property="createBy" jdbcType="VARCHAR" />
|
||||
<result column="update_by" property="updateBy" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findByName" resultType="com.aircraft.modules.system.domain.EmArea" parameterType="java.lang.String">
|
||||
SELECT id,
|
||||
@ -34,4 +47,12 @@
|
||||
</foreach>
|
||||
AND del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="listByIds" resultMap="BaseResultMap">
|
||||
SELECT * FROM em_scenic WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND del_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user