|
|
@@ -15,26 +15,51 @@ import java.util.List;
|
|
|
@Mapper
|
|
|
public interface CommonPushTaskMapper extends BaseMapper<CommonPushTask> {
|
|
|
|
|
|
- String TASK_STATS_SELECT = "SELECT t.id, t.task_no AS taskNo, t.title, t.push_type AS pushType, t.status, " +
|
|
|
+ @Select("<script>" +
|
|
|
+ "SELECT " +
|
|
|
+ "IFNULL(SUM(CASE WHEN u.status IN (2, 3) THEN 1 ELSE 0 END), 0) AS sentCount, " +
|
|
|
+ "IFNULL(SUM(CASE WHEN u.status = 3 THEN 1 ELSE 0 END), 0) AS deliveredCount, " +
|
|
|
+ "IFNULL(SUM(CASE WHEN u.user_add = 1 THEN 1 ELSE 0 END), 0) AS clickCount " +
|
|
|
+ "FROM common_push_task t " +
|
|
|
+ "LEFT JOIN common_push_task_user u ON u.push_task_id = t.id AND u.delete_flag = 0 " +
|
|
|
+ "WHERE t.delete_flag = 0 " +
|
|
|
+ "<if test='taskNo != null and taskNo != \"\"'>AND t.task_no = #{taskNo} </if>" +
|
|
|
+ "<if test='keyword != null and keyword != \"\"'>AND (t.title LIKE CONCAT('%', #{keyword}, '%') OR t.task_no LIKE CONCAT('%', #{keyword}, '%')) </if>" +
|
|
|
+ "<if test='status != null and status != \"\"'>AND t.status = #{status} </if>" +
|
|
|
+ "<if test='pushType != null'>AND t.push_type = #{pushType} </if>" +
|
|
|
+ "<if test='channel != null and channel != \"\"'>AND t.channels LIKE CONCAT('%', #{channel}, '%') </if>" +
|
|
|
+ "<if test='startTime != null'>AND t.created_time >= #{startTime} </if>" +
|
|
|
+ "<if test='endTime != null'>AND t.created_time < #{endTime} </if>" +
|
|
|
+ "<if test='startTime != null'>AND u.created_time >= #{startTime} </if>" +
|
|
|
+ "<if test='endTime != null'>AND u.created_time < #{endTime} </if>" +
|
|
|
+ "</script>")
|
|
|
+ CommonPushTaskStatsDto selectStatisticsSummary(@Param("taskNo") String taskNo,
|
|
|
+ @Param("keyword") String keyword,
|
|
|
+ @Param("status") String status,
|
|
|
+ @Param("pushType") Integer pushType,
|
|
|
+ @Param("channel") String channel,
|
|
|
+ @Param("startTime") Date startTime,
|
|
|
+ @Param("endTime") Date endTime);
|
|
|
+
|
|
|
+ @Select("<script>" +
|
|
|
+ "SELECT t.id, t.task_no AS taskNo, t.title, t.push_type AS pushType, t.status, " +
|
|
|
"t.channels, t.estimated_count AS estimatedCount, t.created_time AS createdTime, " +
|
|
|
"IFNULL(SUM(CASE WHEN u.status IN (2, 3) THEN 1 ELSE 0 END), 0) AS sentCount, " +
|
|
|
"IFNULL(SUM(CASE WHEN u.status = 3 THEN 1 ELSE 0 END), 0) AS deliveredCount, " +
|
|
|
"IFNULL(SUM(CASE WHEN u.show_info = 1 THEN 1 ELSE 0 END), 0) AS showCount, " +
|
|
|
- "IFNULL(SUM(CASE WHEN u.user_add = 1 THEN 1 ELSE 0 END), 0) AS clickCount ";
|
|
|
-
|
|
|
- String TASK_STATS_FROM = "FROM common_push_task t " +
|
|
|
- "LEFT JOIN common_push_task_user u ON u.push_task_id = t.id AND u.delete_flag = 0 ";
|
|
|
-
|
|
|
- String TASK_STATS_WHERE = "WHERE t.delete_flag = 0 " +
|
|
|
+ "IFNULL(SUM(CASE WHEN u.user_add = 1 THEN 1 ELSE 0 END), 0) AS clickCount " +
|
|
|
+ "FROM common_push_task t " +
|
|
|
+ "LEFT JOIN common_push_task_user u ON u.push_task_id = t.id AND u.delete_flag = 0 " +
|
|
|
+ "WHERE t.delete_flag = 0 " +
|
|
|
"<if test='taskNo != null and taskNo != \"\"'>AND t.task_no = #{taskNo} </if>" +
|
|
|
"<if test='keyword != null and keyword != \"\"'>AND (t.title LIKE CONCAT('%', #{keyword}, '%') OR t.task_no LIKE CONCAT('%', #{keyword}, '%')) </if>" +
|
|
|
"<if test='status != null and status != \"\"'>AND t.status = #{status} </if>" +
|
|
|
"<if test='pushType != null'>AND t.push_type = #{pushType} </if>" +
|
|
|
"<if test='channel != null and channel != \"\"'>AND t.channels LIKE CONCAT('%', #{channel}, '%') </if>" +
|
|
|
"<if test='startTime != null'>AND t.created_time >= #{startTime} </if>" +
|
|
|
- "<if test='endTime != null'>AND t.created_time < #{endTime} </if>";
|
|
|
-
|
|
|
- @Select("<script>" + TASK_STATS_SELECT + TASK_STATS_FROM + TASK_STATS_WHERE +
|
|
|
+ "<if test='endTime != null'>AND t.created_time < #{endTime} </if>" +
|
|
|
+ "<if test='startTime != null'>AND u.created_time >= #{startTime} </if>" +
|
|
|
+ "<if test='endTime != null'>AND u.created_time < #{endTime} </if>" +
|
|
|
"GROUP BY t.id, t.task_no, t.title, t.push_type, t.status, t.channels, t.estimated_count, t.created_time " +
|
|
|
"ORDER BY t.created_time DESC" +
|
|
|
"</script>")
|
|
|
@@ -47,17 +72,6 @@ public interface CommonPushTaskMapper extends BaseMapper<CommonPushTask> {
|
|
|
@Param("startTime") Date startTime,
|
|
|
@Param("endTime") Date endTime);
|
|
|
|
|
|
- @Select("<script>" + TASK_STATS_SELECT + TASK_STATS_FROM + TASK_STATS_WHERE +
|
|
|
- "GROUP BY t.id, t.task_no, t.title, t.push_type, t.status, t.channels, t.estimated_count, t.created_time " +
|
|
|
- "</script>")
|
|
|
- List<CommonPushTaskStatsDto> selectStatisticsList(@Param("taskNo") String taskNo,
|
|
|
- @Param("keyword") String keyword,
|
|
|
- @Param("status") String status,
|
|
|
- @Param("pushType") Integer pushType,
|
|
|
- @Param("channel") String channel,
|
|
|
- @Param("startTime") Date startTime,
|
|
|
- @Param("endTime") Date endTime);
|
|
|
-
|
|
|
@Select("<script>" +
|
|
|
"SELECT " +
|
|
|
"IFNULL(SUM(CASE WHEN u.status IN (2, 3) THEN 1 ELSE 0 END), 0) AS sentCount, " +
|
|
|
@@ -66,13 +80,13 @@ public interface CommonPushTaskMapper extends BaseMapper<CommonPushTask> {
|
|
|
"IFNULL(SUM(CASE WHEN u.user_add = 1 THEN 1 ELSE 0 END), 0) AS clickCount " +
|
|
|
"FROM common_push_task_user u " +
|
|
|
"WHERE u.delete_flag = 0 " +
|
|
|
- "<if test='pushTaskId != null'>AND u.push_task_id = #{pushTaskId} </if>" +
|
|
|
"<if test='startTime != null'>AND u.created_time >= #{startTime} </if>" +
|
|
|
"<if test='endTime != null'>AND u.created_time < #{endTime} </if>" +
|
|
|
+ "<if test='phoneType != null and phoneType != \"\"'>AND u.phone_type = #{phoneType} </if>" +
|
|
|
"</script>")
|
|
|
- CommonPushTaskStatsDto selectUserStats(@Param("pushTaskId") Long pushTaskId,
|
|
|
- @Param("startTime") Date startTime,
|
|
|
- @Param("endTime") Date endTime);
|
|
|
+ CommonPushTaskStatsDto selectUserStats(@Param("startTime") Date startTime,
|
|
|
+ @Param("endTime") Date endTime,
|
|
|
+ @Param("phoneType") String phoneType);
|
|
|
|
|
|
@Select("<script>" +
|
|
|
"SELECT t.id, t.title, " +
|