123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?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.management.platform.mapper.TaskMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.management.platform.entity.Task">
- <id column="id" property="id" />
- <result column="name" property="name" />
- <result column="task_desc" property="taskDesc" />
- <result column="creater_id" property="createrId" />
- <result column="creater_name" property="createrName" />
- <result column="creator_color" property="creatorColor" />
- <result column="executor_id" property="executorId" />
- <result column="executor_name" property="executorName" />
- <result column="executor_color" property="executorColor" />
- <result column="task_level" property="taskLevel" />
- <result column="task_status" property="taskStatus" />
- <result column="create_date" property="createDate" />
- <result column="end_date" property="endDate" />
- <result column="project_id" property="projectId" />
- <result column="stages_id" property="stagesId" />
- <result column="company_id" property="companyId" />
- <result column="indate" property="indate" />
- <result column="parent_tid" property="parentTid" />
- <result column="group_id" property="groupId" />
- <result column="seq" property="seq" />
- <result column="plan_hours" property="planHours" />
- <result column="task_type" property="taskType" />
- <result column="parent_tname" property="parentTname" />
- <result column="finish_date" property="finishDate" />
- </resultMap>
- <resultMap id="timeResultMap" type="com.management.platform.entity.TimeTask" >
- <id column="id" property="id" />
- <result column="name" property="name" />
- <result column="task_desc" property="taskDesc" />
- <result column="creater_id" property="createrId" />
- <result column="creater_name" property="createrName" />
- <result column="creator_color" property="creatorColor" />
- <result column="executor_id" property="executorId" />
- <result column="executor_name" property="executorName" />
- <result column="executor_color" property="executorColor" />
- <result column="task_level" property="taskLevel" />
- <result column="task_status" property="taskStatus" />
- <result column="create_date" property="createDate" />
- <result column="end_date" property="endDate" />
- <result column="project_id" property="projectId" />
- <result column="stages_id" property="stagesId" />
- <result column="company_id" property="companyId" />
- <result column="indate" property="indate" />
- <result column="parent_tid" property="parentTid" />
- <result column="group_id" property="groupId" />
- <result column="seq" property="seq" />
- <result column="plan_hours" property="planHours" />
- <result column="task_type" property="taskType" />
- <result column="parent_tname" property="parentTname" />
- <result column="finish_date" property="finishDate" />
- <result column="work_hours" property="workHours" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, name, task_desc, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date
- </sql>
- <select id="simpleList" resultMap="BaseResultMap">
- select id, name, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date
- from task
- ${ew.customSqlSegment}
- </select>
- <!--计算执行人任务分布-->
- <select id="getExecutorPanel" resultType="java.util.Map">
- SELECT IFNULL(a.executor_id,0) as executorId,IFNULL( a.executor_name,'待认领') as executorName, count(1) AS taskCount
- FROM task a
- WHERE a.project_id = #{projectId}
- GROUP BY a.executor_id
- </select>
- <!--计算任务列表的任务分布-->
- <select id="getStagesPanel" resultType="java.util.Map">
- SELECT a.stages_id AS stagesId, stages.`stages_name` AS name, COUNT(1) AS value
- FROM task a
- LEFT JOIN stages ON stages.id = a.`stages_id`
- WHERE a.project_id = #{projectId}
- GROUP BY a.stages_id
- ORDER BY stages.`sequence`
- </select>
- <!--计算耗时排名前十的任务-->
- <select id="getTopCostTask" resultType="java.util.Map">
- SELECT task.id , task.name AS name, IFNULL(SUM(report.`working_time`),0) AS value FROM task
- LEFT JOIN report ON report.`task_id` = task.id
- WHERE task.project_id = #{projectId} and report.state = 1
- GROUP BY task.id ORDER BY SUM(report.`working_time`) DESC LIMIT 10
- </select>
- <!-- 查询任务实际工时和计划工时对比,仅查询有实际工时的数据 -->
- <select id="getTaskTimeCompare" resultType="java.util.Map">
- SELECT task.id , task.name AS name, task.plan_hours as planHours, IFNULL(SUM(report.`working_time`),0) AS workHours FROM report
- LEFT JOIN task ON report.`task_id` = task.id
- WHERE task.project_id = #{projectId} AND report.state = 1
- GROUP BY task.id ORDER BY SUM(report.`working_time`) DESC
- </select>
- <!--查询任务,带实际工时-->
- <select id="getTaskWithWorktime" resultMap="timeResultMap">
- SELECT task.* , IFNULL(SUM(report.`working_time`),0) AS work_hours FROM task
- LEFT JOIN report ON report.`task_id` = task.id
- WHERE task.project_id = #{projectId} and report.state = 1
- GROUP BY task.id ORDER BY SUM(report.`working_time`) DESC LIMIT 10
- </select>
- </mapper>
|