|
|
@@ -1049,4 +1049,78 @@
|
|
|
select b.id from admin_contacts a left join admin b on a.contacts_id = b.id
|
|
|
where b.status = '正常' and a.aid= #{id,jdbcType=VARCHAR}
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectAdminCustomerList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminCustomerBo">
|
|
|
+ select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as timeCount from admin a
|
|
|
+ left join (select aid,count(aid) as userCount from user where aid is not null
|
|
|
+ and share_type=0 and source !=0
|
|
|
+ group by aid) b on a.id=b.aid
|
|
|
+ left join (select aid,count(aid) as timeCount from user where aid is not null
|
|
|
+ and share_type=0 and source=1
|
|
|
+ <if test="startTime != null and endTime != null">
|
|
|
+ and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ group by aid) c on a.id=c.aid
|
|
|
+ left join department d on a.department_id=d.id
|
|
|
+ where a.status='正常'
|
|
|
+ and b.userCount !=0
|
|
|
+ <if test="depId != null">
|
|
|
+ and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="page_sql!=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
|
|
|
+ select count(*) from admin a
|
|
|
+ left join (select aid,count(aid) as userCount from user where aid is not null
|
|
|
+ and share_type=0 and source !=0
|
|
|
+ group by aid) b on a.id=b.aid
|
|
|
+ left join (select aid,count(aid) as timeCount from user where aid is not null
|
|
|
+ and share_type=0 and source=1
|
|
|
+ <if test="startTime != null and endTime != null">
|
|
|
+ and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ group by aid) c on a.id=c.aid
|
|
|
+ where a.status='正常'
|
|
|
+ and b.userCount !=0
|
|
|
+ <if test="depId != null">
|
|
|
+ and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectAdminCustomerDetailList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
|
|
|
+ select a.id,a.nickname as name,c.contacts,c.contact_mobile as contactMobile,
|
|
|
+ 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 organization_identity c on a.id=c.uid
|
|
|
+ where a.aid is not null
|
|
|
+ <if test="aid != null">
|
|
|
+ and a.aid= #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ and a.share_type=0 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 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,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
|
|
|
+ left join organization_identity c on a.id=c.uid
|
|
|
+ where a.aid is not null
|
|
|
+ <if test="aid != null">
|
|
|
+ and a.aid= #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ and a.share_type=0 and a.source=1
|
|
|
+ <if test="startTime != null and endTime != null">
|
|
|
+ and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|