<?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.zfire.jiasm.syncdata.dao.mapper.ReAppointmentOrderMapper">

    <select id="getReAppointment" parameterType="com.zfire.jiasm.syncdata.parameter.ReAppointment" resultType="com.zfire.jiasm.syncdata.plus.entity.ItfTblAzAssignAppointmentUpload">
        select a.order_base_id as worker_order_no,UNIX_TIMESTAMP(a.create_time) as fa_order_install_operating_log_id,
               UNIX_TIMESTAMP(a.create_time) as id,UNIX_TIMESTAMP(a.create_time) as fkid,'guangfo' as created_by,
               a.create_time as created_date,'guangfo' as last_modified_by,a.create_time as last_modified_date,
               case a.examine_status when 'OK' then  a.new_appointment_time else a.old_appointment_time end as kssj,
               case a.examine_status when 'OK' then  a.new_appointment_end_time else a.old_appointment_end_time end as jssj,
                    a.create_by as czren,
               b.pgguid,a.create_time as czsj,a.re_type as leix,a.re_type as reason,'' as beiz
        from order_re_appointment a
                 left join order_base b on b.id = a.order_base_id
        where a.order_base_id = #{request.orderNo} and a.id = #{request.id}
    </select>


    <select id="getAppointment" parameterType="com.zfire.jiasm.syncdata.parameter.ReAppointment" resultType="com.zfire.jiasm.syncdata.plus.entity.ItfTblAssignAppointmentUpload">
        select a.order_base_id as worker_order_no,a.out_id as fa_order_repair_operating_log_id,
               UNIX_TIMESTAMP(a.create_time) as id,'guangfo' as created_by,
               a.create_time as created_date,'guangfo' as last_modified_by,a.create_time as last_modified_date,
               case a.examine_status when 'OK' then  a.new_appointment_time else a.old_appointment_time end as kssj,
               case a.examine_status when 'OK' then  a.new_appointment_end_time else a.old_appointment_end_time end as jssj,
               a.create_by as czren,b.pgid,a.create_time as czsj,a.re_type as leix,a.re_type as reason,'' as beiz
        from order_re_appointment a
                 left join order_base b on b.id = a.order_base_id
        where a.order_base_id = #{request.orderNo} and a.id = #{request.id}
    </select>




</mapper>
