|
@@ -654,6 +654,133 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<include refid="selectQwExternalContactVo"/>
|
|
|
where fs_user_id = #{userId} and company_user_id = #{companyUserId}
|
|
|
</select>
|
|
|
+ <select id="selectQwExternalContactListVONewSys" resultType="com.fs.qw.vo.QwExternalContactVO">
|
|
|
+ select ec.*, qu.qw_user_name, qd.dept_name as departmentName
|
|
|
+ from qw_external_contact ec
|
|
|
+ left join qw_user qu on ec.user_id = qu.qw_user_id and qu.corp_id = ec.corp_id
|
|
|
+ left join qw_dept qd on qd.dept_id = qu.department and qd.corp_id = qu.corp_id
|
|
|
+ left join company_user cu on ec.company_user_id = cu.user_id
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and ec.user_id like concat(#{userId}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="qwUserName != null and qwUserName != ''">
|
|
|
+ and qu.qw_user_name like concat(#{qwUserName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="externalUserId != null and externalUserId != ''">
|
|
|
+ and ec.external_user_id = #{externalUserId}
|
|
|
+ </if>
|
|
|
+ <if test="wayId != null and wayId != ''">
|
|
|
+ and SUBSTRING_INDEX(ec.state, ':', -1) = #{wayId}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and ec.name like concat(#{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ and ec.type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="gender != null">
|
|
|
+ and ec.gender = #{gender}
|
|
|
+ </if>
|
|
|
+ <if test="description != null and description != ''">
|
|
|
+ and ec.description = #{description}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="tagIds != null and tagIds.size() != 0">
|
|
|
+ and (
|
|
|
+ <foreach collection="tagIds" item="item" index="index" separator=" AND ">
|
|
|
+ find_in_set(#{item}, REGEXP_REPLACE(ec.tag_ids, '[\"\\[\\]]', ''))
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="remarkMobiles != null and remarkMobiles != ''">
|
|
|
+ and ec.remark_mobiles like concat(#{remarkMobiles}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="remark != null and remark != ''">
|
|
|
+ and ec.remark like concat('%', #{remark}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="remarkCorpName != null and remarkCorpName != ''">
|
|
|
+ and ec.remark_corp_name like concat('%', #{remarkCorpName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="addWay != null">
|
|
|
+ and ec.add_way = #{addWay}
|
|
|
+ </if>
|
|
|
+ <if test="operUserid != null and operUserid != ''">
|
|
|
+ and ec.oper_userid = #{operUserid}
|
|
|
+ </if>
|
|
|
+ <if test="corpId != null and corpId != ''">
|
|
|
+ and ec.corp_id = #{corpId}
|
|
|
+ </if>
|
|
|
+ <!--<if test="companyId != null">
|
|
|
+ and qu.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null">
|
|
|
+ and ec.company_user_id = #{companyUserId}
|
|
|
+ </if>-->
|
|
|
+ <if test="customerId != null">
|
|
|
+ and ec.customer_id = #{customerId}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and ec.status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="stageStatus != null">
|
|
|
+ and ec.stage_status = #{stageStatus}
|
|
|
+ </if>
|
|
|
+ <if test="transferStatus != null">
|
|
|
+ and ec.transfer_status = #{transferStatus}
|
|
|
+ </if>
|
|
|
+ <if test="qwUserId != null">
|
|
|
+ and ec.qw_user_id = #{qwUserId}
|
|
|
+ </if>
|
|
|
+ <if test="level != null">
|
|
|
+ and ec.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="levelType != null">
|
|
|
+ and ec.level_type = #{levelType}
|
|
|
+ </if>
|
|
|
+ <if test="isBind == 'isBind'">
|
|
|
+ and ec.customer_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="isBind == 'noBind'">
|
|
|
+ and ec.customer_id is null
|
|
|
+ </if>
|
|
|
+ <if test="isBindMini == 'isBindMini'">
|
|
|
+ and ec.fs_user_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="isBindMini == 'noBindMini'">
|
|
|
+ and ec.fs_user_id is null
|
|
|
+ </if>
|
|
|
+ <if test="lossTime != null">
|
|
|
+ and DATE(ec.loss_time) = DATE(#{lossTime})
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ and DATE(ec.create_time) = DATE(#{createTime})
|
|
|
+ </if>
|
|
|
+ <if test="delTime != null">
|
|
|
+ and DATE(ec.del_time) = DATE(#{delTime})
|
|
|
+ </if>
|
|
|
+ <if test="sTime != null">
|
|
|
+ and DATE(ec.create_time) >= DATE(#{sTime})
|
|
|
+ </if>
|
|
|
+ <if test="eTime != null">
|
|
|
+ and DATE(ec.create_time) <= DATE(#{eTime})
|
|
|
+ </if>
|
|
|
+ <if test="companyUserName != null and companyUserName != ''">
|
|
|
+ and cu.user_name = #{companyUserName}
|
|
|
+ </if>
|
|
|
+ <if test="cuDeptIdList != null and !cuDeptIdList.isEmpty() and userType != '00'">
|
|
|
+ AND cu.dept_id IN
|
|
|
+ <foreach collection="cuDeptIdList" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="companyUser != null">
|
|
|
+ and (cu.nick_name like concat('%', #{companyUser}, '%') or cu.phonenumber = #{companyUser})
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by ec.create_time desc, ec.id desc
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
</mapper>
|