<?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.jkcredit.invoice.mapper.waybill.WayBillSplitInfoMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.jkcredit.invoice.model.entity.waybill.NoCarWayBillSplitInfo">
        <id column="id" property="id"/>
        <result column="waybillNum" property="waybillNum"/>
        <result column="orgWaybillNum" property="orgWaybillNum"/>
        <result column="waybillStartTime" property="waybillStartTime"/>
        <result column="waybillEndTime" property="waybillEndTime"/>
        <result column="waybillstatus" property="waybillstatus"/>
    </resultMap>

    <sql id="baseSql">
         id,
         waybillNum,
         orgWaybillNum,
         waybillStartTime,
         waybillEndTime,
         waybillstatus
    </sql>
    <insert id="batchInsert" parameterType="java.util.List" >
        insert into t_waybill_split_info (
             waybillNum,
             orgWaybillNum,
             waybillStartTime,
             waybillEndTime,
             waybillstatus
        )
        values
        <foreach collection="list" separator="," item="item">
            ( #{item.waybillNum,jdbcType=VARCHAR}, #{item.orgWaybillNum,jdbcType=VARCHAR},
            #{item.waybillStartTime,jdbcType=VARCHAR}, #{item.waybillEndTime,jdbcType=VARCHAR}, #{item.waybillstatus,jdbcType=INTEGER}
            )
        </foreach>

    </insert>


  <select id="selectNoCarWayBillSplitInfosByOrgNum" parameterType="java.lang.String" resultMap="BaseResultMap">
      select <include refid="baseSql" /> from t_waybill_split_info where orgWaybillNum=#{wayBillNum,jdbcType=VARCHAR}
  </select>
   <update id="updateStatusById" parameterType="java.util.Map">
       UPDATE t_waybill_split_info set waybillstatus = #{waybillstatus} where id = #{id}
   </update>
</mapper>
