|
|
@@ -76,17 +76,37 @@
|
|
|
where srp.type = 0 and srp.suggest_id = #{userId}
|
|
|
</select>
|
|
|
|
|
|
+ <select id="queryPartnerById" resultType="com.ydtech.modules.admin.model.SysPartner">
|
|
|
+ select sal.*
|
|
|
+ from sys_partner sal
|
|
|
+ left join sys_relation_person srp on srp.agency_leader_id=sal.user_id
|
|
|
+ <where>
|
|
|
+ srp.type = 0
|
|
|
+ <if test="userId != null and userId != '' ">
|
|
|
+ and srp.suggest_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.beginTime != null and dto.beginTime != '' and dto.endTime != null and dto.endTime != ''">
|
|
|
+ and (DATE_FORMAT(sal.create_time, '%Y-%m-%d %H:%i:%s') between DATE_FORMAT( #{dto.beginTime}, '%Y-%m-%d %H:%i:%s') and DATE_FORMAT( #{dto.endTime}, '%Y-%m-%d %H:%i:%s'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
|
|
|
<select id="queryDeptByTimes" resultType="com.ydtech.modules.admin.model.vo.CountUserNumVo">
|
|
|
select spa.time, COUNT(spa.id) as countNum
|
|
|
from(
|
|
|
SELECT
|
|
|
s.id,DATE_FORMAT(s.create_time, '%Y-%m-%d %H' ) as time
|
|
|
- FROM sys_user s
|
|
|
+ FROM sys_dept s
|
|
|
<where>
|
|
|
- s.type = 3 and s.status in (1, 4, 5, 6, 7)
|
|
|
- <if test="userId != null ">
|
|
|
- and s.referrer_id = #{userId}
|
|
|
+ s.del_flag = 0
|
|
|
+ <if test="deptIds != null and deptIds != '' and deptIds.size() > 0">
|
|
|
+ AND s.id in
|
|
|
+ <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
|
|
+ #{deptId}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
<if test="dto.beginTime != null and dto.beginTime != '' and dto.endTime != null and dto.endTime != ''">
|
|
|
and (DATE_FORMAT(s.create_time, '%Y-%m-%d' ) like CONCAT( DATE_FORMAT( #{dto.beginTime}, '%Y-%m-%d' ), '%' ))
|
|
|
@@ -104,14 +124,17 @@
|
|
|
from(
|
|
|
SELECT
|
|
|
s.id,DATE_FORMAT(s.create_time, '%Y-%m-%d' ) as time
|
|
|
- FROM sys_user s
|
|
|
+ FROM sys_dept s
|
|
|
<where>
|
|
|
- s.type = 3 and s.status in (1, 4, 5, 6, 7)
|
|
|
- <if test="userId != null ">
|
|
|
- and s.referrer_id = #{userId}
|
|
|
+ s.del_flag = 0
|
|
|
+ <if test="deptIds != null and deptIds != '' and deptIds.size() > 0">
|
|
|
+ AND s.id in
|
|
|
+ <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
|
|
+ #{deptId}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
<if test="dto.beginTime != null and dto.beginTime != '' and dto.endTime != null and dto.endTime != ''">
|
|
|
- and (DATE_FORMAT(s.create_time, '%Y-%m-%d') between DATE_FORMAT( #{dto.beginTime}, '%Y-%m-%d') and DATE_FORMAT( #{dto.endTime}, '%Y-%m-%d'))
|
|
|
+ and (DATE_FORMAT(s.create_time, '%Y-%m-%d %H:%i:%s') between DATE_FORMAT( #{dto.beginTime}, '%Y-%m-%d %H:%i:%s') and DATE_FORMAT( #{dto.endTime}, '%Y-%m-%d %H:%i:%s'))
|
|
|
</if>
|
|
|
</where>
|
|
|
) as spa
|
|
|
@@ -162,7 +185,7 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="dto.beginTime != null and dto.beginTime != '' and dto.endTime != null and dto.endTime != ''">
|
|
|
- and (DATE_FORMAT(s.create_time, '%Y-%m-%d') between DATE_FORMAT( #{dto.beginTime}, '%Y-%m-%d') and DATE_FORMAT( #{dto.endTime}, '%Y-%m-%d'))
|
|
|
+ and (DATE_FORMAT(s.create_time, '%Y-%m-%d %H:%i:%s') between DATE_FORMAT( #{dto.beginTime}, '%Y-%m-%d %H:%i:%s') and DATE_FORMAT( #{dto.endTime}, '%Y-%m-%d %H:%i:%s'))
|
|
|
</if>
|
|
|
</where>
|
|
|
) as spa
|
|
|
@@ -172,6 +195,56 @@
|
|
|
spa.time ASC
|
|
|
|
|
|
</select>
|
|
|
+ <select id="queryPartnerByTimes" resultType="com.ydtech.modules.admin.model.vo.CountUserNumVo">
|
|
|
+ select spa.time, COUNT(spa.id) as countNum
|
|
|
+ from(
|
|
|
+ SELECT
|
|
|
+ s.id,DATE_FORMAT(s.create_time, '%Y-%m-%d %H' ) as time
|
|
|
+ FROM sys_partner s
|
|
|
+ left join sys_relation_person srp on srp.agency_leader_id = s.user_id
|
|
|
+ <where>
|
|
|
+ s.del_flag = 1 and srp.type = 0
|
|
|
+ <if test="userId != null and userId != '' ">
|
|
|
+ and srp.suggest_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.type != null and dto.type != 0 ">
|
|
|
+ and s.type = #{dto.type}
|
|
|
+ </if>
|
|
|
+ <if test="dto.beginTime != null and dto.beginTime != '' and dto.endTime != null and dto.endTime != ''">
|
|
|
+ and (DATE_FORMAT(s.create_time, '%Y-%m-%d' ) like CONCAT( DATE_FORMAT( #{dto.beginTime}, '%Y-%m-%d' ), '%' ))
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) as spa
|
|
|
+ GROUP BY
|
|
|
+ spa.time
|
|
|
+ ORDER BY
|
|
|
+ spa.time ASC
|
|
|
+ </select>
|
|
|
+ <select id="queryPartnerByTime" resultType="com.ydtech.modules.admin.model.vo.CountUserNumVo">
|
|
|
+ select spa.time, COUNT(spa.id) as countNum
|
|
|
+ from(
|
|
|
+ SELECT
|
|
|
+ s.id,DATE_FORMAT(s.create_time, '%Y-%m-%d' ) as time
|
|
|
+ FROM sys_partner s
|
|
|
+ left join sys_relation_person srp on srp.agency_leader_id = s.user_id
|
|
|
+ <where>
|
|
|
+ s.del_flag = 1 and srp.type = 0
|
|
|
+ <if test="userId != null and userId != '' ">
|
|
|
+ and srp.suggest_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.type != null and dto.type != 0 ">
|
|
|
+ and s.type = #{dto.type}
|
|
|
+ </if>
|
|
|
+ <if test="dto.beginTime != null and dto.beginTime != '' and dto.endTime != null and dto.endTime != ''">
|
|
|
+ and (DATE_FORMAT(s.create_time, '%Y-%m-%d %H:%i:%s') between DATE_FORMAT( #{dto.beginTime}, '%Y-%m-%d %H:%i:%s') and DATE_FORMAT( #{dto.endTime}, '%Y-%m-%d %H:%i:%s'))
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) as spa
|
|
|
+ GROUP BY
|
|
|
+ spa.time
|
|
|
+ ORDER BY
|
|
|
+ spa.time ASC
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
</mapper>
|