优化查看工单详情速度

This commit is contained in:
Vinjor 2024-11-12 11:24:12 +08:00
parent ed6140bbd9
commit 26cc95e827
4 changed files with 40 additions and 14 deletions

View File

@ -85,12 +85,10 @@
SELECT
<include refid="baseCarMainColumn"></include>,
bcb.brand_name AS brandStr,
bcb.logo_img AS logoImg,
bcm.model_name AS modelStr
bcb.logo_img AS logoImg
FROM
`base_car_main` tbcm
LEFT JOIN base_car_brand bcb ON bcb.deleted = 0 AND tbcm.car_brand = bcb.id
LEFT JOIN base_car_model bcm ON bcm.deleted = 0 AND tbcm.car_model = bcm.id
WHERE
tbcm.deleted = 0
AND

View File

@ -26,8 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.BaseConstants.REPAIR_RECORD_TYPE_RECORD;
/**
* 维修记录 Service 实现类
*
@ -106,10 +104,8 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
} else {
item.setRoleName(getRoleName(userRoleMap.get(item.getDealUserId())));
}
List<RepairRecordsItem> itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen());
item.setItemList(itemList);
//相对路径按照分隔
item.setImages(itemList.stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(",")));
item.setImages(item.getItemList().stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(",")));
});
return list;
}

View File

@ -342,7 +342,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
}
//查用户信息
CustomerMain customerInfo = customerService.getCustomerById(dlRepairTickets.getUserId());
CustomerMain customerInfo = customerService.getById(dlRepairTickets.getUserId());
result.setCustomerInfo(customerInfo);
// 查工单子表
List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));

View File

@ -8,14 +8,43 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="queryRepairRecords" resultType="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
<resultMap id="baseResultMap" type="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
<id column="id" property="id"/>
<result column="ticket_id" property="ticketId"/>
<result column="repair_item_id" property="repairItemId"/>
<result column="type" property="type"/>
<result column="remark" property="remark"/>
<result column="deal_user_name" property="dealUserName"/>
<result column="deal_user_id" property="dealUserId"/>
<result column="creator" property="creator"/>
<result column="create_time" property="createTime"/>
<collection property="itemList" ofType="cn.iocoder.yudao.module.base.entity.RepairRecordsItem" columnPrefix="item_">
<id column="id" property="id"/>
<result column="record_id" property="recordId"/>
<result column="ticket_id" property="ticketId"/>
<result column="repair_item_id" property="repairItemId"/>
<result column="remark" property="remark"/>
<result column="image" property="image"/>
<result column="is_open" property="isOpen"/>
<result column="create_time" property="createTime"/>
</collection>
</resultMap>
<select id="queryRepairRecords" resultMap="baseResultMap">
SELECT main.*,
drt.item_name AS projectName
drt.item_name AS projectName,
drri.id AS item_id,
drri.record_id AS item_record_id,
drri.ticket_id AS item_ticket_id,
drri.repair_item_id AS item_repair_item_id,
drri.remark AS item_remark,
drri.image AS item_image,
drri.is_open AS item_is_open,
drri.create_time AS item_create_time
FROM dl_repair_records main
LEFT JOIN dl_repair_titem drt ON main.repair_item_id = drt.id AND drt.deleted = 0
LEFT JOIN dl_repair_records_item drri ON main.id = drri.record_id
<where>
main.deleted = '0'
main.deleted = '0' AND drri.deleted = '0'
<if test="entity.ticketId != null and entity.ticketId != ''">
AND main.ticket_id = #{entity.ticketId}
</if>
@ -28,8 +57,11 @@
<if test="entity.type != null and entity.type != ''">
AND main.type = #{entity.type}
</if>
<if test="entity.isOpen != null and entity.isOpen != ''">
AND drri.is_open = #{entity.type}
</if>
</where>
order by main.create_time desc
order by main.create_time desc,drri.create_time
</select>
<select id="selectNowRepairByTicketId" resultType="java.util.Map">
SELECT