| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ydtech.modules.admin.dao.SysTelemarketingWechatDataMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.po.SysTelemarketingWechatData">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="userId" column="user_id" jdbcType="VARCHAR"/>
- <result property="number" column="number" jdbcType="INTEGER"/>
- <result property="createTime" column="create_time" jdbcType="DATE"/>
- <result property="updateTime" column="update_time" jdbcType="DATE"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,user_id,number,
- create_time, update_time
- </sql>
- <select id="queryUserDataPage" resultType="com.ydtech.modules.admin.model.dto.DxReportDataDto">
- SELECT
- t1.id AS userId,
- t1.NAME AS userName,
- t1.mobile AS mobile,
- t2.id AS deptId,
- t2.`name` AS deptName,
- t5.NAME AS groupName,
- t5.id AS groupId,
- zgd.zgd_user_id AS zgdUserId,
- zzb.zzb_user_id AS zzdUserId,
- dx.dx_user_id AS dxUserId
- FROM
- sys_user t1
- LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
- LEFT JOIN sys_user_link_dx_user_id dx ON t1.id = dx.user_id
- LEFT JOIN sys_user_link_dept_internal_agent t4 ON t4.user_id = t1.id
- LEFT JOIN sys_user_link_zgd_user_id zgd ON t1.id = zgd.user_id
- LEFT JOIN sys_user_link_zzb_user_id zzb ON t1.id = zzb.user_id
- LEFT JOIN
- (select t3.bind_dept_id,t4.id,t4.name from sys_dept_internal_agent t3 left join sys_dept_internal_agent t4 on t4.parent_id =t3.id ) t5
- ON t2.id = t5.bind_dept_id
- WHERE
- t1.`status` = 1
- AND t1.dept_id= '9914D13'
- AND ( t1.id != '9914D1305' and t1.id != '9914D1316' )
- <if test='vo !=null '>
- <if test='vo.userName !=null and vo.userName!="" '>
- and t1.name like CONCAT('%', #{vo.userName}, '%')
- </if>
- <if test='vo.userId !=null and vo.userId!="" '>
- and t1.id = #{vo.userId}
- </if>
- <if test='vo.deptId !=null and vo.deptId!="" '>
- and t2.id like CONCAT('', #{vo.deptId}, '%')
- </if>
- <if test='vo.mobile !=null and vo.mobile!="" '>
- and t1.mobile = #{vo.mobile}
- </if>
- <if test='vo.groupId !=null and vo.groupId!="" '>
- and t5.id like CONCAT('', #{vo.groupId}, '%')
- </if>
- <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
- AND t2.id in
- <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
- AND t1.id in
- <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- order by t1.id
- </select>
- <select id="queryDataPage" resultType="com.ydtech.modules.admin.model.dto.DxReportDataDto">
- select
- a.dateStr as dateTime,
- ifnull(b.number,0) as wxCount
- from
- ( SELECT
- DATE_ADD(#{vo.beginDate}, INTERVAL seq.seq DAY) AS dateStr
- FROM (
- SELECT (t3.num*100 + t2.num*10 + t1.num) AS seq
- FROM (SELECT 0 AS num UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) AS t1,
- (SELECT 0 AS num UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) AS t2,
- (SELECT 0 AS num UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) AS t3
- ) AS seq
- WHERE DATE_ADD(#{vo.beginDate}, INTERVAL seq.seq DAY) <= #{vo.endDate} order BY DATE_ADD(#{vo.beginDate}, INTERVAL seq.seq DAY)
- ) a
- left join ( select create_time,user_id,number from sys_telemarketing_wechat_data where user_id =#{vo.userId}) b ON
- a.dateStr = date(b.create_time)
- order by a.dateStr
- </select>
- <select id="queryCountByUserId" resultType="java.lang.Integer">
- SELECT
- sum(number)
- FROM
- sys_telemarketing_wechat_data
- <where>
- user_id =#{vo.userId}
- <if test="vo.beginDate != null and vo.beginDate != '' and vo.endDate != null and vo.endDate != '' ">
- AND create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
- </if>
- </where>
- </select>
- <select id="findDataByUserId" resultType="com.ydtech.modules.admin.model.dto.DxReportDataDto">
- SELECT
- t1.id AS userId,
- t1.NAME AS userName,
- t1.mobile AS mobile,
- t2.id AS deptId,
- t2.`name` AS deptName,
- t5.NAME AS groupName,
- t5.id AS groupId,
- zgd.zgd_user_id AS zgdUserId,
- zzb.zzb_user_id AS zzdUserId,
- dx.dx_user_id AS dxUserId
- FROM
- sys_user t1
- LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
- LEFT JOIN sys_user_link_dx_user_id dx ON t1.id = dx.user_id
- LEFT JOIN sys_user_link_dept_internal_agent t4 ON t4.user_id = t1.id
- LEFT JOIN sys_user_link_zgd_user_id zgd ON t1.id = zgd.user_id
- LEFT JOIN sys_user_link_zzb_user_id zzb ON t1.id = zzb.user_id
- LEFT JOIN
- (select t3.bind_dept_id,t4.id,t4.name from sys_dept_internal_agent t3 left join sys_dept_internal_agent t4 on t4.parent_id =t3.id ) t5
- ON t2.id = t5.bind_dept_id
- WHERE
- t1.`status` = 1
- AND t1.dept_id= '9914D13'
- AND ( t1.id != '9914D1305' and t1.id != '9914D1316' )
- and t1.id = #{userId}
- </select>
- </mapper>
|