<?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.dayou.mapper.MajorTargetMapper">

    <update id="updateSubReportNo" parameterType="com.dayou.vo.IdNameVO">
        <foreach collection="list" index="index" item="item" separator=";">
            update major_target set report_no = #{item.name} where id = #{item.id} and deleted = 0
        </foreach>
    </update>

    <update id="updateSubStatementNo" parameterType="com.dayou.vo.IdNameVO">
        <foreach collection="list" index="index" item="item" separator=";">
            update major_target set statement_no = #{item.name} where id = #{item.id} and deleted = 0
        </foreach>
    </update>

    <update id="updateSubLetterNo" parameterType="com.dayou.vo.IdNameVO">
        <foreach collection="list" index="index" item="item" separator=";">
            update major_target set letter_no = #{item.name} where id = #{item.id} and deleted = 0
        </foreach>
    </update>

    <update id="updateMainLetterNo">
        update major_target set letter_no = #{mainNumber} where major_id = #{businessId} and deleted = 0;
    </update>

    <update id="updateMainReportNo">
        update major_target set report_no = #{mainNumber} where major_id = #{businessId} and deleted = 0;
    </update>

    <update id="updateMainStatementNo">
        update major_target set statement_no = #{mainNumber} where major_id = #{businessId} and deleted = 0;
    </update>

    <update id="cleanSubReportNo">
        update major_target set report_no = null where major_id = #{businessId} and deleted = 0;
    </update>

    <update id="xCleanSubReportNo">
        update major_target set report_no = null where major_id = #{businessId} and report_no = #{businessSubId} and deleted = 0;
    </update>

    <select id="getSubReportNo" parameterType="java.lang.Long" resultType="java.lang.String">
        select distinct report_no from major_target where major_id = #{businessId} and deleted = 0 and report_no is not null
    </select>
</mapper>
