<?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.basicData.mapper.FleetCompanyMsgMapper">
    
    <resultMap type="FleetCompanyMsg" id="FleetCompanyMsgResult">
        <result property="id"    column="id"    />
        <result property="companyName"    column="company_name"    />
        <result property="loginAccount"    column="login_account"    />
        <result property="companyAddress"    column="company_address"    />
        <result property="openingBank"    column="opening_bank"    />
        <result property="bankAccount"    column="bank_account"    />
        <result property="creditLv"    column="credit_lv"    />
        <result property="paymentDays"    column="payment_days"    />
        <result property="carNum"    column="car_num"    />
        <result property="linkMan"    column="link_man"    />
        <result property="linkPhone"    column="link_phone"    />
        <result property="fax"    column="fax"    />
        <result property="email"    column="email"    />
        <result property="headOffice"    column="head_office"    />
        <result property="registerdCapital"    column="registerd_capital"    />
        <result property="legalPerson"    column="legal_person"    />
        <result property="insdustry"    column="insdustry"    />
        <result property="creditNum"    column="credit_num"    />
        <result property="taxpayerNum"    column="taxpayer_num"    />
        <result property="industryCommerceNum"    column="industry_commerce_num"    />
        <result property="organizationNum"    column="organization_num"    />
        <result property="registerOrganization"    column="register_organization"    />
        <result property="dateOfEstablishment"    column="date_of_establishment"    />
        <result property="companyType"    column="company_type"    />
        <result property="businessDeadline"    column="business_deadline"    />
        <result property="businessArea"    column="business_area"    />
        <result property="annualDate"    column="annual_date"    />
        <result property="registerdAddress"    column="registerd_address"    />
        <result property="manageScope"    column="manage_scope"    />
        <result property="creatTime"    column="creat_time"    />
        <result property="modificationTime"    column="modification_time"    />
        <result property="billStatus"    column="bill_status"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectFleetCompanyMsgVo">
        select id, company_name, login_account, company_address, opening_bank, bank_account, credit_lv, payment_days, car_num, link_man, link_phone, fax, email, head_office, registerd_capital, legal_person,
               insdustry, credit_num, taxpayer_num, industry_commerce_num, organization_num, register_organization, date_of_establishment, company_type,
               business_deadline, business_area, annual_date, registerd_address, manage_scope, creat_time, modification_time , bill_status, del_flag, create_by, update_by, update_time, remark
        from fleet_company_msg
    </sql>

    <select id="selectFleetCompanyMsgList" parameterType="FleetCompanyMsg" resultMap="FleetCompanyMsgResult">
        <include refid="selectFleetCompanyMsgVo"/>
        <where>  
            <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
            <if test="loginAccount != null  and loginAccount != ''"> and login_account = #{loginAccount}</if>
            <if test="companyAddress != null  and companyAddress != ''"> and company_address = #{companyAddress}</if>
            <if test="openingBank != null  and openingBank != ''"> and opening_bank = #{openingBank}</if>
            <if test="bankAccount != null  and bankAccount != ''"> and bank_account = #{bankAccount}</if>
            <if test="creditLv != null  and creditLv != ''"> and credit_lv = #{creditLv}</if>
            <if test="paymentDays != null "> and payment_days = #{paymentDays}</if>
            <if test="carNum != null "> and car_num = #{carNum}</if>
            <if test="linkMan != null  and linkMan != ''"> and link_man = #{linkMan}</if>
            <if test="linkPhone != null  and linkPhone != ''"> and link_phone = #{linkPhone}</if>
            <if test="fax != null  and fax != ''"> and fax = #{fax}</if>
            <if test="email != null  and email != ''"> and email = #{email}</if>
            <if test="headOffice != null  and headOffice != ''"> and head_office = #{headOffice}</if>
            <if test="registerdCapital != null  and registerdCapital != ''"> and registerd_capital = #{registerdCapital}</if>
            <if test="legalPerson != null  and legalPerson != ''"> and legal_person = #{legalPerson}</if>
            <if test="insdustry != null  and insdustry != ''"> and insdustry = #{insdustry}</if>
            <if test="creditNum != null  and creditNum != ''"> and credit_num = #{creditNum}</if>
            <if test="taxpayerNum != null  and taxpayerNum != ''"> and taxpayer_num = #{taxpayerNum}</if>
            <if test="industryCommerceNum != null  and industryCommerceNum != ''"> and industry_commerce_num = #{industryCommerceNum}</if>
            <if test="organizationNum != null  and organizationNum != ''"> and organization_num = #{organizationNum}</if>
            <if test="registerOrganization != null  and registerOrganization != ''"> and register_organization = #{registerOrganization}</if>
            <if test="dateOfEstablishment != null "> and date_of_establishment = #{dateOfEstablishment}</if>
            <if test="companyType != null  and companyType != ''"> and company_type = #{companyType}</if>
            <if test="businessDeadline != null "> and business_deadline = #{businessDeadline}</if>
            <if test="businessArea != null  and businessArea != ''"> and business_area = #{businessArea}</if>
            <if test="annualDate != null "> and annual_date = #{annualDate}</if>
            <if test="registerdAddress != null  and registerdAddress != ''"> and registerd_address = #{registerdAddress}</if>
            <if test="manageScope != null  and manageScope != ''"> and manage_scope = #{manageScope}</if>
            <if test="creatTime != null "> and creat_time = #{creatTime}</if>
            <if test="modificationTime != null "> and modification_time = #{modificationTime}</if>
            <if test="billStatus != null "> and bill_status = #{billStatus}</if>
        </where>
    </select>
    
    <select id="selectFleetCompanyMsgById" parameterType="Long" resultMap="FleetCompanyMsgResult">
        <include refid="selectFleetCompanyMsgVo"/>
        where id = #{id}
    </select>

    <select id="selectFleetCompanyMsgIdNameList" resultType="FleetCompanyMsg" resultMap="FleetCompanyMsgResult">
        select id, company_name from fleet_company_msg
        <where>
            <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
            <if test="loginAccount != null  and loginAccount != ''"> and login_account = #{loginAccount}</if>
            <if test="companyAddress != null  and companyAddress != ''"> and company_address = #{companyAddress}</if>
            <if test="openingBank != null  and openingBank != ''"> and opening_bank = #{openingBank}</if>
            <if test="bankAccount != null  and bankAccount != ''"> and bank_account = #{bankAccount}</if>
            <if test="creditLv != null  and creditLv != ''"> and credit_lv = #{creditLv}</if>
            <if test="paymentDays != null "> and payment_days = #{paymentDays}</if>
            <if test="carNum != null "> and car_num = #{carNum}</if>
            <if test="linkMan != null  and linkMan != ''"> and link_man = #{linkMan}</if>
            <if test="linkPhone != null  and linkPhone != ''"> and link_phone = #{linkPhone}</if>
            <if test="fax != null  and fax != ''"> and fax = #{fax}</if>
            <if test="email != null  and email != ''"> and email = #{email}</if>
            <if test="headOffice != null  and headOffice != ''"> and head_office = #{headOffice}</if>
            <if test="registerdCapital != null  and registerdCapital != ''"> and registerd_capital = #{registerdCapital}</if>
            <if test="legalPerson != null  and legalPerson != ''"> and legal_person = #{legalPerson}</if>
            <if test="insdustry != null  and insdustry != ''"> and insdustry = #{insdustry}</if>
            <if test="creditNum != null  and creditNum != ''"> and credit_num = #{creditNum}</if>
            <if test="taxpayerNum != null  and taxpayerNum != ''"> and taxpayer_num = #{taxpayerNum}</if>
            <if test="industryCommerceNum != null  and industryCommerceNum != ''"> and industry_commerce_num = #{industryCommerceNum}</if>
            <if test="organizationNum != null  and organizationNum != ''"> and organization_num = #{organizationNum}</if>
            <if test="registerOrganization != null  and registerOrganization != ''"> and register_organization = #{registerOrganization}</if>
            <if test="dateOfEstablishment != null "> and date_of_establishment = #{dateOfEstablishment}</if>
            <if test="companyType != null  and companyType != ''"> and company_type = #{companyType}</if>
            <if test="businessDeadline != null "> and business_deadline = #{businessDeadline}</if>
            <if test="businessArea != null  and businessArea != ''"> and business_area = #{businessArea}</if>
            <if test="annualDate != null "> and annual_date = #{annualDate}</if>
            <if test="registerdAddress != null  and registerdAddress != ''"> and registerd_address = #{registerdAddress}</if>
            <if test="manageScope != null  and manageScope != ''"> and manage_scope = #{manageScope}</if>
            <if test="creatTime != null "> and creat_time = #{creatTime}</if>
            <if test="modificationTime != null "> and modification_time = #{modificationTime}</if>
            <if test="billStatus != null "> and bill_status = #{billStatus}</if>
        </where>
    </select>

    <insert id="insertFleetCompanyMsg" parameterType="FleetCompanyMsg" useGeneratedKeys="true" keyProperty="id">
        insert into fleet_company_msg
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="companyName != null">company_name,</if>
            <if test="loginAccount != null and loginAccount != ''">login_account,</if>
            <if test="companyAddress != null">company_address,</if>
            <if test="openingBank != null">opening_bank,</if>
            <if test="bankAccount != null">bank_account,</if>
            <if test="creditLv != null">credit_lv,</if>
            <if test="paymentDays != null">payment_days,</if>
            <if test="carNum != null">car_num,</if>
            <if test="linkMan != null">link_man,</if>
            <if test="linkPhone != null">link_phone,</if>
            <if test="fax != null">fax,</if>
            <if test="email != null">email,</if>
            <if test="headOffice != null">head_office,</if>
            <if test="registerdCapital != null">registerd_capital,</if>
            <if test="legalPerson != null">legal_person,</if>
            <if test="insdustry != null">insdustry,</if>
            <if test="creditNum != null">credit_num,</if>
            <if test="taxpayerNum != null">taxpayer_num,</if>
            <if test="industryCommerceNum != null">industry_commerce_num,</if>
            <if test="organizationNum != null">organization_num,</if>
            <if test="registerOrganization != null">register_organization,</if>
            <if test="dateOfEstablishment != null">date_of_establishment,</if>
            <if test="companyType != null">company_type,</if>
            <if test="businessDeadline != null">business_deadline,</if>
            <if test="businessArea != null">business_area,</if>
            <if test="annualDate != null">annual_date,</if>
            <if test="registerdAddress != null">registerd_address,</if>
            <if test="manageScope != null">manage_scope,</if>
            <if test="creatTime != null">creat_time,</if>
            <if test="modificationTime != null">modification_time,</if>
            <if test="billStatus != null">bill_status,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="companyName != null">#{companyName},</if>
            <if test="loginAccount != null and loginAccount != ''">#{loginAccount},</if>
            <if test="companyAddress != null">#{companyAddress},</if>
            <if test="openingBank != null">#{openingBank},</if>
            <if test="bankAccount != null">#{bankAccount},</if>
            <if test="creditLv != null">#{creditLv},</if>
            <if test="paymentDays != null">#{paymentDays},</if>
            <if test="carNum != null">#{carNum},</if>
            <if test="linkMan != null">#{linkMan},</if>
            <if test="linkPhone != null">#{linkPhone},</if>
            <if test="fax != null">#{fax},</if>
            <if test="email != null">#{email},</if>
            <if test="headOffice != null">#{headOffice},</if>
            <if test="registerdCapital != null">#{registerdCapital},</if>
            <if test="legalPerson != null">#{legalPerson},</if>
            <if test="insdustry != null">#{insdustry},</if>
            <if test="creditNum != null">#{creditNum},</if>
            <if test="taxpayerNum != null">#{taxpayerNum},</if>
            <if test="industryCommerceNum != null">#{industryCommerceNum},</if>
            <if test="organizationNum != null">#{organizationNum},</if>
            <if test="registerOrganization != null">#{registerOrganization},</if>
            <if test="dateOfEstablishment != null">#{dateOfEstablishment},</if>
            <if test="companyType != null">#{companyType},</if>
            <if test="businessDeadline != null">#{businessDeadline},</if>
            <if test="businessArea != null">#{businessArea},</if>
            <if test="annualDate != null">#{annualDate},</if>
            <if test="registerdAddress != null">#{registerdAddress},</if>
            <if test="manageScope != null">#{manageScope},</if>
            <if test="creatTime != null">#{creatTime},</if>
            <if test="modificationTime != null">#{modificationTime},</if>
            <if test="billStatus != null">#{billStatus},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateFleetCompanyMsg" parameterType="FleetCompanyMsg">
        update fleet_company_msg
        <trim prefix="SET" suffixOverrides=",">
            <if test="companyName != null">company_name = #{companyName},</if>
            <if test="loginAccount != null and loginAccount != ''">login_account = #{loginAccount},</if>
            <if test="companyAddress != null">company_address = #{companyAddress},</if>
            <if test="openingBank != null">opening_bank = #{openingBank},</if>
            <if test="bankAccount != null">bank_account = #{bankAccount},</if>
            <if test="creditLv != null">credit_lv = #{creditLv},</if>
            <if test="paymentDays != null">payment_days = #{paymentDays},</if>
            <if test="carNum != null">car_num = #{carNum},</if>
            <if test="linkMan != null">link_man = #{linkMan},</if>
            <if test="linkPhone != null">link_phone = #{linkPhone},</if>
            <if test="fax != null">fax = #{fax},</if>
            <if test="email != null">email = #{email},</if>
            <if test="headOffice != null">head_office = #{headOffice},</if>
            <if test="registerdCapital != null">registerd_capital = #{registerdCapital},</if>
            <if test="legalPerson != null">legal_person = #{legalPerson},</if>
            <if test="insdustry != null">insdustry = #{insdustry},</if>
            <if test="creditNum != null">credit_num = #{creditNum},</if>
            <if test="taxpayerNum != null">taxpayer_num = #{taxpayerNum},</if>
            <if test="industryCommerceNum != null">industry_commerce_num = #{industryCommerceNum},</if>
            <if test="organizationNum != null">organization_num = #{organizationNum},</if>
            <if test="registerOrganization != null">register_organization = #{registerOrganization},</if>
            <if test="dateOfEstablishment != null">date_of_establishment = #{dateOfEstablishment},</if>
            <if test="companyType != null">company_type = #{companyType},</if>
            <if test="businessDeadline != null">business_deadline = #{businessDeadline},</if>
            <if test="businessArea != null">business_area = #{businessArea},</if>
            <if test="annualDate != null">annual_date = #{annualDate},</if>
            <if test="registerdAddress != null">registerd_address = #{registerdAddress},</if>
            <if test="manageScope != null">manage_scope = #{manageScope},</if>
            <if test="creatTime != null">creat_time = #{creatTime},</if>
            <if test="modificationTime != null">modification_time = #{modificationTime},</if>
            <if test="billStatus != null">bill_status = #{billStatus},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFleetCompanyMsgById" parameterType="Long">
        delete from fleet_company_msg where id = #{id}
    </delete>

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

    <select id="checkFNoUnique" parameterType="String" resultMap="FleetCompanyMsgResult">
        select id,company_name from fleet_company_msg where company_name = #{companyName} limit 1
    </select>
    <select id="selectFleetCompanyMsgListMap" parameterType="FleetCompanyMsg" resultType="Map">
        select

        <where>
            <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
            <if test="loginAccount != null  and loginAccount != ''"> and login_account = #{loginAccount}</if>
            <if test="companyAddress != null  and companyAddress != ''"> and company_address = #{companyAddress}</if>
            <if test="openingBank != null  and openingBank != ''"> and opening_bank = #{openingBank}</if>
            <if test="bankAccount != null  and bankAccount != ''"> and bank_account = #{bankAccount}</if>
            <if test="creditLv != null  and creditLv != ''"> and credit_lv = #{creditLv}</if>
            <if test="paymentDays != null "> and payment_days = #{paymentDays}</if>
            <if test="carNum != null "> and car_num = #{carNum}</if>
            <if test="linkMan != null  and linkMan != ''"> and link_man = #{linkMan}</if>
            <if test="linkPhone != null  and linkPhone != ''"> and link_phone = #{linkPhone}</if>
            <if test="fax != null  and fax != ''"> and fax = #{fax}</if>
            <if test="email != null  and email != ''"> and email = #{email}</if>
            <if test="headOffice != null  and headOffice != ''"> and head_office = #{headOffice}</if>
            <if test="registerdCapital != null  and registerdCapital != ''"> and registerd_capital = #{registerdCapital}</if>
            <if test="legalPerson != null  and legalPerson != ''"> and legal_person = #{legalPerson}</if>
            <if test="insdustry != null  and insdustry != ''"> and insdustry = #{insdustry}</if>
            <if test="creditNum != null  and creditNum != ''"> and credit_num = #{creditNum}</if>
            <if test="taxpayerNum != null  and taxpayerNum != ''"> and taxpayer_num = #{taxpayerNum}</if>
            <if test="industryCommerceNum != null  and industryCommerceNum != ''"> and industry_commerce_num = #{industryCommerceNum}</if>
            <if test="organizationNum != null  and organizationNum != ''"> and organization_num = #{organizationNum}</if>
            <if test="registerOrganization != null  and registerOrganization != ''"> and register_organization = #{registerOrganization}</if>
            <if test="dateOfEstablishment != null "> and date_of_establishment = #{dateOfEstablishment}</if>
            <if test="companyType != null  and companyType != ''"> and company_type = #{companyType}</if>
            <if test="businessDeadline != null "> and business_deadline = #{businessDeadline}</if>
            <if test="businessArea != null  and businessArea != ''"> and business_area = #{businessArea}</if>
            <if test="annualDate != null "> and annual_date = #{annualDate}</if>
            <if test="registerdAddress != null  and registerdAddress != ''"> and registerd_address = #{registerdAddress}</if>
            <if test="manageScope != null  and manageScope != ''"> and manage_scope = #{manageScope}</if>
            <if test="creatTime != null "> and creat_time = #{creatTime}</if>
            <if test="modificationTime != null "> and modification_time = #{modificationTime}</if>
            <if test="billStatus != null "> and bill_status = #{billStatus}</if>
        </where>
    </select>

</mapper>