<?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.jeeplus.test.cw.projectReport.mapper.CwProjectInfoMapper">
    <update id="updateSignById">
        update cw_project_report_new_line set delete_sign = #{sign} where id = #{id}
    </update>
    <update id="updateByReportId">
        update cw_project_report_new_line set report_no = #{reportNo}, report_number = #{reportNumber}
        where report_id = #{reportId}
    </update>
    <update id="updateReportNoByReportId">
        update cw_project_report_new_line set report_no = #{reportNo}
        where report_id = #{reportId}
    </update>
    <delete id="deleteByReportId">
        update cw_project_report_new_line set del_flag = '1' where report_id = #{id}
    </delete>
    <select id="selectIdByReportId" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData">
        select id,report_no from cw_project_report_new_line where report_id = #{id} and del_flag = '0'
    </select>
    <select id="selectByReportId" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData">
        select a.*,cw.name as servedUnitName from cw_project_report_new_line a
        left join cw_work_client_base cw
        on a.served_unit_id = cw.id
        where report_id = #{id} and a.del_flag = '0'
    </select>
    <select id="selectContainDelByReportId" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData">
        select a.*,cw.name as servedUnitName from cw_project_report_new_line a
        left join cw_work_client_base cw
        on a.served_unit_id = cw.id
        where report_id = #{id}
    </select>
    <select id="getReportNo" resultType="java.lang.String">
        select report_no from cw_project_report_cancel where del_flag = '0' order by create_date asc
    </select>
    <select id="selectInfoByReportId" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData">
        select * from cw_project_report_new_line where report_id = #{id} and del_flag = '0'
    </select>
    <select id="selectReportNumberByProjectNo" resultType="java.lang.String">
        SELECT DISTINCT report_number FROM `cw_project_report_new_line` WHERE report_number like CONCAT('%',#{projectNo},'%') ORDER BY report_number desc limit 1
    </select>
    <select id="getById" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData">
        select * from cw_project_report_new_line where id = #{id}
    </select>
    <select id="getId" resultType="java.lang.String">
        select id from cw_project_report_new_line where report_id = #{id} and del_flag = '0'
    </select>
    <select id="getNewLineInfoById" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData">
        select * from cw_project_report_new_line where id = #{reportNewLineId}
    </select>
    <select id="getCountByReportId" resultType="java.lang.Integer">
        select count(*) from cw_project_report_new_line where report_id = #{reportId} and del_flag = '0'
    </select>
    <select id="getByReportId" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData">
        select a.*,cw.name as servedUnitName from cw_project_report_new_line a
        left join cw_work_client_base cw
        on a.served_unit_id = cw.id
        where report_id = #{reportId} and a.del_flag = '0'
    </select>
    <select id="getContainDelByReportId" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData">
        select a.*,cw.name as servedUnitName from cw_project_report_new_line a
        left join cw_work_client_base cw
        on a.served_unit_id = cw.id
        where report_id = #{reportId}
    </select>
    <update id="saveById">
        update cw_project_report_new_line set del_flag = '0' where id = #{id}
    </update>
</mapper>
