<?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.jeecg.modules.financeManage.mapper.FdIncomeItemMapper">

    <update id="updateDelFlagByIncomeId">
        update fd_income_item set del_flag='1' where income_id=#{incomeId}
    </update>

    <select id="exportAllItemBySettlementStatus" resultType="org.jeecg.modules.financeManage.entity.FdIncomeItem">
        SELECT
            fii.*,
            fi.contract_name,
            fi.curstomer_name
        FROM
            fd_income_item fii
            LEFT JOIN fd_income fi ON fii.income_id = fi.id
        WHERE
            fii.del_flag = '0'
            AND fi.del_flag = '0'
            AND fi.settlement_status_id = '1'
        ORDER BY
            fi.create_time DESC,
            fii.sort
    </select>
</mapper>