You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
4.2 KiB

<?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.daqing.financial.crms.dao.CompanyCustomerDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.daqing.framework.domain.crms.CompanyCustomerEntity" id="companyCustomerMap">
<result property="id" column="id"/>
<result property="registeredCapital" column="registered_capital"/>
<result property="socialUnifiedCode" column="social_unified_code"/>
<result property="industry" column="industry"/>
<result property="years" column="years"/>
<result property="region" column="region"/>
<result property="shareholder" column="shareholder"/>
<result property="affiliatedCompany" column="affiliated_company"/>
<result property="empNum" column="emp_num"/>
<result property="linkman" column="linkman"/>
<result property="linkPhone" column="link_phone"/>
<result property="businessSource" column="business_source"/>
<result property="businessScope" column="business_scope"/>
<result property="businessAddr" column="business_addr"/>
<result property="registerTime" column="register_time"/>
<result property="registerAddr" column="register_addr"/>
<result property="legalIdNumber" column="legal_id_number"/>
<result property="legalHukouAddr" column="legal_hukou_addr"/>
<result property="legalPhone" column="legal_phone"/>
<result property="legalHomeAddr" column="legal_home_addr"/>
<result property="legalGender" column="legal_gender"/>
<result property="legalName" column="legal_name"/>
<result property="isExistRelated" column="is_exist_related"/>
<result property="customerId" column="customer_id"/>
</resultMap>
<!-- 根据客户基本信息id查询企业类型客户的信息 -->
<select id="queryCompanyCustomerById" parameterType="long" resultType="com.daqing.framework.domain.crms.CompanyCustomerEntity">
SELECT registered_capital,industry,years,region,shareholder,affiliated_company,emp_num,linkman,business_source
FROM crms_company_customer
WHERE customer_id = #{id}
</select>
<!-- 插入企业类型客户信息 -->
<insert id="saveCompanyCustomer" parameterType="com.daqing.framework.domain.crms.CompanyCustomerEntity">
INSERT INTO crms_company_customer
(registered_capital,industry,years,region,shareholder,affiliated_company,emp_num,linkman,business_source,customer_id)
values (#{registeredCapital},#{industry},#{years},#{region},#{shareholder},#{affiliatedCompany},#{empNum},#{linkman},
#{businessSource},#{customerId});
</insert>
<!-- 更新企业类型客户信息 -->
<update id="updateCompanyCustomer" parameterType="com.daqing.framework.domain.crms.CompanyCustomerEntity">
UPDATE crms_company_customer
SET registered_capital=#{registeredCapital},industry=#{industry},years=#{years},region=#{region},shareholder=#{shareholder},
affiliated_company=#{affiliatedCompany},emp_num=#{empNum},linkman=#{linkman},business_source=#{businessSource}
WHERE customer_id = #{customerId}
</update>
<!-- 根据客户编号/客户名称获取企业信息 -->
<select id="queryCompanyInfo" parameterType="com.daqing.framework.domain.crms.request.DgApplyAmountInfoRequest" resultType="com.daqing.framework.domain.crms.response.CompanyCustomerResponse">
SELECT cu.*,cc.*
FROM crms_company_customer cu
left join crms_customer cc on cu.customer_id = cc.id
<where>
cc.del_or_not=0 and cc.status=0
<if test="applyAmountInfo.code != null and applyAmountInfo.code != '' ">
AND cc.code LIKE CONCAT('%',#{applyAmountInfo.code},'%')
</if>
<if test="applyAmountInfo.name != null and applyAmountInfo.name != '' ">
AND cc.name LIKE CONCAT('%',#{applyAmountInfo.name},'%')
</if>
<if test="applyAmountInfo.companyId != null and applyAmountInfo.companyId != '' ">
AND cu.id = #{applyAmountInfo.companyId}
</if>
</where>
</select>
</mapper>