<?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.bid.mapper.BidCompanyMapper">
    
    <resultMap type="BidCompany" id="BidCompanyResult">
        <result property="id"    column="id"    />
        <result property="companyId"    column="companyId"    />
        <result property="tenantCode"    column="tenant_code"    />
        <result property="companyName"    column="company_name"    />
        <result property="accountName"    column="account_name"    />
        <result property="accountBank"    column="account_bank"    />
        <result property="bankAddress"    column="bank_address"    />
        <result property="annex"    column="annex"    />
        <result property="bankAccount"    column="bank_account"    />
        <result property="bankNo"    column="bank_no"    />
        <result property="bankPhone"    column="bank_phone"    />
        <result property="trueName"    column="trueName"    />
        <result property="position"    column="position"    />
        <result property="sex"    column="sex"    />
        <result property="idPhpto"    column="id_phpto"    />
        <result property="idNumber"    column="id_number"    />
        <result property="birthday"    column="birthday"    />
        <result property="idCardStart"    column="id_card_start"    />
        <result property="idCardEnd"    column="id_card_end"    />
        <result property="maxProgress"    column="max_progress"    />
        <result property="businessId"    column="business_id"    />
        <result property="phoneNumber"    column="phone_number"    />
        <result property="socialCode"    column="social_code"    />
        <result property="nature"    column="nature"    />
        <result property="authority"    column="authority"    />
        <result property="startTime"    column="startTime"    />
        <result property="email"    column="email"    />
        <result property="businessLicense"    column="business_license"    />
        <result property="legalRepresentative"    column="legal_representative"    />
        <result property="registeredCapital"    column="registered_capital"    />
        <result property="address"    column="address"    />
        <result property="fullAddress"    column="full_address"    />
        <result property="registeredTime"    column="registered_time"    />
        <result property="businessStart"    column="business_start"    />
        <result property="businessEnd"    column="business_end"    />
        <result property="businessScope"    column="business_scope"    />
        <result property="companyBasicId"    column="company_basic_id"    />
        <result property="enterpriseSize"    column="enterprise_size"    />
        <result property="industry"    column="industry"    />
        <result property="website"    column="website"    />
        <result property="contactPhone"    column="contact_phone"    />
        <result property="postcode"    column="postcode"    />
        <result property="fax"    column="fax"    />
        <result property="securityLicense"    column="security_license"    />
        <result property="securityStart"    column="security_start"    />
        <result property="securityEnd"    column="security_end"    />
        <result property="structure"    column="structure"    />
        <result property="companyProfile"    column="company_profile"    />
        <result property="softPowerText"    column="soft_power_text"    />
        <result property="softPowerImg"    column="soft_power_img"    />
    </resultMap>

    <sql id="selectBidCompanyVo">
        select id, companyId, tenant_code, company_name, account_name, account_bank, bank_address, annex, bank_account, bank_no, bank_phone, trueName, position, sex, id_phpto, id_number, birthday, id_card_start, id_card_end, max_progress, business_id, phone_number, social_code, nature, authority, startTime, email, business_license, legal_representative, registered_capital, address, full_address, registered_time, business_start, business_end, business_scope, company_basic_id, enterprise_size, industry, website, contact_phone, postcode, fax, security_license, security_start, security_end, structure, company_profile, soft_power_text, soft_power_img from bid_company
    </sql>

    <select id="selectBidCompanyList" parameterType="BidCompany" resultMap="BidCompanyResult">
        <include refid="selectBidCompanyVo"/>
        <where>  
            <if test="companyId != null  and companyId != ''"> and companyId = #{companyId}</if>
            <if test="tenantCode != null  and tenantCode != ''"> and tenant_code = #{tenantCode}</if>
            <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
            <if test="accountName != null  and accountName != ''"> and account_name like concat('%', #{accountName}, '%')</if>
            <if test="accountBank != null  and accountBank != ''"> and account_bank = #{accountBank}</if>
            <if test="bankAddress != null  and bankAddress != ''"> and bank_address = #{bankAddress}</if>
            <if test="annex != null  and annex != ''"> and annex = #{annex}</if>
            <if test="bankAccount != null  and bankAccount != ''"> and bank_account = #{bankAccount}</if>
            <if test="bankNo != null  and bankNo != ''"> and bank_no = #{bankNo}</if>
            <if test="bankPhone != null  and bankPhone != ''"> and bank_phone = #{bankPhone}</if>
            <if test="trueName != null  and trueName != ''"> and trueName like concat('%', #{trueName}, '%')</if>
            <if test="position != null  and position != ''"> and position = #{position}</if>
            <if test="sex != null  and sex != ''"> and sex = #{sex}</if>
            <if test="idPhpto != null  and idPhpto != ''"> and id_phpto = #{idPhpto}</if>
            <if test="idNumber != null  and idNumber != ''"> and id_number = #{idNumber}</if>
            <if test="birthday != null "> and birthday = #{birthday}</if>
            <if test="idCardStart != null "> and id_card_start = #{idCardStart}</if>
            <if test="idCardEnd != null "> and id_card_end = #{idCardEnd}</if>
            <if test="maxProgress != null  and maxProgress != ''"> and max_progress = #{maxProgress}</if>
            <if test="businessId != null  and businessId != ''"> and business_id = #{businessId}</if>
            <if test="phoneNumber != null  and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
            <if test="socialCode != null  and socialCode != ''"> and social_code = #{socialCode}</if>
            <if test="nature != null  and nature != ''"> and nature = #{nature}</if>
            <if test="authority != null  and authority != ''"> and authority = #{authority}</if>
            <if test="startTime != null  and startTime != ''"> and startTime = #{startTime}</if>
            <if test="email != null  and email != ''"> and email = #{email}</if>
            <if test="businessLicense != null  and businessLicense != ''"> and business_license = #{businessLicense}</if>
            <if test="legalRepresentative != null  and legalRepresentative != ''"> and legal_representative = #{legalRepresentative}</if>
            <if test="registeredCapital != null  and registeredCapital != ''"> and registered_capital = #{registeredCapital}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="fullAddress != null  and fullAddress != ''"> and full_address = #{fullAddress}</if>
            <if test="registeredTime != null "> and registered_time = #{registeredTime}</if>
            <if test="businessStart != null "> and business_start = #{businessStart}</if>
            <if test="businessEnd != null "> and business_end = #{businessEnd}</if>
            <if test="businessScope != null  and businessScope != ''"> and business_scope = #{businessScope}</if>
            <if test="companyBasicId != null  and companyBasicId != ''"> and company_basic_id = #{companyBasicId}</if>
            <if test="enterpriseSize != null  and enterpriseSize != ''"> and enterprise_size = #{enterpriseSize}</if>
            <if test="industry != null  and industry != ''"> and industry = #{industry}</if>
            <if test="website != null  and website != ''"> and website = #{website}</if>
            <if test="contactPhone != null  and contactPhone != ''"> and contact_phone = #{contactPhone}</if>
            <if test="postcode != null  and postcode != ''"> and postcode = #{postcode}</if>
            <if test="fax != null  and fax != ''"> and fax = #{fax}</if>
            <if test="securityLicense != null  and securityLicense != ''"> and security_license = #{securityLicense}</if>
            <if test="securityStart != null "> and security_start = #{securityStart}</if>
            <if test="securityEnd != null "> and security_end = #{securityEnd}</if>
            <if test="structure != null  and structure != ''"> and structure = #{structure}</if>
            <if test="companyProfile != null  and companyProfile != ''"> and company_profile = #{companyProfile}</if>
            <if test="softPowerText != null  and softPowerText != ''"> and soft_power_text = #{softPowerText}</if>
            <if test="softPowerImg != null  and softPowerImg != ''"> and soft_power_img = #{softPowerImg}</if>
        </where>
    </select>
    
    <select id="selectBidCompanyById" parameterType="Long" resultMap="BidCompanyResult">
        <include refid="selectBidCompanyVo"/>
        where id = #{id}
    </select>

    <insert id="insertBidCompany" parameterType="BidCompany" useGeneratedKeys="true" keyProperty="id">
        insert into bid_company
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="companyId != null">companyId,</if>
            <if test="tenantCode != null">tenant_code,</if>
            <if test="companyName != null">company_name,</if>
            <if test="accountName != null">account_name,</if>
            <if test="accountBank != null">account_bank,</if>
            <if test="bankAddress != null">bank_address,</if>
            <if test="annex != null">annex,</if>
            <if test="bankAccount != null">bank_account,</if>
            <if test="bankNo != null">bank_no,</if>
            <if test="bankPhone != null">bank_phone,</if>
            <if test="trueName != null">trueName,</if>
            <if test="position != null">position,</if>
            <if test="sex != null">sex,</if>
            <if test="idPhpto != null">id_phpto,</if>
            <if test="idNumber != null">id_number,</if>
            <if test="birthday != null">birthday,</if>
            <if test="idCardStart != null">id_card_start,</if>
            <if test="idCardEnd != null">id_card_end,</if>
            <if test="maxProgress != null">max_progress,</if>
            <if test="businessId != null">business_id,</if>
            <if test="phoneNumber != null">phone_number,</if>
            <if test="socialCode != null">social_code,</if>
            <if test="nature != null">nature,</if>
            <if test="authority != null">authority,</if>
            <if test="startTime != null">startTime,</if>
            <if test="email != null">email,</if>
            <if test="businessLicense != null">business_license,</if>
            <if test="legalRepresentative != null">legal_representative,</if>
            <if test="registeredCapital != null">registered_capital,</if>
            <if test="address != null">address,</if>
            <if test="fullAddress != null">full_address,</if>
            <if test="registeredTime != null">registered_time,</if>
            <if test="businessStart != null">business_start,</if>
            <if test="businessEnd != null">business_end,</if>
            <if test="businessScope != null">business_scope,</if>
            <if test="companyBasicId != null">company_basic_id,</if>
            <if test="enterpriseSize != null">enterprise_size,</if>
            <if test="industry != null">industry,</if>
            <if test="website != null">website,</if>
            <if test="contactPhone != null">contact_phone,</if>
            <if test="postcode != null">postcode,</if>
            <if test="fax != null">fax,</if>
            <if test="securityLicense != null">security_license,</if>
            <if test="securityStart != null">security_start,</if>
            <if test="securityEnd != null">security_end,</if>
            <if test="structure != null">structure,</if>
            <if test="companyProfile != null">company_profile,</if>
            <if test="softPowerText != null">soft_power_text,</if>
            <if test="softPowerImg != null">soft_power_img,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="companyId != null">#{companyId},</if>
            <if test="tenantCode != null">#{tenantCode},</if>
            <if test="companyName != null">#{companyName},</if>
            <if test="accountName != null">#{accountName},</if>
            <if test="accountBank != null">#{accountBank},</if>
            <if test="bankAddress != null">#{bankAddress},</if>
            <if test="annex != null">#{annex},</if>
            <if test="bankAccount != null">#{bankAccount},</if>
            <if test="bankNo != null">#{bankNo},</if>
            <if test="bankPhone != null">#{bankPhone},</if>
            <if test="trueName != null">#{trueName},</if>
            <if test="position != null">#{position},</if>
            <if test="sex != null">#{sex},</if>
            <if test="idPhpto != null">#{idPhpto},</if>
            <if test="idNumber != null">#{idNumber},</if>
            <if test="birthday != null">#{birthday},</if>
            <if test="idCardStart != null">#{idCardStart},</if>
            <if test="idCardEnd != null">#{idCardEnd},</if>
            <if test="maxProgress != null">#{maxProgress},</if>
            <if test="businessId != null">#{businessId},</if>
            <if test="phoneNumber != null">#{phoneNumber},</if>
            <if test="socialCode != null">#{socialCode},</if>
            <if test="nature != null">#{nature},</if>
            <if test="authority != null">#{authority},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="email != null">#{email},</if>
            <if test="businessLicense != null">#{businessLicense},</if>
            <if test="legalRepresentative != null">#{legalRepresentative},</if>
            <if test="registeredCapital != null">#{registeredCapital},</if>
            <if test="address != null">#{address},</if>
            <if test="fullAddress != null">#{fullAddress},</if>
            <if test="registeredTime != null">#{registeredTime},</if>
            <if test="businessStart != null">#{businessStart},</if>
            <if test="businessEnd != null">#{businessEnd},</if>
            <if test="businessScope != null">#{businessScope},</if>
            <if test="companyBasicId != null">#{companyBasicId},</if>
            <if test="enterpriseSize != null">#{enterpriseSize},</if>
            <if test="industry != null">#{industry},</if>
            <if test="website != null">#{website},</if>
            <if test="contactPhone != null">#{contactPhone},</if>
            <if test="postcode != null">#{postcode},</if>
            <if test="fax != null">#{fax},</if>
            <if test="securityLicense != null">#{securityLicense},</if>
            <if test="securityStart != null">#{securityStart},</if>
            <if test="securityEnd != null">#{securityEnd},</if>
            <if test="structure != null">#{structure},</if>
            <if test="companyProfile != null">#{companyProfile},</if>
            <if test="softPowerText != null">#{softPowerText},</if>
            <if test="softPowerImg != null">#{softPowerImg},</if>
         </trim>
    </insert>

    <update id="updateBidCompany" parameterType="BidCompany">
        update bid_company
        <trim prefix="SET" suffixOverrides=",">
            <if test="companyId != null">companyId = #{companyId},</if>
            <if test="tenantCode != null">tenant_code = #{tenantCode},</if>
            <if test="companyName != null">company_name = #{companyName},</if>
            <if test="accountName != null">account_name = #{accountName},</if>
            <if test="accountBank != null">account_bank = #{accountBank},</if>
            <if test="bankAddress != null">bank_address = #{bankAddress},</if>
            <if test="annex != null">annex = #{annex},</if>
            <if test="bankAccount != null">bank_account = #{bankAccount},</if>
            <if test="bankNo != null">bank_no = #{bankNo},</if>
            <if test="bankPhone != null">bank_phone = #{bankPhone},</if>
            <if test="trueName != null">trueName = #{trueName},</if>
            <if test="position != null">position = #{position},</if>
            <if test="sex != null">sex = #{sex},</if>
            <if test="idPhpto != null">id_phpto = #{idPhpto},</if>
            <if test="idNumber != null">id_number = #{idNumber},</if>
            <if test="birthday != null">birthday = #{birthday},</if>
            <if test="idCardStart != null">id_card_start = #{idCardStart},</if>
            <if test="idCardEnd != null">id_card_end = #{idCardEnd},</if>
            <if test="maxProgress != null">max_progress = #{maxProgress},</if>
            <if test="businessId != null">business_id = #{businessId},</if>
            <if test="phoneNumber != null">phone_number = #{phoneNumber},</if>
            <if test="socialCode != null">social_code = #{socialCode},</if>
            <if test="nature != null">nature = #{nature},</if>
            <if test="authority != null">authority = #{authority},</if>
            <if test="startTime != null">startTime = #{startTime},</if>
            <if test="email != null">email = #{email},</if>
            <if test="businessLicense != null">business_license = #{businessLicense},</if>
            <if test="legalRepresentative != null">legal_representative = #{legalRepresentative},</if>
            <if test="registeredCapital != null">registered_capital = #{registeredCapital},</if>
            <if test="address != null">address = #{address},</if>
            <if test="fullAddress != null">full_address = #{fullAddress},</if>
            <if test="registeredTime != null">registered_time = #{registeredTime},</if>
            <if test="businessStart != null">business_start = #{businessStart},</if>
            <if test="businessEnd != null">business_end = #{businessEnd},</if>
            <if test="businessScope != null">business_scope = #{businessScope},</if>
            <if test="companyBasicId != null">company_basic_id = #{companyBasicId},</if>
            <if test="enterpriseSize != null">enterprise_size = #{enterpriseSize},</if>
            <if test="industry != null">industry = #{industry},</if>
            <if test="website != null">website = #{website},</if>
            <if test="contactPhone != null">contact_phone = #{contactPhone},</if>
            <if test="postcode != null">postcode = #{postcode},</if>
            <if test="fax != null">fax = #{fax},</if>
            <if test="securityLicense != null">security_license = #{securityLicense},</if>
            <if test="securityStart != null">security_start = #{securityStart},</if>
            <if test="securityEnd != null">security_end = #{securityEnd},</if>
            <if test="structure != null">structure = #{structure},</if>
            <if test="companyProfile != null">company_profile = #{companyProfile},</if>
            <if test="softPowerText != null">soft_power_text = #{softPowerText},</if>
            <if test="softPowerImg != null">soft_power_img = #{softPowerImg},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBidCompanyById" parameterType="Long">
        delete from bid_company where id = #{id}
    </delete>

    <delete id="deleteBidCompanyByIds" parameterType="String">
        delete from bid_company where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>