Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner

# Conflicts:
#	coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java
This commit is contained in:
pserimal
2023-06-13 18:55:38 +08:00
73 changed files with 2832 additions and 119 deletions

View File

@@ -5,12 +5,13 @@
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="role_id" jdbcType="VARCHAR" property="roleId"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="deleted" jdbcType="BIT" property="deleted"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id, role_id, user_id, deleted, create_time, update_time
id, role_id, user_id, type, deleted, create_time, update_time
</sql>
<insert id="batchInsertOrUpdate">
<foreach collection="recordList" separator=";" item="record">
@@ -22,6 +23,9 @@
<if test="record.userId != null">
user_id,
</if>
<if test="record.type != null">
type,
</if>
<if test="record.deleted != null">
deleted,
</if>
@@ -39,6 +43,9 @@
<if test="record.userId != null">
#{record.userId},
</if>
<if test="record.type != null">
#{record.type},
</if>
<if test="record.deleted != null">
#{record.deleted},
</if>
@@ -61,6 +68,9 @@
<if test="userId != null">
user_id = #{userId},
</if>
<if test="type != null">
type = #{type},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
@@ -74,7 +84,11 @@
where id = #{id}
</update>
<update id="deleteUserRole">
update enterprise_user_role set deleted = 1 where role_id = #{roleId} and user_id not in <foreach collection="userIds" item="userId" separator="," open="(" close=")">#{userId}</foreach>
<update id="deleteRoleInUser">
update enterprise_user_role set deleted = 1 where role_id = #{roleId} and type = #{type} and user_id not in <foreach collection="excludeUserIds" item="userId" separator="," open="(" close=")">#{userId}</foreach>
</update>
<update id="deleteUserInRole">
update enterprise_user_role set deleted = 1 where role_id != #{excludeRoleId} and user_id = #{userId} and type = #{type}
</update>
</mapper>

View File

@@ -32,6 +32,14 @@
work_exp, is_consumer, other_band, brand_strength, need_improve, strength, weakness,
create_time, update_time
</sql>
<select id="selectByPrimaryKeySelective" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from hy_partner_intent_info
<where>
and id = #{id}
</where>
</select>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into hy_partner_intent_info
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -243,4 +251,41 @@
</set>
where id = #{record.id}
</update>
<select id="selectPartnerIntentApplyInfoList" resultType="com.cool.store.dto.partner.PartnerIntentApplyInfoDTO">
select
a.id as partnerLineId,
a.partner_id as partnerId,
a.workflow_stage as workflowStage,
a.workflow_status as workflowStatus,
b.id as id,
b.create_time as partnerSubmitTime,
b.live_area as liveArea,
b.want_shop_area as wantShopArea,
b.accept_adjust_type as acceptAdjustType,
b.deadline as deadline
from hy_partner_intent_info b left join hy_partner_line_info a on a.id = b.partner_line_id
<where>
<if test="userId!=null and userId!=''">
and a.investment_manager = #{userId}
</if>
<if test="workflowStage!=null and workflowStage!=''">
and a.workflow_stage= #{workflowStage}
</if>
<if test="workflowStatus!=null and workflowStatus!=''">
and a.workflow_status = #{workflowStatus}
</if>
</where>
order by b.create_time
</select>
<select id="selectByLineId" resultType="com.cool.store.dto.partner.PartnerIntentApplyInfoDTO">
select
<include refid="Base_Column_List"></include>
from hy_partner_intent_info
<where>
and partner_line_id = #{lineId}
</where>
</select>
</mapper>

View File

@@ -172,4 +172,69 @@
</set>
where id = #{record.id}
</update>
<select id="getCurrentDateInterviewCount" resultType="java.lang.Integer">
select count(1) from hy_partner_interview_plan
<where>
<if test="userId!=null and userId!=''">
and interviewer = #{userId}
</if>
<if test="currentDate!=null and currentDate!=''">
and interview_date = #{currentDate}
</if>
</where>
</select>
<select id="getInterviewCount" resultType="com.cool.store.dto.partner.SpecialDateRangeInterviewCountDTO">
select
sum(if(interview_date=#{currentDate},1,0)) as currentDayInterviewCount,
sum(if(start_time>#{startTime} and #{endTime},1,0)) as lastSevenDayInterviewCount
FROM hy_partner_interview_plan
where interviewer = #{userId}
</select>
<select id="getInterviewPlanList" resultMap="BaseResultMap">
select * from hy_partner_interview_plan
<where>
<if test="userId!=null and userId!=''">
and interviewer = #{userId}
</if>
<if test="currentDate!=null and currentDate!=''">
and interview_date = #{currentDate}
</if>
and (start_time>now() or (start_time<![CDATA[<]]>now() and room_status!=2))
order by start_time
</where>
</select>
<select id="getPartnerInterviewInfoList" resultType="com.cool.store.dto.partner.PartnerInterviewInfoDTO">
select
a.id as id,
a.deadline as deadline,
a.status as status,
a.auth_code as authCode,
a.approve_time as approveTime,
a.process_info as processInfo,
b.id as interviewId,
b.partner_line_id as partnerLineId,
b.partner_id as partnerId,
b.start_time as startTime,
b.end_time as endTime,
b.interviewer as interviewer,
b.create_time as createTime,
b.room_id as roomId
from hy_partner_interview a inner join hy_partner_interview_plan b on a.interview_plan_id = b.id
<where>
<if test="userId!=null and userId!=''">
and a.interviewer = #{userId}
</if>
<if test="workflowStage!=null and workflowStage!=''">
and a.workflow_stage= #{workflowStage}
</if>
<if test="workflowStatus!=null and workflowStatus!=''">
and a.workflow_status = #{workflowStatus}
</if>
</where>
</select>
</mapper>

View File

@@ -27,6 +27,49 @@
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=",">
@@ -190,7 +233,154 @@
<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=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
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="keyWord!=null and keyWord !=''">
and (b.username like concat('%', #{keyWord}, '%') or b.mobile like concat('%', #{keyWord}, '%'))
</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>
</mapper>

View File

@@ -18,6 +18,25 @@
id, partner_id, mobile, username, live_area, want_shop_area, accept_adjust_type,
invite_code, is_write_partner_know, create_time, update_time
</sql>
<select id="selectByPartnerId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
where partner_id = #{partnerId}
</select>
<select id="selectByPartnerIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
<if test="partnerIdList!=null and partnerIdList.size>0">
<foreach collection="partnerIdList" open="and partner_id in (" close=")" separator="," item="partnerId">
#{partnerId}
</foreach>
</if>
</select>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into hy_partner_user_info
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -158,4 +158,23 @@
<update id="deleteNotExistRegion">
update region set deleted = 1 , update_time = UNIX_TIMESTAMP() where region_id not in <foreach collection="regionIds" separator="," item="regionId" open="(" close=")"> #{regionId}</foreach>
</update>
<select id="getRegionByRegionIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
region
where
region_id in <foreach collection="regionIds" item="regionId" separator="," open="(" close=")">#{regionId}</foreach>
</select>
<select id="getRegionBaseInfoList" resultMap="BaseResultMap">
select
region_id, name, parent_id
from
region
where
deleted = 0
</select>
</mapper>

View File

@@ -126,7 +126,16 @@
from
sys_role r inner join enterprise_user_role e on r.role_id = e.role_id
where
e.user_id = #{userId}
e.user_id = #{userId} and r.deleted = 0
limit 1
</select>
<select id="getRoleByName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
sys_role
where
role_name = #{roleName} and role_type = #{roleType} and deleted = 0 limit 1
</select>
</mapper>

View File

@@ -104,10 +104,19 @@
where id = #{id}
</update>
<delete id="deleteUserRegion">
<update id="deleteUserRegion">
update user_region_mapping set deleted = 1 where region_id = #{regionId} and type = #{type}
<if test="excludeUserIds != null and excludeUserIds.size() > 0">
and user_id not in <foreach collection="excludeUserIds" separator="," open="(" close=")" item="userId" >#{userId}</foreach>
</if>
</delete>
</update>
<update id="deleteRegionUserByExcludeRegionIds">
update user_region_mapping set deleted = 1 where region_id not in <foreach collection="excludeRegionIds" open="(" close=")" separator="," item="regionId">#{regionId}</foreach>
</update>
<update id="deleteRegionUserByExcludeUserIds">
update user_region_mapping set deleted = 1 where user_id not in <foreach collection="excludeUserIds" open="(" close=")" separator="," item="userId">#{userId}</foreach>
</update>
</mapper>