<?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.simuwang.base.mapper.CompanyInformationMapper">
    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.CompanyInformationDO">
        <id column="company_id" property="companyId"/>
        <result column="is_amac_show" property="isAmacShow"/>
        <result column="fund_practitioners_count" property="fundPractitionersCount"/>
        <result column="managed_fund_count" property="managedFundCount"/>
        <result column="cancel_date" property="cancelDate"/>
        <result column="cancel_type" property="cancelType"/>
        <result column="credit_code" property="creditCode"/>
        <result column="employee_cnts" property="employeeCnts"/>
        <result column="company_asset_size" property="companyAssetSize"/>
        <result column="paid_capital" property="paidCapital"/>
        <result column="capital_paid_rate" property="capitalPaidRate"/>
        <result column="nature_business_type" property="natureBusinessType"/>
        <result column="business_type" property="businessType"/>
        <result column="member_type" property="memberType"/>
        <result column="join_date" property="joinDate"/>
        <result column="is_member" property="isMember"/>
        <result column="register_date" property="registerDate"/>
        <result column="register_status" property="registerStatus"/>
        <result column="register_number" property="registerNumber"/>
        <result column="registered_capital" property="registeredCapital"/>
        <result column="reg_country" property="regCountry"/>
        <result column="reg_province" property="regProvince"/>
        <result column="reg_city" property="regCity"/>
        <result column="country" property="country"/>
        <result column="province" property="province"/>
        <result column="city" property="city"/>
        <result column="company_address2" property="companyAddress2"/>
        <result column="company_address" property="companyAddress"/>
        <result column="domicile_id" property="domicileId"/>
        <result column="establish_date" property="establishDate"/>
        <result column="organization_number" property="organizationNumber"/>
        <result column="company_type" property="companyType"/>
        <result column="company_name" property="companyName"/>
        <result column="company_short_name" property="companyShortName"/>
        <result column="createtime" property="createTime"/>
        <result column="updatetime" property="updateTime"/>
        <result column="isvalid" property="isvalid"/>
    </resultMap>
    <select id="searchCompanyInfoByKeyword" resultType="java.util.Map" parameterType="java.lang.String">
        select c.company_id as `companyId`,
        c.company_name as `companyName`,
        c.register_number as `registerNumber`
        from PPW_EMAIL.pvn_company_info c where c.isvalid =1
        <if test="keyword != null and keyword !=''">
            and (c.company_name like concat('%',#{keyword},'%') or c.company_short_name like concat('%',#{keyword},'%') or c.register_number like concat('%',#{keyword},'%'))
        </if>
    </select>
    <select id="getCompanyNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
        select distinct company_name from PPW_EMAIL.pvn_company_info c join PPW_EMAIL.pvn_fund_info f
        on f.trust_id = c.company_id
        where c.isvalid=1 and f.isvalid=1
        and f.fund_id=#{fundId}
    </select>

</mapper>