|
|
@@ -327,7 +327,7 @@
|
|
|
<select id="selectOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
|
|
|
select
|
|
|
a.id as uid,
|
|
|
- a.identify_name as name,
|
|
|
+ a.nickname as name,
|
|
|
date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
|
|
|
dg1.name as province,
|
|
|
dg2.name as city,
|
|
|
@@ -338,6 +338,7 @@
|
|
|
a.channel ,
|
|
|
a.information_maintainer as mid
|
|
|
from `user` a
|
|
|
+ left join user_names un on a.id=un.uid
|
|
|
left join organization_identity b on a.id = b.uid
|
|
|
left join district_glossory dg1 on b.location_province = dg1.id
|
|
|
left join district_glossory dg2 on b.location_city = dg2.id
|
|
|
@@ -345,10 +346,10 @@
|
|
|
left join admin d on a.aid = d.id
|
|
|
where a.type = 1 and a.status != 1
|
|
|
<if test="role == 0">
|
|
|
- and a.identify_name = #{name}
|
|
|
+ and un.name = #{name}
|
|
|
</if>
|
|
|
<if test="role == 1">
|
|
|
- and a.identify_name like concat('%', #{name},'%')
|
|
|
+ and a.nickname like concat('%', #{name},'%')
|
|
|
</if>
|
|
|
<if test="aid != null and aid !=''">
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
@@ -379,6 +380,7 @@
|
|
|
select
|
|
|
count(0)
|
|
|
from user a
|
|
|
+ left join user_names un on a.id=un.uid
|
|
|
left join organization_identity b on a.id = b.uid
|
|
|
<if test="departmentId != null and departmentId !=''">
|
|
|
INNER join (select id
|
|
|
@@ -387,11 +389,11 @@
|
|
|
</if>
|
|
|
where a.type = 1 and a.status != 1
|
|
|
<if test="role == 0">
|
|
|
- and a.identify_name = #{name}
|
|
|
+ and un.name = #{name}
|
|
|
</if>
|
|
|
<if test="role == 1">
|
|
|
- and a.identify_name like concat('%', #{name},'%')
|
|
|
- </if>
|
|
|
+ and a.nickname like concat('%', #{name},'%')
|
|
|
+ </if>
|
|
|
<if test="aid != null and aid !=''">
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
@@ -413,7 +415,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPrivateOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
|
|
|
- select a.id uid,a.aid,a.identify_name name,a.society_tag societyTag,a.`level`,b.name aName,dg1.name as province,dg2.name as city,
|
|
|
+ select a.id uid,a.aid,a.nickname name,a.society_tag societyTag,a.`level`,b.name aName,dg1.name as province,dg2.name as city,
|
|
|
a.guidance, dg3.name as area,
|
|
|
date_format(um.last_sign_time,'%Y-%m-%d %H:%i:%S') lastSignTime,
|
|
|
date_format(a.transfer_time,'%Y-%m-%d %H:%i:%S') as transferTime,
|
|
|
@@ -430,13 +432,18 @@
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="power ==1 or power ==2">
|
|
|
- and a.aid in
|
|
|
+ and a.aid
|
|
|
+ <if test="alist2 !=null">
|
|
|
<foreach item="item" collection="alist" separator="," open="(" close=")" index="">
|
|
|
- #{item}
|
|
|
+ in #{item}
|
|
|
</foreach>
|
|
|
+ </if>
|
|
|
+ <if test="alist2 !=null">
|
|
|
+ is null
|
|
|
+ </if>
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.identify_name like concat('%',#{name},'%')
|
|
|
+ and a.nickname like concat('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="startDate != null and startDate != ''">
|
|
|
and a.transfer_time > #{startDate}
|
|
|
@@ -465,6 +472,7 @@
|
|
|
<if test="sortType == 1">
|
|
|
desc
|
|
|
</if>
|
|
|
+ ,a.`number`
|
|
|
<if test="page_sql != null">
|
|
|
${page_sql}
|
|
|
</if>
|
|
|
@@ -478,14 +486,19 @@
|
|
|
<if test="power ==0">
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="power ==1 or power ==2">
|
|
|
- and a.aid in
|
|
|
+ <if test="power ==1 or power ==2">
|
|
|
+ and a.aid
|
|
|
+ <if test="alist2 !=null">
|
|
|
<foreach item="item" collection="alist" separator="," open="(" close=")" index="">
|
|
|
- #{item}
|
|
|
+ in #{item}
|
|
|
</foreach>
|
|
|
+ </if>
|
|
|
+ <if test="alist2 !=null">
|
|
|
+ is null
|
|
|
+ </if>
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.identify_name like concat('%',#{name},'%')
|
|
|
+ and a.nickname like concat('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="startDate != null and startDate != ''">
|
|
|
and a.transfer_time > #{startDate}
|
|
|
@@ -509,7 +522,7 @@
|
|
|
<select id="selectPublicOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
|
|
|
select
|
|
|
a.id as uid,
|
|
|
- a.identify_name as name,
|
|
|
+ a.nickname as name,
|
|
|
a.create_time as createTime,
|
|
|
a.transfer_time as transferTime,
|
|
|
dg1.name as province,
|
|
|
@@ -527,7 +540,7 @@
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.identify_name like concat('%',#{name},'%')
|
|
|
+ and a.nickname like concat('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="startDate != null and startDate != ''">
|
|
|
and a.transfer_time > #{startDate}
|
|
|
@@ -572,7 +585,7 @@
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.identify_name like concat('%',#{name},'%')
|
|
|
+ and a.nickname like concat('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="startDate != null and startDate != ''">
|
|
|
and a.transfer_time > #{startDate}
|
|
|
@@ -594,7 +607,7 @@
|
|
|
select
|
|
|
a.id as uid,
|
|
|
a.society_tag as societyTag,
|
|
|
- a.identify_name as name,
|
|
|
+ a.nickname as name,
|
|
|
a.share_type as shareType,
|
|
|
date_format(a.transfer_time,'%Y-%m-%d %H:%i:%S') as transferTime,
|
|
|
dg1.name as province,
|
|
|
@@ -617,7 +630,7 @@
|
|
|
and a.channel= #{channel}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.identify_name like concat('%',#{name},'%')
|
|
|
+ and a.nickname like concat('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="shareType != null">
|
|
|
and a.share_type = #{shareType,jdbcType=VARCHAR}
|
|
|
@@ -637,7 +650,7 @@
|
|
|
<if test="area != null">
|
|
|
and b.location_area = #{area,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
- order by a.transfer_time desc
|
|
|
+ order by a.transfer_time desc,a.`number`
|
|
|
<if test="page_sql != null">
|
|
|
${page_sql}
|
|
|
</if>
|
|
|
@@ -677,7 +690,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="findCustomerByName" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
|
|
|
- select id,identify_name as name from user where identify_name like
|
|
|
+ select id,nickname as name from user where identify_name like
|
|
|
concat('%',#{identifyName},'%') and status <![CDATA[!= ]]> 1 and audit_status = 1
|
|
|
</select>
|
|
|
|
|
|
@@ -784,7 +797,7 @@
|
|
|
|
|
|
<select id="selectFollowHistoryList" resultType="com.goafanti.customer.bo.FollowListBo">
|
|
|
select a.id as followId, a.aid,date_format( a.create_time,'%Y-%m-%d %H:%i:%S') as followTime, a.contact_type as contactType,
|
|
|
- a.result,a.guidance, b.identify_name as identifyName, c.name as contacts, c.mobile as contactMobile,
|
|
|
+ a.result,a.guidance, b.nickname,b.identify_name as identifyName, c.name as contacts, c.mobile as contactMobile,
|
|
|
d.name as adminName,date_format(a.guidance_time,'%Y-%m-%d %H:%i:%S') as guidanceTime
|
|
|
<if test="businessProjectId != null and businessProjectId != ''"><!-- 客户甲项目A所有的跟进记录 -->
|
|
|
,e.id as ufbId,e.follow_situation as followSituation,e.customer_status as customerStatus
|
|
|
@@ -852,7 +865,7 @@
|
|
|
|
|
|
<select id="findCustomerContacts" parameterType="java.lang.String" resultType="com.goafanti.common.model.OrganizationContactBook">
|
|
|
select a.id,a.name,a.mobile,a.email,a.qq,a.wechat,a.department,a.position,a.major,a.fixed_tel fixedTel,a.aname,b.location_province,
|
|
|
- d1.name provinceName,d2.name cityName,d3.name areaName,date_format(a.create_time,'%Y-%m-%d')createTimes,aid
|
|
|
+ d1.name provinceName,d2.name cityName,d3.name areaName,date_format(a.create_time,'%Y-%m-%d')createTimes,a.aid
|
|
|
from organization_contact_book a
|
|
|
left join organization_identity b on a.uid=b.uid left join district_glossory d1 on b.location_province=d1.id
|
|
|
left join district_glossory d2 on b.location_city=d2.id left join district_glossory d3 on b.location_area=d3.id
|
|
|
@@ -1417,7 +1430,7 @@
|
|
|
a.type,
|
|
|
a.status,
|
|
|
date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,
|
|
|
- a.identify_name as name,
|
|
|
+ a.nickname as name,
|
|
|
a.society_tag as societyTag,
|
|
|
share_type as shareType,
|
|
|
b.contacts,
|
|
|
@@ -1439,7 +1452,7 @@
|
|
|
and (a.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.identify_name like concat('%',#{name},'%')
|
|
|
+ and a.nickname like concat('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="shareType != null">
|
|
|
and a.share_type = #{shareType,jdbcType=VARCHAR}
|
|
|
@@ -1481,7 +1494,7 @@
|
|
|
and (a.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.identify_name like concat('%',#{name},'%')
|
|
|
+ and a.nickname like concat('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="shareType != null">
|
|
|
and a.share_type = #{shareType,jdbcType=VARCHAR}
|
|
|
@@ -1627,14 +1640,14 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPrivateCustomerByName" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
|
|
|
- select b.id,b.identify_name as name from
|
|
|
+ select b.id,b.nickname as name from
|
|
|
(select uid from user_lock_release where type = 0 and status = 0 and aid = #{aid} group by uid) a
|
|
|
inner join user b on a.uid = b.id
|
|
|
- where b.status != 1 and b.channel =0 and b.identify_name like concat('%',#{name},'%')
|
|
|
+ where b.status != 1 and b.channel =0 and b.nickname like concat('%',#{name},'%')
|
|
|
</select>
|
|
|
|
|
|
<select id="selectSignedCustomerByName" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
|
|
|
- select b.id,b.identify_name as name from user b
|
|
|
+ select b.id,b.nickname as name from user b
|
|
|
where b.status != 1
|
|
|
<if test="type==2">
|
|
|
and b.channel=1
|
|
|
@@ -1642,7 +1655,7 @@
|
|
|
<if test="type==1">
|
|
|
and b.share_type=2
|
|
|
</if>
|
|
|
- and b.aid = #{aid} and b.identify_name like concat('%',#{name},'%')
|
|
|
+ and b.aid = #{aid} and b.nickname like concat('%',#{name},'%')
|
|
|
</select>
|
|
|
|
|
|
<update id="updateReleaseLock" parameterType="java.lang.String">
|
|
|
@@ -2077,12 +2090,12 @@ inner join(
|
|
|
|
|
|
<insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
|
|
|
INSERT INTO `user` (id, mobile, password,
|
|
|
- nickname,identify_name,
|
|
|
+ nickname,identify_name,username,
|
|
|
share_type,type,society_tag,channel,source,status)VALUES
|
|
|
<foreach item="item" index="index" collection="list"
|
|
|
separator=",">
|
|
|
(#{item.uid,jdbcType=VARCHAR}, #{item.contactMobile,jdbcType=VARCHAR},#{item.password,jdbcType=VARCHAR},
|
|
|
- #{item.userName},#{item.userName},
|
|
|
+ #{item.userName},#{item.userName},#{item.userName},
|
|
|
#{item.shareType,jdbcType=TIMESTAMP}, 1,#{item.societyTag},1,1 ,#{item.userStatus})
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
@@ -2154,7 +2167,7 @@ inner join(
|
|
|
<if test="startTime!=null and endTime !=null">
|
|
|
and a.create_time between #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
- order by a.status ,a.create_time desc
|
|
|
+ order by a.status ,a.create_time desc,a.id
|
|
|
<if test="page_sql != null">
|
|
|
${page_sql}
|
|
|
</if>
|
|
|
@@ -2286,7 +2299,13 @@ inner join(
|
|
|
where r.role_type=80
|
|
|
</select>
|
|
|
|
|
|
- <select id="getUserByName" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
|
|
|
- select id,nickname name from `user` where nickname like concat('%',#{name},'%')
|
|
|
+ <select id="getUserByNameList" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
|
|
|
+ select id,nickname name from `user` where nickname like concat('%',#{name},'%')
|
|
|
+ <if test="page_sql != null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="getUserByNameCount" resultType="java.lang.Integer" >
|
|
|
+ select count(*) from `user` where nickname like concat('%',#{name},'%')
|
|
|
</select>
|
|
|
</mapper>
|