Просмотр исходного кода

Merge branch 'dev-lqc' into test

lqc 4 лет назад
Родитель
Сommit
359cb67735

+ 77 - 42
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxCashScheduleTaskListMapper.xml

@@ -4,57 +4,95 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList">
-        <id column="id" property="id" />
-        <result column="schedule_id" property="scheduleId" />
-        <result column="template_id" property="templateId" />
-        <result column="task_id" property="taskId" />
-        <result column="child_task_id" property="childTaskId" />
-        <result column="group_id" property="groupId" />
-        <result column="task_type" property="taskType" />
-        <result column="remark" property="remark" />
-        <result column="task_content" property="taskContent" />
-        <result column="gh_id" property="ghId" />
-        <result column="send_url" property="sendUrl" />
-        <result column="status" property="status" />
-        <result column="type" property="type" />
-        <result column="err_info" property="errInfo" />
-        <result column="send_time" property="sendTime" />
-        <result column="create_uid" property="createUid" />
-        <result column="create_user" property="createUser" />
-        <result column="update_uid" property="updateUid" />
-        <result column="create_at" property="createAt" />
-        <result column="update_at" property="updateAt" />
+        <id column="id" property="id"/>
+        <result column="schedule_id" property="scheduleId"/>
+        <result column="template_id" property="templateId"/>
+        <result column="task_id" property="taskId"/>
+        <result column="child_task_id" property="childTaskId"/>
+        <result column="group_id" property="groupId"/>
+        <result column="task_type" property="taskType"/>
+        <result column="remark" property="remark"/>
+        <result column="task_content" property="taskContent"/>
+        <result column="gh_id" property="ghId"/>
+        <result column="send_url" property="sendUrl"/>
+        <result column="status" property="status"/>
+        <result column="type" property="type"/>
+        <result column="err_info" property="errInfo"/>
+        <result column="send_time" property="sendTime"/>
+        <result column="create_uid" property="createUid"/>
+        <result column="create_user" property="createUser"/>
+        <result column="update_uid" property="updateUid"/>
+        <result column="create_at" property="createAt"/>
+        <result column="update_at" property="updateAt"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, schedule_id, template_id, task_id, childTaskId, group_id, task_type, remark, task_content, status, err_info, send_time, create_uid, update_uid, create_at, update_at
+        id
+        , schedule_id, template_id, task_id, childTaskId, group_id, task_type, remark, task_content, status, err_info, send_time, create_uid, update_uid, create_at, update_at
     </sql>
     <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList">
         <if test="handle.type == 2">
             SELECT
-                task_list.*,
-                task_template.template_name,
-                mobile_group.group_name
+            task_list.*,
+            task_template.template_name,
+            mobile_group.group_name,
+            catalog.catalog_name,
+            (
+            SELECT
+            COUNT( 1 )
+            FROM
+            pan_fosterwx_cash_schedule_task_list
+            WHERE
+            pan_fosterwx_cash_schedule_task_list.schedule_id = task_list.schedule_id
+            AND pan_fosterwx_cash_schedule_task_list.template_id = task_list.template_id
+            AND pan_fosterwx_cash_schedule_task_list.task_id = task_list.task_id
+            AND pan_fosterwx_cash_schedule_task_list.group_id = task_list.group_id
+            ) AS total_count,
+            (
+            SELECT
+            COUNT( 1 )
+            FROM
+            pan_fosterwx_cash_schedule_task_list
+            WHERE
+            pan_fosterwx_cash_schedule_task_list.schedule_id = task_list.schedule_id
+            AND pan_fosterwx_cash_schedule_task_list.template_id = task_list.template_id
+            AND pan_fosterwx_cash_schedule_task_list.task_id = task_list.task_id
+            AND pan_fosterwx_cash_schedule_task_list.group_id = task_list.group_id
+            AND pan_fosterwx_cash_schedule_task_list.`status` IN ( 2, 4, 5, 6 )
+            ) AS created_count
+            FROM
+            (
+            SELECT
+            MIN( task_list.id ) AS id,
+            task_list.schedule_id,
+            task_list.template_id,
+            task_list.task_id,
+            task_list.group_id
             FROM
             pan_fosterwx_cash_schedule_task_list task_list
+            GROUP BY
+            task_list.schedule_id,
+            task_list.template_id,
+            task_list.task_id,
+            task_list.group_id
+            ) task_list
             LEFT JOIN pan_fosterwx_cash_task_template task_template ON task_template.id = task_list.template_id
             LEFT JOIN pan_fosterwx_cash_mobile_group mobile_group ON task_list.group_id = mobile_group.id
-            <where>
-                ${ew.sqlSegment}
-            </where>d
-            order by task_list.id desc
+            LEFT JOIN pan_fosterwx_cash_workwx_task_catalog catalog ON task_list.task_id = catalog.id
+            ORDER BY
+            task_list.id DESC
             limit #{limit} offset #{offset}
         </if>
         <if test="handle.type == 1">
             SELECT
-                task_list.*,
-                task_template.template_name,
-                mobile_group.group_name
+            task_list.*,
+            task_template.template_name,
+            mobile_group.group_name
             FROM
-                pan_fosterwx_cash_schedule_task_list task_list
-                    LEFT JOIN pan_fosterwx_cash_task_template task_template ON task_template.id = task_list.template_id
-                    LEFT JOIN pan_fosterwx_cash_mobile_group mobile_group ON task_list.group_id = mobile_group.id
+            pan_fosterwx_cash_schedule_task_list task_list
+            LEFT JOIN pan_fosterwx_cash_task_template task_template ON task_template.id = task_list.template_id
+            LEFT JOIN pan_fosterwx_cash_mobile_group mobile_group ON task_list.group_id = mobile_group.id
             <where>
                 ${ew.sqlSegment}
             </where>
@@ -63,13 +101,10 @@
         </if>
     </select>
     <select id="getBannedGhid" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList">
-        SELECT
-            task_list.*
-        FROM
-            pan_fosterwx_cash_schedule_task_list task_list
-                LEFT JOIN pan_fosterwx_cash_oas_box box ON task_list.gh_id = box.gh_id
-        WHERE
-            box.fobidden_status = 2
-            AND task_list.`status` = 4
+        SELECT task_list.*
+        FROM pan_fosterwx_cash_schedule_task_list task_list
+                 LEFT JOIN pan_fosterwx_cash_oas_box box ON task_list.gh_id = box.gh_id
+        WHERE box.fobidden_status = 2
+          AND task_list.`status` = 4
     </select>
 </mapper>