jiangping
2023-08-18 5dfbc4af25ab4f5e8d75f99c6e889b5004a49ef0
server/src/main/resources/mappers/RouteProcedureExtMapper.xml
@@ -453,4 +453,14 @@
    </where>
    order by  `a`.`SORTNUM` asc
  </select>
  <select id="selectStatisticsList" parameterType="doumeemes.dao.ext.dto.QueryRouteProcedureExtDTO" resultMap="RouteProcedureExtListVO">
    SELECT a.*,p.`NAME` AS procedureName
    ,(select sum(b.num) from workorder_record b left join workorder d on b.workorder_id=d.id left join plans c on b.plan_id=c.id where d.status=4 and b.type=1 and b.deleted=0 and c.deleted=0  and b.procedure_id=p.id and c.work_plans_id=#{workPlanId}) as doneNum
    ,(select sum(b.qualified_num) from workorder_record b  left join workorder d on b.workorder_id=d.id  left join plans c on b.plan_id=c.id where d.status=4 and b.type=1 and b.deleted=0 and c.deleted=0  and b.procedure_id=p.id and c.work_plans_id=#{workPlanId}) as qualifiedNum
    ,(select sum(b.num) from plans b where b.deleted=0 and b.work_plans_id=#{workPlanId} and b.procedure_id=p.id) as plansNum
    FROM `route_procedure` `a`
    LEFT JOIN `procedures` `p` ON a.PROCEDURE_ID=p.ID
    where a.ROUTE_ID = #{routeId}
    order by  `a`.`SORTNUM` asc
  </select>
</mapper>