<?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.ruoyi.system.mapper.project.BmProjectOrderinfoMapper">
    
    <resultMap type="BmProjectOrderinfo" id="BmProjectOrderinfoResult">
        <result property="id"    column="id"    />
        <result property="bmProjectId"    column="bm_project_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDel"    column="is_del"    />
        <result property="orderDate"    column="order_date"    />
        <result property="investmentType"    column="investment_type"    />
        <result property="isOutInvestment"    column="is_out_investment"    />
        <result property="totInvestment"    column="tot_investment"    />
        <result property="fixedAssets"    column="fixed_assets"    />
        <result property="overseasInvestment"    column="overseas_investment"    />
        <result property="jnswInvestm"    column="jnsw_investm"    />
        <result property="snswInvestm"    column="snsw_investm"    />
        <result property="snxwInvestm"    column="snxw_investm"    />
        <result property="xnInvestm"    column="xn_investm"    />
        <result property="isIndependentLan"    column="is_independent_lan"    />
        <result property="landArea"    column="land_area"    />
        <result property="landAddress"    column="land_address"    />
        <result property="landPhoto"    column="land_photo"    />
        <result property="circulationLand"    column="circulation_land"    />
        <result property="circulationAddres"    column="circulation_addres"    />
        <result property="circulationDoc"    column="circulation_doc"    />
        <result property="circulationPhoto"    column="circulation_photo"    />
        <result property="leasePlantArea"    column="lease_plant_area"    />
        <result property="leasePlantAddress"    column="lease_plant_address"    />
        <result property="leasePlantDoc"    column="lease_plant_doc"    />
        <result property="leasePlantPhoto"    column="lease_plant_photo"    />
        <result property="agreementTot"    column="agreement_tot"    />
        <result property="agreementTax"    column="agreement_tax"    />
        <result property="agreementStartdate"    column="agreement_startdate"    />
        <result property="agreementEnddate"    column="agreement_enddate"    />
        <result property="agreementPartner"    column="agreement_partner"    />
        <result property="partner"    column="partner"    />
        <result property="partnerJob"    column="partner_job"    />
        <result property="agreementUs"    column="agreement_us"    />
        <result property="signUs"    column="sign_us"    />
        <result property="usJob"    column="us_job"    />
        <result property="agreementThird"    column="agreement_third"    />
        <result property="third"    column="third"    />
        <result property="thirdJob"    column="third_job"    />
        <result property="agreementUrl"    column="agreement_url"    />
        <result property="name"    column="name"    />
        <result property="legalRep"    column="legal_rep"    />
        <result property="totMoney"    column="tot_money"    />
        <result property="address"    column="address"    />
        <result property="code"    column="code"    />
        <result property="bussinessUrl"    column="bussiness_url"    />
        <result property="recordName"    column="record_name"    />
        <result property="recordCode"    column="record_code"    />
        <result property="recordTot"    column="record_tot"    />
        <result property="recordTime"    column="record_time"    />
        <result property="recordUrl"    column="record_url"    />
        <result property="contactLeader"    column="contact_leader"    />
        <result property="contactPhone"    column="contact_phone"    />
        <result property="contactCompany"    column="contact_company"    />
        <result property="contactPerson"    column="contact_person"    />
        <result property="contactPersonPhone"    column="contact_person_phone"    />
    </resultMap>

    <sql id="selectBmProjectOrderinfoVo">
        select id, bm_project_id, create_by, create_time, update_by, update_time, is_del, order_date, investment_type, is_out_investment, tot_investment, fixed_assets, overseas_investment, jnsw_investm, snsw_investm, snxw_investm, xn_investm, is_independent_lan, land_area, land_address, land_photo, circulation_land, circulation_addres, circulation_doc, circulation_photo, lease_plant_area, lease_plant_address, lease_plant_doc, lease_plant_photo, agreement_tot, agreement_tax, agreement_startdate, agreement_enddate, agreement_partner, partner,partner_job, agreement_us, sign_us, us_job, agreement_third, third,third_job, agreement_url, name, legal_rep, tot_money, address, code, bussiness_url, record_name, record_code, record_tot, record_time, record_url, contact_leader, contact_phone, contact_company, contact_person, contact_person_phone from bm_project_orderinfo
    </sql>

    <select id="selectBmProjectOrderinfoList" parameterType="BmProjectOrderinfo" resultMap="BmProjectOrderinfoResult">
        <include refid="selectBmProjectOrderinfoVo"/>
        <where>
            is_del = '0'
            <if test="bmProjectId != null "> and bm_project_id = #{bmProjectId}</if>
            <if test="isDel != null "> and is_del = #{isDel}</if>
            <if test="orderDate != null "> and order_date = #{orderDate}</if>
            <if test="investmentType != null  and investmentType != ''"> and investment_type = #{investmentType}</if>
            <if test="isOutInvestment != null  and isOutInvestment != ''"> and is_out_investment = #{isOutInvestment}</if>
            <if test="totInvestment != null "> and tot_investment = #{totInvestment}</if>
            <if test="fixedAssets != null "> and fixed_assets = #{fixedAssets}</if>
            <if test="overseasInvestment != null "> and overseas_investment = #{overseasInvestment}</if>
            <if test="jnswInvestm != null "> and jnsw_investm = #{jnswInvestm}</if>
            <if test="snswInvestm != null "> and snsw_investm = #{snswInvestm}</if>
            <if test="snxwInvestm != null "> and snxw_investm = #{snxwInvestm}</if>
            <if test="xnInvestm != null "> and xn_investm = #{xnInvestm}</if>
            <if test="isIndependentLan != null  and isIndependentLan != ''"> and is_independent_lan = #{isIndependentLan}</if>
            <if test="landArea != null "> and land_area = #{landArea}</if>
            <if test="landAddress != null  and landAddress != ''"> and land_address = #{landAddress}</if>
            <if test="landPhoto != null  and landPhoto != ''"> and land_photo = #{landPhoto}</if>
            <if test="circulationLand != null "> and circulation_land = #{circulationLand}</if>
            <if test="circulationAddres != null  and circulationAddres != ''"> and circulation_addres = #{circulationAddres}</if>
            <if test="circulationDoc != null  and circulationDoc != ''"> and circulation_doc = #{circulationDoc}</if>
            <if test="circulationPhoto != null  and circulationPhoto != ''"> and circulation_photo = #{circulationPhoto}</if>
            <if test="leasePlantArea != null "> and lease_plant_area = #{leasePlantArea}</if>
            <if test="leasePlantAddress != null  and leasePlantAddress != ''"> and lease_plant_address = #{leasePlantAddress}</if>
            <if test="leasePlantDoc != null  and leasePlantDoc != ''"> and lease_plant_doc = #{leasePlantDoc}</if>
            <if test="leasePlantPhoto != null  and leasePlantPhoto != ''"> and lease_plant_photo = #{leasePlantPhoto}</if>
            <if test="agreementTot != null "> and agreement_tot = #{agreementTot}</if>
            <if test="agreementTax != null "> and agreement_tax = #{agreementTax}</if>
            <if test="agreementStartdate != null "> and agreement_startdate = #{agreementStartdate}</if>
            <if test="agreementEnddate != null "> and agreement_enddate = #{agreementEnddate}</if>
            <if test="agreementPartner != null  and agreementPartner != ''"> and agreement_partner = #{agreementPartner}</if>
            <if test="partner != null  and partner != ''"> and partner = #{partner}</if>
            <if test="agreementUs != null  and agreementUs != ''"> and agreement_us = #{agreementUs}</if>
            <if test="signUs != null  and signUs != ''"> and sign_us = #{signUs}</if>
            <if test="agreementThird != null  and agreementThird != ''"> and agreement_third = #{agreementThird}</if>
            <if test="third != null  and third != ''"> and third = #{third}</if>
            <if test="agreementUrl != null  and agreementUrl != ''"> and agreement_url = #{agreementUrl}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="legalRep != null  and legalRep != ''"> and legal_rep = #{legalRep}</if>
            <if test="totMoney != null "> and tot_money = #{totMoney}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="bussinessUrl != null  and bussinessUrl != ''"> and bussiness_url = #{bussinessUrl}</if>
            <if test="recordName != null  and recordName != ''"> and record_name like concat('%', #{recordName}, '%')</if>
            <if test="recordCode != null  and recordCode != ''"> and record_code = #{recordCode}</if>
            <if test="recordTot != null "> and record_tot = #{recordTot}</if>
            <if test="recordTime != null  and recordTime != ''"> and record_time = #{recordTime}</if>
            <if test="recordUrl != null  and recordUrl != ''"> and record_url = #{recordUrl}</if>
            <if test="contactLeader != null  and contactLeader != ''"> and contact_leader = #{contactLeader}</if>
            <if test="contactPhone != null  and contactPhone != ''"> and contact_phone = #{contactPhone}</if>
            <if test="contactCompany != null  and contactCompany != ''"> and contact_company = #{contactCompany}</if>
            <if test="contactPerson != null  and contactPerson != ''"> and contact_person = #{contactPerson}</if>
            <if test="contactPersonPhone != null  and contactPersonPhone != ''"> and contact_person_phone = #{contactPersonPhone}</if>
        </where>
    </select>
    
    <select id="selectBmProjectOrderinfoById" parameterType="Long" resultMap="BmProjectOrderinfoResult">
        <include refid="selectBmProjectOrderinfoVo"/>
        where bm_project_id = #{id} and is_del = '0' limit 1
    </select>
        
    <insert id="insertBmProjectOrderinfo" parameterType="BmProjectOrderinfo" useGeneratedKeys="true" keyProperty="id">
        insert ignore into bm_project_orderinfo
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="bmProjectId != null">bm_project_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="isDel != null">is_del,</if>
            <if test="orderDate != null">order_date,</if>
            <if test="investmentType != null">investment_type,</if>
            <if test="isOutInvestment != null">is_out_investment,</if>
            <if test="totInvestment != null">tot_investment,</if>
            <if test="fixedAssets != null">fixed_assets,</if>
            <if test="overseasInvestment != null">overseas_investment,</if>
            <if test="jnswInvestm != null">jnsw_investm,</if>
            <if test="snswInvestm != null">snsw_investm,</if>
            <if test="snxwInvestm != null">snxw_investm,</if>
            <if test="xnInvestm != null">xn_investm,</if>
            <if test="isIndependentLan != null">is_independent_lan,</if>
            <if test="landArea != null">land_area,</if>
            <if test="landAddress != null">land_address,</if>
            <if test="landPhoto != null">land_photo,</if>
            <if test="circulationLand != null">circulation_land,</if>
            <if test="circulationAddres != null">circulation_addres,</if>
            <if test="circulationDoc != null">circulation_doc,</if>
            <if test="circulationPhoto != null">circulation_photo,</if>
            <if test="leasePlantArea != null">lease_plant_area,</if>
            <if test="leasePlantAddress != null">lease_plant_address,</if>
            <if test="leasePlantDoc != null">lease_plant_doc,</if>
            <if test="leasePlantPhoto != null">lease_plant_photo,</if>
            <if test="agreementTot != null">agreement_tot,</if>
            <if test="agreementTax != null">agreement_tax,</if>
            <if test="agreementStartdate != null">agreement_startdate,</if>
            <if test="agreementEnddate != null">agreement_enddate,</if>
            <if test="agreementPartner != null">agreement_partner,</if>
            <if test="partner != null">partner,</if>
            <if test="partnerJob != null">partner_job,</if>
            <if test="agreementUs != null">agreement_us,</if>
            <if test="signUs != null">sign_us,</if>
            <if test="usJob != null">us_job,</if>
            <if test="agreementThird != null">agreement_third,</if>
            <if test="third != null">third,</if>
            <if test="thirdJob != null">third_job,</if>
            <if test="agreementUrl != null">agreement_url,</if>
            <if test="name != null">name,</if>
            <if test="legalRep != null">legal_rep,</if>
            <if test="totMoney != null">tot_money,</if>
            <if test="address != null">address,</if>
            <if test="code != null">code,</if>
            <if test="bussinessUrl != null">bussiness_url,</if>
            <if test="recordName != null">record_name,</if>
            <if test="recordCode != null">record_code,</if>
            <if test="recordTot != null">record_tot,</if>
            <if test="recordTime != null">record_time,</if>
            <if test="recordUrl != null">record_url,</if>
            <if test="contactLeader != null">contact_leader,</if>
            <if test="contactPhone != null">contact_phone,</if>
            <if test="contactCompany != null">contact_company,</if>
            <if test="contactPerson != null">contact_person,</if>
            <if test="contactPersonPhone != null">contact_person_phone,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="bmProjectId != null">#{bmProjectId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="orderDate != null">#{orderDate},</if>
            <if test="investmentType != null">#{investmentType},</if>
            <if test="isOutInvestment != null">#{isOutInvestment},</if>
            <if test="totInvestment != null">#{totInvestment},</if>
            <if test="fixedAssets != null">#{fixedAssets},</if>
            <if test="overseasInvestment != null">#{overseasInvestment},</if>
            <if test="jnswInvestm != null">#{jnswInvestm},</if>
            <if test="snswInvestm != null">#{snswInvestm},</if>
            <if test="snxwInvestm != null">#{snxwInvestm},</if>
            <if test="xnInvestm != null">#{xnInvestm},</if>
            <if test="isIndependentLan != null">#{isIndependentLan},</if>
            <if test="landArea != null">#{landArea},</if>
            <if test="landAddress != null">#{landAddress},</if>
            <if test="landPhoto != null">#{landPhoto},</if>
            <if test="circulationLand != null">#{circulationLand},</if>
            <if test="circulationAddres != null">#{circulationAddres},</if>
            <if test="circulationDoc != null">#{circulationDoc},</if>
            <if test="circulationPhoto != null">#{circulationPhoto},</if>
            <if test="leasePlantArea != null">#{leasePlantArea},</if>
            <if test="leasePlantAddress != null">#{leasePlantAddress},</if>
            <if test="leasePlantDoc != null">#{leasePlantDoc},</if>
            <if test="leasePlantPhoto != null">#{leasePlantPhoto},</if>
            <if test="agreementTot != null">#{agreementTot},</if>
            <if test="agreementTax != null">#{agreementTax},</if>
            <if test="agreementStartdate != null">#{agreementStartdate},</if>
            <if test="agreementEnddate != null">#{agreementEnddate},</if>
            <if test="agreementPartner != null">#{agreementPartner},</if>
            <if test="partner != null">#{partner},</if>
            <if test="partnerJob != null">#{partnerJob},</if>
            <if test="agreementUs != null">#{agreementUs},</if>
            <if test="signUs != null">#{signUs},</if>
            <if test="usJob != null">#{usJob},</if>
            <if test="agreementThird != null">#{agreementThird},</if>
            <if test="third != null">#{third},</if>
            <if test="thirdJob != null">#{thirdJob},</if>
            <if test="agreementUrl != null">#{agreementUrl},</if>
            <if test="name != null">#{name},</if>
            <if test="legalRep != null">#{legalRep},</if>
            <if test="totMoney != null">#{totMoney},</if>
            <if test="address != null">#{address},</if>
            <if test="code != null">#{code},</if>
            <if test="bussinessUrl != null">#{bussinessUrl},</if>
            <if test="recordName != null">#{recordName},</if>
            <if test="recordCode != null">#{recordCode},</if>
            <if test="recordTot != null">#{recordTot},</if>
            <if test="recordTime != null">#{recordTime},</if>
            <if test="recordUrl != null">#{recordUrl},</if>
            <if test="contactLeader != null">#{contactLeader},</if>
            <if test="contactPhone != null">#{contactPhone},</if>
            <if test="contactCompany != null">#{contactCompany},</if>
            <if test="contactPerson != null">#{contactPerson},</if>
            <if test="contactPersonPhone != null">#{contactPersonPhone},</if>
         </trim>
    </insert>

    <update id="updateBmProjectOrderinfo" parameterType="BmProjectOrderinfo">
        update bm_project_orderinfo
        <trim prefix="SET" suffixOverrides=",">
            <if test="bmProjectId != null">bm_project_id = #{bmProjectId},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="orderDate != null">order_date = #{orderDate},</if>
            <if test="investmentType != null">investment_type = #{investmentType},</if>
            <if test="isOutInvestment != null">is_out_investment = #{isOutInvestment},</if>
            <if test="totInvestment != null">tot_investment = #{totInvestment},</if>
            <if test="fixedAssets != null">fixed_assets = #{fixedAssets},</if>
            <if test="overseasInvestment != null">overseas_investment = #{overseasInvestment},</if>
            <if test="jnswInvestm != null">jnsw_investm = #{jnswInvestm},</if>
            <if test="snswInvestm != null">snsw_investm = #{snswInvestm},</if>
            <if test="snxwInvestm != null">snxw_investm = #{snxwInvestm},</if>
            <if test="xnInvestm != null">xn_investm = #{xnInvestm},</if>
            <if test="isIndependentLan != null">is_independent_lan = #{isIndependentLan},</if>
            <if test="landArea != null">land_area = #{landArea},</if>
            <if test="landAddress != null">land_address = #{landAddress},</if>
            <if test="landPhoto != null">land_photo = #{landPhoto},</if>
            <if test="circulationLand != null">circulation_land = #{circulationLand},</if>
            <if test="circulationAddres != null">circulation_addres = #{circulationAddres},</if>
            <if test="circulationDoc != null">circulation_doc = #{circulationDoc},</if>
            <if test="circulationPhoto != null">circulation_photo = #{circulationPhoto},</if>
            <if test="leasePlantArea != null">lease_plant_area = #{leasePlantArea},</if>
            <if test="leasePlantAddress != null">lease_plant_address = #{leasePlantAddress},</if>
            <if test="leasePlantDoc != null">lease_plant_doc = #{leasePlantDoc},</if>
            <if test="leasePlantPhoto != null">lease_plant_photo = #{leasePlantPhoto},</if>
            <if test="agreementTot != null">agreement_tot = #{agreementTot},</if>
            <if test="agreementTax != null">agreement_tax = #{agreementTax},</if>
            <if test="agreementStartdate != null">agreement_startdate = #{agreementStartdate},</if>
            <if test="agreementEnddate != null">agreement_enddate = #{agreementEnddate},</if>
            <if test="agreementPartner != null">agreement_partner = #{agreementPartner},</if>
            <if test="partner != null">partner = #{partner},</if>
            <if test="partnerJob != null">partner_job = #{partnerJob},</if>
            <if test="agreementUs != null">agreement_us = #{agreementUs},</if>
            <if test="signUs != null">sign_us = #{signUs},</if>
            <if test="usJob != null">us_job = #{usJob},</if>
            <if test="agreementThird != null">agreement_third = #{agreementThird},</if>
            <if test="third != null">third = #{third},</if>
            <if test="thirdJob != null">third_job = #{thirdJob},</if>
            <if test="agreementUrl != null">agreement_url = #{agreementUrl},</if>
            <if test="name != null">name = #{name},</if>
            <if test="legalRep != null">legal_rep = #{legalRep},</if>
            <if test="totMoney != null">tot_money = #{totMoney},</if>
            <if test="address != null">address = #{address},</if>
            <if test="code != null">code = #{code},</if>
            <if test="bussinessUrl != null">bussiness_url = #{bussinessUrl},</if>
            <if test="recordName != null">record_name = #{recordName},</if>
            <if test="recordCode != null">record_code = #{recordCode},</if>
            <if test="recordTot != null">record_tot = #{recordTot},</if>
            <if test="recordTime != null">record_time = #{recordTime},</if>
            <if test="recordUrl != null">record_url = #{recordUrl},</if>
            <if test="contactLeader != null">contact_leader = #{contactLeader},</if>
            <if test="contactPhone != null">contact_phone = #{contactPhone},</if>
            <if test="contactCompany != null">contact_company = #{contactCompany},</if>
            <if test="contactPerson != null">contact_person = #{contactPerson},</if>
            <if test="contactPersonPhone != null">contact_person_phone = #{contactPersonPhone},</if>
        </trim>
        where id = #{id}
    </update>

<!--    <delete id="deleteBmProjectOrderinfoById" parameterType="Long">
        delete from bm_project_orderinfo where id = #{id}
    </delete>-->

    <update id="deleteBmProjectOrderinfoById" parameterType="Long">
        update  bm_project_orderinfo set is_del = '1' where id = #{id}
    </update>

<!--    <delete id="deleteBmProjectOrderinfoByIds" parameterType="String">
        delete from bm_project_orderinfo where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>-->

    <delete id="deleteBmProjectOrderinfoByIds" parameterType="String">
        update  bm_project_orderinfo set is_del = '1' where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>