478 lines
16 KiB
XML
478 lines
16 KiB
XML
<?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.cool.store.mapper.HyPartnerLineInfoMapper">
|
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerLineInfoDO">
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
|
|
<result column="workflow_stage" jdbcType="VARCHAR" property="workflowStage" />
|
|
<result column="workflow_status" jdbcType="VARCHAR" property="workflowStatus" />
|
|
<result column="line_status" jdbcType="TINYINT" property="lineStatus" />
|
|
<result column="investment_manager" jdbcType="VARCHAR" property="investmentManager" />
|
|
<result column="development_director" jdbcType="VARCHAR" property="developmentDirector" />
|
|
<result column="development_manager" jdbcType="VARCHAR" property="developmentManager" />
|
|
<result column="deadline" jdbcType="TIMESTAMP" property="deadline" />
|
|
<result column="pass_reason" jdbcType="VARCHAR" property="passReason" />
|
|
<result column="reject_public_reason" jdbcType="VARCHAR" property="rejectPublicReason" />
|
|
<result column="reject_real_reason" jdbcType="VARCHAR" property="rejectRealReason" />
|
|
<result column="certify_file" jdbcType="VARCHAR" property="certifyFile" />
|
|
<result column="deleted" jdbcType="BIT" property="deleted" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
<result column="close_time" jdbcType="TIMESTAMP" property="closeTime" />
|
|
<result column="close_user_id" jdbcType="VARCHAR" property="closeUserId" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, partner_id, workflow_stage, workflow_status, line_status, investment_manager,
|
|
development_director, development_manager, deadline, pass_reason, reject_public_reason,
|
|
reject_real_reason, certify_file, deleted, create_time, update_time, close_time,
|
|
close_user_id
|
|
</sql>
|
|
|
|
<select id="selectByPrimaryKeySelective" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"></include>
|
|
from hy_partner_line_info
|
|
where id = #{id}
|
|
</select>
|
|
|
|
|
|
<insert id="batchInsert">
|
|
insert into
|
|
hy_partner_line_info
|
|
(
|
|
partner_id,
|
|
workflow_stage,
|
|
workflow_status,
|
|
line_status,
|
|
investment_manager
|
|
)
|
|
values
|
|
<foreach collection="recordList" item="record" separator=",">
|
|
(#{record.partnerId},
|
|
#{record.workflowStage},
|
|
#{record.workflowStatus},
|
|
#{record.lineStatus},
|
|
#{record.investmentManager})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="batchDeleted">
|
|
update hy_partner_line_info
|
|
set deleted = 1
|
|
<where>
|
|
<if test="lineIdList!=null and lineIdList.size>0">
|
|
<foreach collection="lineIdList" open="and id in (" close=")" separator="," item="lineId">
|
|
#{lineId}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</update>
|
|
|
|
|
|
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
|
insert into hy_partner_line_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="record.partnerId != null">
|
|
partner_id,
|
|
</if>
|
|
<if test="record.workflowStage != null">
|
|
workflow_stage,
|
|
</if>
|
|
<if test="record.workflowStatus != null">
|
|
workflow_status,
|
|
</if>
|
|
<if test="record.lineStatus != null">
|
|
line_status,
|
|
</if>
|
|
<if test="record.investmentManager != null">
|
|
investment_manager,
|
|
</if>
|
|
<if test="record.developmentDirector != null">
|
|
development_director,
|
|
</if>
|
|
<if test="record.developmentManager != null">
|
|
development_manager,
|
|
</if>
|
|
<if test="record.deadline != null">
|
|
deadline,
|
|
</if>
|
|
<if test="record.passReason != null">
|
|
pass_reason,
|
|
</if>
|
|
<if test="record.rejectPublicReason != null">
|
|
reject_public_reason,
|
|
</if>
|
|
<if test="record.rejectRealReason != null">
|
|
reject_real_reason,
|
|
</if>
|
|
<if test="record.certifyFile != null">
|
|
certify_file,
|
|
</if>
|
|
<if test="record.deleted != null">
|
|
deleted,
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
update_time,
|
|
</if>
|
|
<if test="record.closeTime != null">
|
|
close_time,
|
|
</if>
|
|
<if test="record.closeUserId != null">
|
|
close_user_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="record.partnerId != null">
|
|
#{record.partnerId},
|
|
</if>
|
|
<if test="record.workflowStage != null">
|
|
#{record.workflowStage},
|
|
</if>
|
|
<if test="record.workflowStatus != null">
|
|
#{record.workflowStatus},
|
|
</if>
|
|
<if test="record.lineStatus != null">
|
|
#{record.lineStatus},
|
|
</if>
|
|
<if test="record.investmentManager != null">
|
|
#{record.investmentManager},
|
|
</if>
|
|
<if test="record.developmentDirector != null">
|
|
#{record.developmentDirector},
|
|
</if>
|
|
<if test="record.developmentManager != null">
|
|
#{record.developmentManager},
|
|
</if>
|
|
<if test="record.deadline != null">
|
|
#{record.deadline},
|
|
</if>
|
|
<if test="record.passReason != null">
|
|
#{record.passReason},
|
|
</if>
|
|
<if test="record.rejectPublicReason != null">
|
|
#{record.rejectPublicReason},
|
|
</if>
|
|
<if test="record.rejectRealReason != null">
|
|
#{record.rejectRealReason},
|
|
</if>
|
|
<if test="record.certifyFile != null">
|
|
#{record.certifyFile},
|
|
</if>
|
|
<if test="record.deleted != null">
|
|
#{record.deleted},
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
#{record.createTime},
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
#{record.updateTime},
|
|
</if>
|
|
<if test="record.closeTime != null">
|
|
#{record.closeTime},
|
|
</if>
|
|
<if test="record.closeUserId != null">
|
|
#{record.closeUserId},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective">
|
|
update hy_partner_line_info
|
|
<set>
|
|
<if test="record.partnerId != null">
|
|
partner_id = #{record.partnerId},
|
|
</if>
|
|
<if test="record.workflowStage != null">
|
|
workflow_stage = #{record.workflowStage},
|
|
</if>
|
|
<if test="record.workflowStatus != null">
|
|
workflow_status = #{record.workflowStatus},
|
|
</if>
|
|
<if test="record.lineStatus != null">
|
|
line_status = #{record.lineStatus},
|
|
</if>
|
|
<if test="record.investmentManager != null">
|
|
investment_manager = #{record.investmentManager},
|
|
</if>
|
|
<if test="record.developmentDirector != null">
|
|
development_director = #{record.developmentDirector},
|
|
</if>
|
|
<if test="record.developmentManager != null">
|
|
development_manager = #{record.developmentManager},
|
|
</if>
|
|
<if test="record.deadline != null">
|
|
deadline = #{record.deadline},
|
|
</if>
|
|
<if test="record.passReason != null">
|
|
pass_reason = #{record.passReason},
|
|
</if>
|
|
<if test="record.rejectPublicReason != null">
|
|
reject_public_reason = #{record.rejectPublicReason},
|
|
</if>
|
|
<if test="record.rejectRealReason != null">
|
|
reject_real_reason = #{record.rejectRealReason},
|
|
</if>
|
|
<if test="record.certifyFile != null">
|
|
certify_file = #{record.certifyFile},
|
|
</if>
|
|
<if test="record.deleted != null">
|
|
deleted = #{record.deleted},
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
create_time = #{record.createTime},
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
update_time = #{record.updateTime},
|
|
</if>
|
|
<if test="record.closeTime != null">
|
|
close_time = #{record.closeTime},
|
|
</if>
|
|
<if test="record.closeUserId != null">
|
|
close_user_id = #{record.closeUserId},
|
|
</if>
|
|
<if test="record.joinBlackReason != null">
|
|
join_black_reason = #{record.joinBlackReason},
|
|
</if>
|
|
<if test="record.removeBlackReason != null">
|
|
remove_black_reason = #{record.removeBlackReason},
|
|
</if>
|
|
</set>
|
|
where id = #{record.id}
|
|
</update>
|
|
|
|
<select id="getAdventLineCount" resultType="java.lang.Integer">
|
|
select count(1) from hy_partner_line_info
|
|
<where>
|
|
<if test="userId!=null and userId!=''">
|
|
and investment_manager = #{userId}
|
|
</if>
|
|
<if test="currentDate!=null and currentDate!=''">
|
|
and deadline = #{currentDate}
|
|
</if>
|
|
and
|
|
(
|
|
(workflow_stage = 1 and workflow_status = 0) or
|
|
(workflow_stage = 2 and workflow_status = 0) or
|
|
(workflow_stage = 3 and workflow_status = 4)
|
|
)
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectStagePendingCount" resultType="com.cool.store.dto.partner.StageCountDTO">
|
|
select
|
|
IFNULL(sum(if(workflow_stage=1 and workflow_status = 1,1,0)),0) as intentApplyApproveCount,
|
|
IFNULL(sum(if(workflow_stage=2 and workflow_status = 1,1,0)),0) as reservationInterviewCount,
|
|
IFNULL(sum(if(workflow_stage=3 and workflow_status = 3,1,0)),0) as qualifiedInterviewCount
|
|
from hy_partner_line_info
|
|
<where>
|
|
<if test="userId!=null and userId!=''">
|
|
and investment_manager = #{userId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="selectStageFollowCount" resultType="com.cool.store.dto.partner.StageCountDTO">
|
|
select
|
|
IFNULL(sum(if(workflow_stage=1 and workflow_status = 1,1,0)),0) as intentApplyApproveCount,
|
|
IFNULL(sum(if(workflow_stage=2 and workflow_status = 0,1,0)),0) as reservationInterviewCount,
|
|
IFNULL(sum(if(workflow_stage=3 and workflow_status = 4,1,0)),0) as qualifiedInterviewCount
|
|
from hy_partner_line_info
|
|
<where>
|
|
<if test="userId!=null and userId!=''">
|
|
and investment_manager = #{userId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectPartnerLineInfoAndBaseInfo" resultType="com.cool.store.dto.partner.PartnerLineInfoAndBaseInfoDTO">
|
|
select
|
|
a.id as id,
|
|
a.partner_id as partnerId,
|
|
a.workflow_stage as workflowStage,
|
|
a.workflow_status as workflowStatus,
|
|
a.partner_id as partnerUserId,
|
|
a.investment_manager as investmentManager,
|
|
b.user_portrait as user_portrait,
|
|
b.id as partnerBaseInfoId,
|
|
b.pass_reason as passReason,
|
|
b.certify_file as certifyFile,
|
|
b.pass_time as passTime,
|
|
b.pass_user_id as passUserId
|
|
from hy_partner_line_info a inner join hy_partner_base_info b
|
|
on a.id = b.partner_line_id
|
|
<where>
|
|
<if test="lineId!=null">
|
|
and a.id = #{id}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="lastMonthCloseLine" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"></include>
|
|
from hy_partner_line_info
|
|
<where>
|
|
<if test="userId">
|
|
and investment_manager = #{userId}
|
|
</if>
|
|
<if test="lastMonthTodayDate!=null">
|
|
and close_time > #{lastMonthTodayDate} and close_time <![CDATA[<]]> now
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<update id="updateInvestmentManager">
|
|
update hy_partner_line_info
|
|
set investment_manager = #{userId}
|
|
<if test="lineIdList!=null and lineIdList.size>0">
|
|
<foreach collection="lineIdList" open="where id in (" close=")" separator="," item="lineId">
|
|
#{lineId}
|
|
</foreach>
|
|
</if>
|
|
</update>
|
|
|
|
|
|
<select id="getLineListByLineIds" resultMap="BaseResultMap" >
|
|
select
|
|
<include refid="Base_Column_List"></include>
|
|
from hy_partner_line_info
|
|
where deleted = 0
|
|
<if test="lineIdList!=null and lineIdList.size>0">
|
|
<foreach collection="lineIdList" open="and id in (" close=")" separator="," item="lineId">
|
|
#{lineId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="getBlackList" resultType="com.cool.store.dto.partner.PartnerBlackListDTO" >
|
|
select
|
|
b.partner_id as partnerId,
|
|
b.mobile as mobile,
|
|
b.username as partnerUserName,
|
|
a.id as lineId,
|
|
a.create_time as createTime,
|
|
a.close_user_id as closeUserId,
|
|
a.close_time as closeTime,
|
|
a.join_black_reason as joinBlackReason
|
|
from hy_partner_line_info a inner join hy_partner_user_info b where a.partner_id = b.partner_id
|
|
where deleted = 0
|
|
and line_status = 3
|
|
<if test="userNameKeyword!=null and userNameKeyword !=''">
|
|
and b.username like concat('%', #{userNameKeyword}, '%')
|
|
</if>
|
|
<if test="phoneKeyword!=null and phoneKeyword !=''">
|
|
and b.mobile like concat('%', #{phoneKeyword}, '%')
|
|
</if>
|
|
<if test="intentArea!=null and intentArea!=''">
|
|
and b.want_shop_area = #{intentArea}
|
|
</if>
|
|
<if test="acceptAdjustType!=null">
|
|
and b.accept_adjust_type =#{acceptAdjustType}
|
|
</if>
|
|
</select>
|
|
|
|
<update id="joinAndRemoveBlack">
|
|
update hy_partner_line_info
|
|
<set>
|
|
<if test="line_status != null">
|
|
line_status = #{status},
|
|
</if>
|
|
<if test="joinCause != null and joinCause!=''">
|
|
join_black_reason = #{joinCause},
|
|
</if>
|
|
<if test="removeReason != null and removeReason!=''">
|
|
remove_black_reason = #{removeReason},
|
|
</if>
|
|
</set>
|
|
where id = #{lineId}
|
|
</update>
|
|
|
|
<select id="getByPartnerId" resultMap="BaseResultMap" >
|
|
select
|
|
<include refid="Base_Column_List"></include>
|
|
from hy_partner_line_info
|
|
where partner_id = #{partnerId}
|
|
</select>
|
|
|
|
<select id="getPublicSeaLineList" resultType="com.cool.store.dto.partner.PublicSeaLineDTO">
|
|
select
|
|
a.create_time as createTime,
|
|
b.partner_id as partner_id,
|
|
b.mobile as mobile,
|
|
b.username as userName,
|
|
b.want_shop_area as wantShopArea,
|
|
b.accept_adjust_type as acceptAdjustType
|
|
FROM hy_partner_line_info a inner JOIN hy_partner_user_info b on a.partner_id = b.partner_id
|
|
where a.line_status = 1
|
|
<if test="userNameKeyword!=null and userNameKeyword!=''">
|
|
and b.username like concat('%',#{userNameKeyword},'%')
|
|
</if>
|
|
<if test="phoneKeyword!=null and phoneKeyword!=''">
|
|
and b.mobile like concat('%',#{phoneKeyword},'%')
|
|
</if>
|
|
<if test="intentArea!=null and intentArea!=''">
|
|
and b.want_shop_area = #{intentArea}
|
|
</if>
|
|
<if test="acceptAdjustType!=null">
|
|
and b.accept_adjust_type = #{acceptAdjustType}
|
|
</if>
|
|
<if test="updateStartTime!=null and updateEndTime!=''">
|
|
and a.update_time BETWEEN #{updateStartTime} and #{updateEndTime}
|
|
</if>
|
|
<if test="userIdList!=null and userIdList.size>0">
|
|
<foreach collection="userIdList" item="userId" open="and a.investment_manager in (" close=")" separator=",">
|
|
#{userId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="getPartnerLastLine" resultMap="BaseResultMap">
|
|
SELECT
|
|
<include refid="Base_Column_List"></include>
|
|
FROM hy_partner_line_info h1
|
|
WHERE h1.create_time = (
|
|
SELECT MAX(h2.create_time)
|
|
FROM hy_partner_line_info h2
|
|
WHERE h1.partner_id = h2.partner_id
|
|
<if test="partnerIdList!=null and partnerIdList.size>0">
|
|
<foreach collection="partnerIdList" item="partnerId" open="and h1.partner_id in (" close=")" separator=",">
|
|
#{partnerId}
|
|
</foreach>
|
|
</if>
|
|
)
|
|
</select>
|
|
|
|
<select id="getFollowCountList" resultType="com.cool.store.dto.partner.LineCountDTO">
|
|
SELECT partner_id, COUNT(1) AS num_of_leads
|
|
FROM hy_partner_line_info
|
|
GROUP BY partner_id;
|
|
</select>
|
|
|
|
|
|
<select id="getHyPartnerLineInfoListByIds" resultMap="BaseResultMap">
|
|
SELECT <include refid="Base_Column_List"></include>
|
|
FROM hy_partner_line_info
|
|
<where>
|
|
<if test="lineIds!=null and lineIds.size>0">
|
|
<foreach collection="lineIds" item="lineId" open="and id in (" close=")" separator=",">
|
|
#{partnerId}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="getLineFollowHistoryList" resultMap="BaseResultMap">
|
|
SELECT <include refid="Base_Column_List"></include>
|
|
FROM hy_partner_line_info
|
|
where deleted = 1
|
|
and partner_id = #{partner_id}
|
|
</select>
|
|
|
|
</mapper> |