|
@@ -0,0 +1,236 @@
|
|
|
+<?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.daq.CompanyContactInfoMapper" >
|
|
|
+ <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.CompanyContactInfoDO" >
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ -->
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="company_id" property="companyId" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_date" property="contactDate" jdbcType="DATE" />
|
|
|
+ <result column="contactor" property="contactor" jdbcType="VARCHAR" />
|
|
|
+ <result column="customer_manager" property="customerManager" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_id" property="contactId" jdbcType="INTEGER" />
|
|
|
+ <result column="contact_status" property="contactStatus" jdbcType="INTEGER" />
|
|
|
+ <result column="sign_method" property="signMethod" jdbcType="INTEGER" />
|
|
|
+ <result column="contact_remark" property="contactRemark" jdbcType="VARCHAR" />
|
|
|
+ <result column="creatorid" property="creatorId" jdbcType="INTEGER" />
|
|
|
+ <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="updaterid" property="updaterId" jdbcType="INTEGER" />
|
|
|
+ <result column="updatetime" property="updateTime" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="isvalid" property="isvalid" jdbcType="INTEGER" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="Base_Column_List" >
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ -->
|
|
|
+ id, company_id,contact_date, contactor, customer_manager, contact_id, contact_status, sign_method,
|
|
|
+ contact_remark, creatorid, createtime, updaterid,
|
|
|
+ updatetime, isvalid
|
|
|
+ </sql>
|
|
|
+ <delete id="deleteCompanyContactInfoById">
|
|
|
+ update COMPANY_CONTACT_INFO set isvalid=0,updatetime=now(),updaterid=#{userId} where id=#{id}
|
|
|
+ </delete>
|
|
|
+ <select id="getCompanyContactInfo" resultMap="BaseResultMap">
|
|
|
+ select <include refid="Base_Column_List"/>
|
|
|
+ from COMPANY_CONTACT_INFO where isvalid=1 and company_id=#{companyId} and contact_date=#{contactDate}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <resultMap id="BaseResultPageMap" type="com.simuwang.base.pojo.dos.CompanyContactInfoPageDO" >
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ -->
|
|
|
+ <result column="company_id" property="companyId" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_date" property="contactDate" jdbcType="DATE" />
|
|
|
+ <result column="contactor" property="contactor" jdbcType="VARCHAR" />
|
|
|
+ <result column="customer_manager" property="customerManager" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_name" property="contactName" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_status" property="contactStatus" jdbcType="INTEGER" />
|
|
|
+ <result column="sign_method" property="signMethod" jdbcType="INTEGER" />
|
|
|
+ <result column="contact_remark" property="contactRemark" jdbcType="VARCHAR" />
|
|
|
+ <result column="company_name" property="companyName" jdbcType="VARCHAR" />
|
|
|
+ <result column="company_short_name" property="companyShortName" jdbcType="VARCHAR" />
|
|
|
+ <result column="is_send" property="isSend" jdbcType="INTEGER" />
|
|
|
+ <result column="company_asset_size" property="companyAssetSize" jdbcType="INTEGER" />
|
|
|
+ <result column="establish_date" property="establishDate" jdbcType="VARCHAR" />
|
|
|
+ <result column="credit_code" property="creditCode" jdbcType="VARCHAR" />
|
|
|
+ </resultMap>
|
|
|
+ <select id="selectCompanyContactInfoList" resultMap="BaseResultPageMap">
|
|
|
+ select cp.company_id,
|
|
|
+ cp.company_name,
|
|
|
+ cp.company_short_name,
|
|
|
+ ct.contact_date,
|
|
|
+ ct.contactor,
|
|
|
+ ct.customer_manager,
|
|
|
+ ct.contact_status,
|
|
|
+ ct.sign_method,
|
|
|
+ CASE
|
|
|
+ WHEN css.send_status IS NULL
|
|
|
+ THEN 0
|
|
|
+ ELSE css.send_status
|
|
|
+ END
|
|
|
+ AS is_send,
|
|
|
+ ci.contact_name,
|
|
|
+ cp.establish_date,
|
|
|
+ cp.credit_code,
|
|
|
+ ct.contact_remark,
|
|
|
+ cp.company_asset_size
|
|
|
+ from pvn_company_info cp
|
|
|
+ left join last_company_contact_info ct
|
|
|
+ on cp.company_id = ct.company_id and ct.isvalid=1
|
|
|
+ left join contact_information ci
|
|
|
+ on ct.company_id = ci.company_id and ci.isvalid=1
|
|
|
+ left join company_send_status css
|
|
|
+ on cp.company_id = css.company_id and css.isvalid=1
|
|
|
+ where cp.isvalid =1
|
|
|
+ <if test="companyId != null and companyId != ''">
|
|
|
+ and cp.company_id like concat('%',#{companyId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
+ and (cp.company_name like concat('%',#{companyName},'%') or cp.company_short_name like concat('%',#{companyName},'%') or cp.register_number like concat('%',#{companyName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="contactStartDate != null and contactStartDate != ''">
|
|
|
+ and ct.contact_date >= #{contactStartDate}
|
|
|
+ </if>
|
|
|
+ <if test="contactEndDate != null and contactEndDate != ''">
|
|
|
+ and ct.contact_date <![CDATA[ <= ]]> #{contactEndDate}
|
|
|
+ </if>
|
|
|
+ <if test="isSend != null and isSend != ''">
|
|
|
+ and (case when css.send_status is null then 0 else css.send_status end) = #{isSend}
|
|
|
+ </if>
|
|
|
+ <if test="contactStatus != null and contactStatus != ''">
|
|
|
+ and ct.contact_status = #{contactStatus}
|
|
|
+ </if>
|
|
|
+ <if test="signMethod != null and signMethod != ''">
|
|
|
+ and ct.sign_method = #{signMethod}
|
|
|
+ </if>
|
|
|
+ <if test="companyAssetSize != null and companyAssetSize != ''">
|
|
|
+ and cp.company_asset_size = #{companyAssetSize}
|
|
|
+ </if>
|
|
|
+ order by
|
|
|
+ CASE
|
|
|
+ WHEN ct.contact_date IS NULL THEN 1
|
|
|
+ ELSE 0
|
|
|
+ END,
|
|
|
+ ct.contact_date desc
|
|
|
+ limit #{offset},#{pageSize}
|
|
|
+ </select>
|
|
|
+ <select id="countCompanyContactInfo" resultType="java.lang.Long">
|
|
|
+ select count(distinct cp.company_id)
|
|
|
+ from pvn_company_info cp
|
|
|
+ left join last_company_contact_info ct
|
|
|
+ on cp.company_id = ct.company_id and ct.isvalid=1
|
|
|
+ left join contact_information ci
|
|
|
+ on cp.company_id = ci.company_id and ci.isvalid=1
|
|
|
+ left join company_send_status css
|
|
|
+ on cp.company_id = css.company_id and css.isvalid=1
|
|
|
+ where cp.isvalid =1
|
|
|
+ <if test="companyId != null and companyId != ''">
|
|
|
+ and cp.company_id like concat('%',#{companyId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
+ and (cp.company_name like concat('%',#{companyName},'%') or cp.company_short_name like concat('%',#{companyName},'%') or cp.register_number like concat('%',#{companyName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="contactStartDate != null and contactStartDate != ''">
|
|
|
+ and ct.contact_date >= #{contactStartDate}
|
|
|
+ </if>
|
|
|
+ <if test="contactEndDate != null and contactEndDate != ''">
|
|
|
+ and ct.contact_date <![CDATA[ <= ]]> #{contactEndDate}
|
|
|
+ </if>
|
|
|
+ <if test="isSend != null and isSend != ''">
|
|
|
+ and (case when css.send_status is null then 0 else css.send_status end) = #{isSend}
|
|
|
+ </if>
|
|
|
+ <if test="contactStatus != null and contactStatus != ''">
|
|
|
+ and ct.contact_status = #{contactStatus}
|
|
|
+ </if>
|
|
|
+ <if test="signMethod != null and signMethod != ''">
|
|
|
+ and ct.sign_method = #{signMethod}
|
|
|
+ </if>
|
|
|
+ <if test="companyAssetSize != null and companyAssetSize != ''">
|
|
|
+ and cp.company_asset_size = #{companyAssetSize}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <resultMap id="ContactResultPageMap" type="com.simuwang.base.pojo.dos.CompanyContactPageDO" >
|
|
|
+ <result column="id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="contact_id" property="contactId" jdbcType="INTEGER" />
|
|
|
+ <result column="company_id" property="companyId" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_date" property="contactDate" jdbcType="DATE" />
|
|
|
+ <result column="contactor" property="contactor" jdbcType="VARCHAR" />
|
|
|
+ <result column="customer_manager" property="customerManager" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_name" property="contactName" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_status" property="contactStatus" jdbcType="INTEGER" />
|
|
|
+ <result column="sign_method" property="signMethod" jdbcType="INTEGER" />
|
|
|
+ <result column="contact_remark" property="contactRemark" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_phone" property="contactPhone" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_email" property="contactEmail" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_wechat" property="contactWechat" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_position" property="contactPosition" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_file_name" property="contactFileName" jdbcType="VARCHAR" />
|
|
|
+ <result column="contact_file_path" property="contactFilePath" jdbcType="VARCHAR" />
|
|
|
+ </resultMap>
|
|
|
+ <select id="selectCompanyContactListByCompanyId"
|
|
|
+ resultMap="ContactResultPageMap">
|
|
|
+ select info.id,
|
|
|
+ info.company_id,
|
|
|
+ info.contact_date,
|
|
|
+ info.contactor,
|
|
|
+ info.customer_manager,
|
|
|
+ ci.contact_name,
|
|
|
+ ci.contact_phone,
|
|
|
+ ci.contact_email,
|
|
|
+ ci.contact_wechat,
|
|
|
+ ci.contact_position,
|
|
|
+ info.sign_method,
|
|
|
+ info.contact_status,
|
|
|
+ info.contact_id,
|
|
|
+ ci.contact_remark,
|
|
|
+ ci.contact_file_name,
|
|
|
+ ci.contact_file_path
|
|
|
+ from company_contact_info info
|
|
|
+ left join contact_information ci
|
|
|
+ on info.company_id = ci.company_id and ci.isvalid=1 and info.contact_id= ci.id and ci.open_status=1
|
|
|
+ where info.company_id = #{companyId} and info.isvalid=1
|
|
|
+ order by info.contact_date desc
|
|
|
+ limit #{offset},#{pageSize}
|
|
|
+ </select>
|
|
|
+ <select id="countCompanyContactByCompanyId" resultType="java.lang.Long">
|
|
|
+ select count(1) from company_contact_info info where info.company_id = #{companyId} and info.isvalid=1
|
|
|
+ </select>
|
|
|
+ <select id="saveCompanyContactDetail" resultMap="BaseResultPageMap">
|
|
|
+ select info.id,
|
|
|
+ info.company_id,
|
|
|
+ info.contact_date,
|
|
|
+ info.contactor,
|
|
|
+ info.customer_manager,
|
|
|
+ ci.contact_name,
|
|
|
+ ci.contact_phone,
|
|
|
+ ci.contact_email,
|
|
|
+ ci.contact_wechat,
|
|
|
+ ci.contact_position,
|
|
|
+ info.sign_method,
|
|
|
+ info.contact_status,
|
|
|
+ info.contact_id,
|
|
|
+ ci.contact_remark,
|
|
|
+ ci.contact_file_name,
|
|
|
+ ci.contact_file_path
|
|
|
+ from company_contact_info info
|
|
|
+ left join contact_information ci
|
|
|
+ on info.company_id = ci.company_id and ci.isvalid=1 and info.contact_id= ci.id and ci.open_status=1
|
|
|
+ where info.id = #{id} and info.isvalid=1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLastCompanyContactInfoDO" resultMap="BaseResultMap">
|
|
|
+ select <include refid="Base_Column_List"/>
|
|
|
+ from COMPANY_CONTACT_INFO where isvalid=1 and company_id=#{companyId}
|
|
|
+ ORDER BY contact_date desc
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+ <select id="selectCountByContactId" resultType="java.lang.Integer">
|
|
|
+ select count(1) from COMPANY_CONTACT_INFO where isvalid=1 and contact_id=#{contactId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|