<?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="org.springblade.modules.project.mapper.ProjectInvestPlanMapper">
    <update id="updateAllInvestYearAllByProjectId">
        update d_project_invest_plan set invest_year_all = #{finalInvestYearAllToTal} where is_deleted = 0 and project_id = #{id}
    </update>

    <select id="getYearAllProject" resultType="org.springblade.modules.project.pojo.vo.ProjectInvestPlanVO2">
        select *,
               (select duty_unit from d_project_info dpi where dpi.id = dpip.project_id) as dutyUnit,
               (select project_type from d_project_info dpi where dpi.id = dpip.project_id) as projectType,
               (select name from d_project_info dpi where dpi.id = dpip.project_id) as name
        from d_project_invest_plan dpip
        where is_deleted = 0 and plan_year = #{year}
    </select>
    <select id="getYearAllByProjectId" resultType="java.math.BigDecimal">
        select invest_year_all from d_project_invest_plan where is_deleted = 0 and project_id = #{id}  limit 1
    </select>
</mapper>
