多个可操作内容时只显示一个订单
This commit is contained in:
parent
bb58e9a074
commit
288b669bef
@ -37,6 +37,7 @@ public class InspectionStepInfo extends Model<InspectionStepInfo> {
|
|||||||
//创建人id
|
//创建人id
|
||||||
private Integer creator;
|
private Integer creator;
|
||||||
//更新时间
|
//更新时间
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
//更新人id
|
//更新人id
|
||||||
private Integer updater;
|
private Integer updater;
|
||||||
|
@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -191,6 +192,8 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
|||||||
// 插入步骤信息
|
// 插入步骤信息
|
||||||
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
|
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
|
||||||
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
|
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
|
||||||
|
inspectionStepInfo.setUpdater(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||||
|
inspectionStepInfo.setUpdateTime(DateUtil.date());
|
||||||
|
|
||||||
//根据projectId查询项目名称
|
//根据projectId查询项目名称
|
||||||
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||||
|
@ -269,56 +269,112 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by ins.start_time desc
|
order by ins.start_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||||
SELECT
|
SELECT *
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
ii.*,
|
ii.*,
|
||||||
iwn.id AS workNodeId,
|
iwn.id AS workNodeId,
|
||||||
iwn.status AS workNodeStatus,
|
iwn.status AS workNodeStatus,
|
||||||
oi.order_no AS orderNo,
|
oi.order_no AS orderNo,
|
||||||
oi.phonenumber AS buyPhone,
|
oi.phonenumber AS buyPhone,
|
||||||
ip.project_name AS projectName,
|
ip.project_name AS projectName,
|
||||||
su.nickname AS leadManName
|
su.nickname AS leadManName,
|
||||||
FROM
|
ROW_NUMBER() OVER (PARTITION BY ii.id ORDER BY iwn.update_time DESC) as rn -- 根据需要调整排序逻辑
|
||||||
|
FROM
|
||||||
inspection_info ii
|
inspection_info ii
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
|
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
order_info oi ON ii.inspection_order_id = oi.id
|
order_info oi ON ii.inspection_order_id = oi.id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
inspection_project ip ON iwn.project_id = ip.id
|
inspection_project ip ON iwn.project_id = ip.id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
system_users su ON ii.lead_man_id = su.id
|
system_users su ON ii.lead_man_id = su.id
|
||||||
<where>
|
<where>
|
||||||
<!-- 车牌号模糊查询 -->
|
<!-- 车牌号模糊查询 -->
|
||||||
<if test="inspectionInfo.carNum != null">
|
<if test="inspectionInfo.carNum != null">
|
||||||
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')
|
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')
|
||||||
</if>
|
</if>
|
||||||
<!-- 待接受 -->
|
<!-- 待接受 -->
|
||||||
<if test="inspectionInfo.status == 1">
|
<if test="inspectionInfo.status == 1">
|
||||||
AND <!-- 工单负责人或角色ID匹配 -->
|
AND <!-- 工单负责人或角色ID匹配 -->
|
||||||
(ii.lead_man_id = #{inspectionInfo.leadManId}
|
(ii.lead_man_id = #{inspectionInfo.leadManId}
|
||||||
OR iwn.role_id IN
|
OR iwn.role_id IN
|
||||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||||
#{roleId}
|
#{roleId}
|
||||||
</foreach>)
|
</foreach>)
|
||||||
AND ii.status = '0'
|
AND ii.status = '0'
|
||||||
AND iwn.status = '0'
|
AND iwn.status = '0'
|
||||||
-- AND ii.now_order_num = iwn.order_num
|
-- AND ii.now_order_num = iwn.order_num
|
||||||
ORDER BY ii.create_time DESC
|
ORDER BY ii.create_time DESC
|
||||||
</if>
|
</if>
|
||||||
<!-- 进行中 -->
|
<!-- 进行中 -->
|
||||||
<if test="inspectionInfo.status == 2">
|
<if test="inspectionInfo.status == 2">
|
||||||
AND ii.status = '0'
|
AND ii.status = '0'
|
||||||
AND iwn.status = '1'
|
AND iwn.status = '1'
|
||||||
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||||
ORDER BY iwn.update_time DESC
|
ORDER BY iwn.update_time DESC
|
||||||
</if>
|
</if>
|
||||||
<!-- 已完成 -->
|
<!-- 已完成 -->
|
||||||
<if test="inspectionInfo.status == 3">
|
<if test="inspectionInfo.status == 3">
|
||||||
AND iwn.status = '2'
|
AND iwn.status = '2'
|
||||||
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||||
ORDER BY iwn.update_time DESC
|
ORDER BY iwn.update_time DESC
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
) AS subquery
|
||||||
|
WHERE rn = 1;
|
||||||
|
<!-- 之前的查询,修改为了一个工单只出现一条,不分项目 -->
|
||||||
|
<!-- SELECT-->
|
||||||
|
<!-- ii.*,-->
|
||||||
|
<!-- iwn.id AS workNodeId,-->
|
||||||
|
<!-- iwn.status AS workNodeStatus,-->
|
||||||
|
<!-- oi.order_no AS orderNo,-->
|
||||||
|
<!-- oi.phonenumber AS buyPhone,-->
|
||||||
|
<!-- ip.project_name AS projectName,-->
|
||||||
|
<!-- su.nickname AS leadManName-->
|
||||||
|
<!-- FROM-->
|
||||||
|
<!-- inspection_info ii-->
|
||||||
|
<!-- LEFT JOIN-->
|
||||||
|
<!-- inspection_work_node iwn ON ii.id = iwn.inspection_info_id-->
|
||||||
|
<!-- LEFT JOIN-->
|
||||||
|
<!-- order_info oi ON ii.inspection_order_id = oi.id-->
|
||||||
|
<!-- LEFT JOIN-->
|
||||||
|
<!-- inspection_project ip ON iwn.project_id = ip.id-->
|
||||||
|
<!-- LEFT JOIN-->
|
||||||
|
<!-- system_users su ON ii.lead_man_id = su.id-->
|
||||||
|
<!-- <where>-->
|
||||||
|
<!-- <!– 车牌号模糊查询 –>-->
|
||||||
|
<!-- <if test="inspectionInfo.carNum != null">-->
|
||||||
|
<!-- AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <!– 待接受 –>-->
|
||||||
|
<!-- <if test="inspectionInfo.status == 1">-->
|
||||||
|
<!-- AND <!– 工单负责人或角色ID匹配 –>-->
|
||||||
|
<!-- (ii.lead_man_id = #{inspectionInfo.leadManId}-->
|
||||||
|
<!-- OR iwn.role_id IN-->
|
||||||
|
<!-- <foreach collection="roleIds" item="roleId" open="(" separator="," close=")">-->
|
||||||
|
<!-- #{roleId}-->
|
||||||
|
<!-- </foreach>)-->
|
||||||
|
<!-- AND ii.status = '0'-->
|
||||||
|
<!-- AND iwn.status = '0'-->
|
||||||
|
<!-- -- AND ii.now_order_num = iwn.order_num-->
|
||||||
|
<!-- ORDER BY ii.create_time DESC-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <!– 进行中 –>-->
|
||||||
|
<!-- <if test="inspectionInfo.status == 2">-->
|
||||||
|
<!-- AND ii.status = '0'-->
|
||||||
|
<!-- AND iwn.status = '1'-->
|
||||||
|
<!-- AND iwn.deal_user_id = #{inspectionInfo.dealUserId}-->
|
||||||
|
<!-- ORDER BY iwn.update_time DESC-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <!– 已完成 –>-->
|
||||||
|
<!-- <if test="inspectionInfo.status == 3">-->
|
||||||
|
<!-- AND iwn.status = '2'-->
|
||||||
|
<!-- AND iwn.deal_user_id = #{inspectionInfo.dealUserId}-->
|
||||||
|
<!-- ORDER BY iwn.update_time DESC-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- </where>-->
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user