<?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="cn.com.ty.lift.batch.applet.dao.mapper.ContractDataMapper" >

    <!-- 获取时间段内的合同数据 -->
    <select id="getContractDataList" parameterType="cn.com.ty.lift.batch.applet.dao.model.request.CommonRequest"
            resultType="cn.com.ty.lift.batch.applet.dao.model.ContractDataModel">
            select
                c.id as id,
                c.mt_company_id as mtCompanyId,
                c.code as code,
                c.star_date as starDate,
                c.end_date as endDate,
                c.given_date as givenDate,
                c.status as contractStatus,
                c.previous_id as previousId,
                c.moneys as contractMoney,
                pay.plan_money as planMoney,
                pay.work_money as workMoney,
                pay.plan_date as planDate,
                p.project_name as projectName
            from
                contracts c
            left join
                project p
            on
                c.project_id = p.id
            left join
                payment pay
            on
                c.id = pay.contracts_id
            where
                c.given_date <![CDATA[ >= ]]> #{startTimeDateStr}
            and
                c.given_date <![CDATA[ <= ]]> #{endTimeDateStr}
    </select>

</mapper>