|
|
@@ -1094,84 +1094,99 @@
|
|
|
|
|
|
<select id="selectAdminCustomerDetailList" resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
|
|
|
select a.id,a.nickname as name,a.source,c.name contacts,c.mobile as contactMobile,
|
|
|
- a.create_time as createTime,b.time_stamp as followTime,ifnull(d.update_time,e.update_time) updateTime
|
|
|
+ a.create_time as createTime,b.time_stamp as followTime
|
|
|
from user a
|
|
|
left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
|
|
|
left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
|
|
|
- left join (select uid,update_time from user_business where follow_situation=5)d on a.id=d.uid
|
|
|
- left join (select uid,update_time from user_business where follow_situation=6)e on a.id=e.uid
|
|
|
- where a.aid is not null and a.share_type=0 and a.type=1
|
|
|
- <if test="aid != null">
|
|
|
+ <if test="type==3 or type==4">
|
|
|
+ left join (select aid,uid from user_business
|
|
|
+ <if test="type==3">
|
|
|
+ where follow_situation=5
|
|
|
+ </if>
|
|
|
+ <if test="type==4">
|
|
|
+ where follow_situation=1
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null">
|
|
|
+ and update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ group by aid,uid)d on a.id=d.uid
|
|
|
+ </if>
|
|
|
+ where a.type=1
|
|
|
+ <if test=" type !=3 and type !=4 and aid != null">
|
|
|
and a.aid= #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="type==null">
|
|
|
- and a.source in(1,2,3)
|
|
|
+ <if test=" (type ==3 or type ==4) and aid != null">
|
|
|
+ and d.aid= #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="type == 0">
|
|
|
+ <if test="type == 0">
|
|
|
+ and a.source in (1,2,3)
|
|
|
+ </if>
|
|
|
+ <if test="type==0 or type==1 or type==2 ">
|
|
|
+ and a.share_type=0
|
|
|
+ </if>
|
|
|
+ <if test="type == 1">
|
|
|
and a.source =1
|
|
|
<if test="startTime != null and endTime != null">
|
|
|
and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="type == 1">
|
|
|
+ <if test="type == 2">
|
|
|
and a.source =2
|
|
|
<if test="startTime != null and endTime != null">
|
|
|
and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="type == 2">
|
|
|
- and d.follow_situation=5
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and d.update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="type == 3">
|
|
|
- and d.follow_situation=6
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and e.update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
<if test="page_sql!=null">
|
|
|
${page_sql}
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectAdminCustomerDetailCount" parameterType="java.lang.String" resultType="java.lang.Integer">
|
|
|
- select count(*) from user a
|
|
|
- left join (select uid,update_time,follow_situation from user_business where follow_situation=5)d on a.id=d.uid
|
|
|
- left join (select uid,update_time,follow_situation from user_business where follow_situation=6)e on a.id=e.uid
|
|
|
- where a.aid is not null and a.share_type=0 and a.type=1
|
|
|
- <if test="aid != null">
|
|
|
+ select count(*)
|
|
|
+ from user a
|
|
|
+ left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
|
|
|
+ left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
|
|
|
+ <if test="type==3 or type==4">
|
|
|
+ left join (select aid,uid from user_business
|
|
|
+ <if test="type==3">
|
|
|
+ where follow_situation=5
|
|
|
+ </if>
|
|
|
+ <if test="type==4">
|
|
|
+ where follow_situation=1
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null">
|
|
|
+ and update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ group by aid,uid)d on a.id=d.uid
|
|
|
+ </if>
|
|
|
+ where a.type=1
|
|
|
+ <if test=" type !=3 and type !=4 and aid != null">
|
|
|
and a.aid= #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="type==null">
|
|
|
- and a.source in(1,2,3)
|
|
|
+ <if test=" (type ==3 or type ==4) and aid != null">
|
|
|
+ and d.aid= #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="type == 0">
|
|
|
- and a.source =1
|
|
|
+ <if test="type == 0">
|
|
|
+ and a.source in (1,2,3) and a.share_type=0
|
|
|
+ </if>
|
|
|
+ <if test="type==0 or type==1 or type==2 ">
|
|
|
+ and a.share_type=0
|
|
|
+ </if>
|
|
|
+ <if test="type == 1">
|
|
|
+ and a.source =1
|
|
|
<if test="startTime != null and endTime != null">
|
|
|
and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="type == 1">
|
|
|
+ <if test="type == 2">
|
|
|
and a.source =2
|
|
|
<if test="startTime != null and endTime != null">
|
|
|
and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="type == 2">
|
|
|
- and d.follow_situation=5
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and d.update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="type == 3">
|
|
|
- and e.follow_situation=6
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and e.update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
<select id="listNameByDepAndName" resultType="java.lang.String">
|
|
|
select a.id from admin a left join user_role b on a.id =b.uid
|
|
|
left join `role` c on b.rid=c.id
|