|
@@ -32,6 +32,16 @@
|
|
|
<result column="meeting_id" property="meetingId" />
|
|
|
<result column="ahead_tid" property="aheadTid" />
|
|
|
<result column="sap_task_code" property="sapTaskCode" />
|
|
|
+ <result column="charge_one_id" property="chargeOneId" />
|
|
|
+ <result column="charge_one_status" property="chargeOneStatus" />
|
|
|
+ <result column="charge_one_time" property="chargeOneTime" />
|
|
|
+ <result column="charge_two_id" property="chargeTwoId" />
|
|
|
+ <result column="charge_two_status" property="chargeTwoStatus" />
|
|
|
+ <result column="charge_two_time" property="chargeTwoTime" />
|
|
|
+ <result column="final_charge_status" property="finalChargeStatus" />
|
|
|
+ <result column="charge_stage" property="chargeStage" />
|
|
|
+ <result column="file_reject_reason" property="fileRejectReason" />
|
|
|
+ <result column="plan_cost" property="planCost" />
|
|
|
</resultMap>
|
|
|
<resultMap id="timeResultMap" type="com.management.platform.entity.TimeTask" >
|
|
|
<id column="id" property="id" />
|
|
@@ -109,7 +119,7 @@
|
|
|
</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, start_date, meeting_id, ahead_tid, sap_task_code
|
|
|
+ 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, start_date, meeting_id, ahead_tid, sap_task_code, charge_one_id, charge_one_status, charge_one_time, charge_two_id, charge_two_status, charge_two_time, final_charge_status, charge_stage, file_reject_reason, plan_cost
|
|
|
</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, start_date
|
|
@@ -232,7 +242,51 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</select>
|
|
|
-
|
|
|
+ <select id="getTaskPlanRealData" resultType="java.util.Map">
|
|
|
+ SELECT task.id,task.`name`,task_executor.id as teId, DATE_FORMAT(task.`end_date`, '%Y-%m-%d') as endDate, task.`plan_hours` as planHours,task.plan_cost as planCost,
|
|
|
+ (SELECT IFNULL(SUM(working_time),0) FROM report WHERE report.`task_id` = task.id AND report.`state` = 1) AS realHours,
|
|
|
+ task_executor.executor_id as executorId,task_executor.executor_name AS executorName,
|
|
|
+ IF(task_executor.real_cost = 0, task.plan_cost, task_executor.real_cost) AS realCost,
|
|
|
+ task.`task_status` as taskStatus, task.`task_type` as taskType,
|
|
|
+ project.`project_code` as projectCode, project.`project_name` as projectName
|
|
|
+ FROM task
|
|
|
+ LEFT JOIN project ON project.id = task.`project_id`
|
|
|
+ left join task_executor on task_executor.task_id=task.id
|
|
|
+ WHERE project.`company_id` = #{companyId}
|
|
|
+ <if test="projectId != null">
|
|
|
+ and task.project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="taskType!=null">
|
|
|
+ and task.task_type=#{taskType}
|
|
|
+ </if>
|
|
|
+ <if test="inchagerIds!=null and inchagerIds.size()>0">
|
|
|
+ and task.project_id in
|
|
|
+ <foreach collection="inchagerIds" open="(" separator="," close=")" item="item">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ORDER BY project.is_public desc, project.id ASC, task.stages_id asc, task.seq asc
|
|
|
+ <if test="pageStart != null and pageSize != null">
|
|
|
+ limit #{pageStart}, #{pageSize}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="getTaskPlanRealCount" resultType="java.lang.Integer">
|
|
|
+ SELECT count(1) as total FROM task LEFT JOIN project ON project.id = task.`project_id`
|
|
|
+ left join task_executor on task_executor.task_id=task.id
|
|
|
+ WHERE project.`company_id` = #{companyId}
|
|
|
+ <if test="projectId != null">
|
|
|
+ and task.project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="taskType!=null">
|
|
|
+ and task.task_type=#{taskType}
|
|
|
+ </if>
|
|
|
+ <if test="inchagerIds!=null and inchagerIds.size()>0">
|
|
|
+ and task.project_id in
|
|
|
+ <foreach collection="inchagerIds" open="(" separator="," close=")" item="item">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
<select id="getTaskWithProjectName" resultMap="RichResultMap">
|
|
|
SELECT task.id, task.project_id, task.name, task.executor_name, task.start_date, task.`end_date`,task.create_date, task.`creater_id`, task.`creater_name`, task.group_id,
|
|
|
task.plan_hours, task.task_type, task.task_level, task.task_status, task.`finish_date`, project.`project_name`, stages.stages_name,department.department_name
|
|
@@ -306,7 +360,7 @@
|
|
|
and u.id=#{userId}
|
|
|
</if>
|
|
|
<if test="deptId!=null">
|
|
|
- and d.department_id=#{deptId}
|
|
|
+ and d.department_id=#{deptId}
|
|
|
</if>
|
|
|
<if test="list!=null and list.size()>0">
|
|
|
and d.department_id in
|
|
@@ -363,13 +417,13 @@
|
|
|
</select>
|
|
|
<select id="getTaskByUserIdCount" resultType="java.lang.Integer">
|
|
|
select count(1) from (
|
|
|
- SELECT t.`name` AS taskName
|
|
|
- FROM
|
|
|
- task_executor te
|
|
|
- LEFT JOIN `user` u ON te.executor_id=u.id
|
|
|
- LEFT JOIN task t ON te.task_id=t.`id`
|
|
|
- WHERE t.start_date < #{endDate} AND t.end_date > #{startDate} AND FIND_IN_SET(#{userId},t.`executor_id`) GROUP BY t.`id`
|
|
|
- )as total
|
|
|
+ SELECT t.`name` AS taskName
|
|
|
+ FROM
|
|
|
+ task_executor te
|
|
|
+ LEFT JOIN `user` u ON te.executor_id=u.id
|
|
|
+ LEFT JOIN task t ON te.task_id=t.`id`
|
|
|
+ WHERE t.start_date < #{endDate} AND t.end_date > #{startDate} AND FIND_IN_SET(#{userId},t.`executor_id`) GROUP BY t.`id`
|
|
|
+ )as total
|
|
|
</select>
|
|
|
<select id="getTaskWithProjectNameWithCharge" resultMap="RichResultMap">
|
|
|
SELECT task.id, task.project_id, task.name, task.executor_name, task.start_date, task.`end_date`,task.create_date, task.`creater_id`, task.`creater_name`, task.group_id,
|
|
@@ -386,11 +440,11 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="userId != null and userId != ''">
|
|
|
- and task.final_charge_status = 0
|
|
|
- and case task.charge_stage
|
|
|
- when 1 then task.charge_one_id = #{userId} and task.charge_one_status = 0
|
|
|
- when 2 then task.charge_two_id = #{userId} and task.charge_two_status = 0
|
|
|
- end
|
|
|
+ and task.final_charge_status = 0
|
|
|
+ and case task.charge_stage
|
|
|
+ when 1 then task.charge_one_id = #{userId} and task.charge_one_status = 0
|
|
|
+ when 2 then task.charge_two_id = #{userId} and task.charge_two_status = 0
|
|
|
+ end
|
|
|
</if>
|
|
|
ORDER BY task.indate desc
|
|
|
<if test="pageStart != null and pageSize != null">
|
|
@@ -412,79 +466,79 @@
|
|
|
<select id="getTaskChargePage" resultType="com.management.platform.entity.vo.TaskChargePageVO">
|
|
|
select tmp1.*,user.name as finalChargeName
|
|
|
from
|
|
|
- (
|
|
|
- select tf.task_id,task.creater_id,task.name as taskName,task.charge_stage
|
|
|
- ,task.charge_one_id,task.charge_one_status,task.executor_id,task.group_id
|
|
|
- ,task.charge_two_id,task.charge_two_status,p.id as projectId,p.project_name,
|
|
|
- case task.charge_stage
|
|
|
- when 1 then task.charge_one_id
|
|
|
- when 2 then task.charge_two_id
|
|
|
- end as finalChargeId
|
|
|
- from
|
|
|
- task_files tf
|
|
|
- left join task on tf.task_id = task.id
|
|
|
- left join project p on task.project_id = p.id
|
|
|
- <where>
|
|
|
- task.task_status = 0 and task.final_charge_status = 0
|
|
|
- and case task.charge_stage
|
|
|
- when 1 then (p.incharger_id = task.charge_one_id and task.charge_one_status != 2)
|
|
|
- when 2 then (p.incharger_id = task.charge_two_id and task.charge_two_status != 2)
|
|
|
- end
|
|
|
- <if test="queryBO.projectId != null">
|
|
|
- and tf.project_id = #{queryBO.projectId}
|
|
|
- </if>
|
|
|
- <if test="queryBO.taskName != null and queryBO.taskName != ''">
|
|
|
- and task.name like concat('%',#{queryBO.taskName},'%')
|
|
|
- </if>
|
|
|
- <if test="deptIds!=null and deptIds.size()>0">
|
|
|
- and p.dept_id in
|
|
|
- <foreach collection="deptIds" open="(" close=")" separator="," item="item">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- )
|
|
|
- tmp1 left join user on tmp1.finalChargeId = user.id
|
|
|
+ (
|
|
|
+ select tf.task_id,task.creater_id,task.name as taskName,task.charge_stage
|
|
|
+ ,task.charge_one_id,task.charge_one_status,task.executor_id,task.group_id
|
|
|
+ ,task.charge_two_id,task.charge_two_status,p.id as projectId,p.project_name,
|
|
|
+ case task.charge_stage
|
|
|
+ when 1 then task.charge_one_id
|
|
|
+ when 2 then task.charge_two_id
|
|
|
+ end as finalChargeId
|
|
|
+ from
|
|
|
+ task_files tf
|
|
|
+ left join task on tf.task_id = task.id
|
|
|
+ left join project p on task.project_id = p.id
|
|
|
+ <where>
|
|
|
+ task.task_status = 0 and task.final_charge_status = 0
|
|
|
+ and case task.charge_stage
|
|
|
+ when 1 then (p.incharger_id = task.charge_one_id and task.charge_one_status != 2)
|
|
|
+ when 2 then (p.incharger_id = task.charge_two_id and task.charge_two_status != 2)
|
|
|
+ end
|
|
|
+ <if test="queryBO.projectId != null">
|
|
|
+ and tf.project_id = #{queryBO.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.taskName != null and queryBO.taskName != ''">
|
|
|
+ and task.name like concat('%',#{queryBO.taskName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="deptIds!=null and deptIds.size()>0">
|
|
|
+ and p.dept_id in
|
|
|
+ <foreach collection="deptIds" open="(" close=")" separator="," item="item">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ )
|
|
|
+ tmp1 left join user on tmp1.finalChargeId = user.id
|
|
|
where tmp1.finalChargeId = #{queryBO.userId}
|
|
|
group by tmp1.task_id
|
|
|
union all
|
|
|
select tmp1.*,user.name as finalChargeName
|
|
|
from
|
|
|
- (
|
|
|
- select tf.task_id,task.creater_id,task.name as taskName,task.charge_stage
|
|
|
- ,task.charge_one_id,task.charge_one_status,task.executor_id,task.group_id
|
|
|
- ,task.charge_two_id,task.charge_two_status,project.id as projectId,project.project_name,
|
|
|
- case task.charge_stage
|
|
|
- when 1 then task.charge_one_id
|
|
|
- when 2 then task.charge_two_id
|
|
|
- end as finalChargeId
|
|
|
- from
|
|
|
- task_files tf
|
|
|
- left join task on tf.task_id = task.id
|
|
|
- left join project on task.project_id = project.id
|
|
|
- left join user on task.creater_id = user.id
|
|
|
- left join department d on user.department_id = d.department_id
|
|
|
- <where>
|
|
|
- task.task_status = 0 and task.final_charge_status = 0
|
|
|
- and case task.charge_stage
|
|
|
- when 1 then (d.manager_id = task.charge_one_id and task.charge_one_status != 2)
|
|
|
- when 2 then (d.manager_id = task.charge_two_id and task.charge_two_status != 2)
|
|
|
- end
|
|
|
- <if test="queryBO.projectId != null">
|
|
|
- and tf.project_id = #{queryBO.projectId}
|
|
|
- </if>
|
|
|
- <if test="queryBO.taskName != null and queryBO.taskName != ''">
|
|
|
- and task.name like concat('%',#{queryBO.taskName},'%')
|
|
|
- </if>
|
|
|
- <if test="deptIds!=null and deptIds.size()>0">
|
|
|
- and project.dept_id in
|
|
|
- <foreach collection="deptIds" open="(" close=")" separator="," item="item">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- )
|
|
|
- tmp1 left join user on tmp1.finalChargeId = user.id
|
|
|
+ (
|
|
|
+ select tf.task_id,task.creater_id,task.name as taskName,task.charge_stage
|
|
|
+ ,task.charge_one_id,task.charge_one_status,task.executor_id,task.group_id
|
|
|
+ ,task.charge_two_id,task.charge_two_status,project.id as projectId,project.project_name,
|
|
|
+ case task.charge_stage
|
|
|
+ when 1 then task.charge_one_id
|
|
|
+ when 2 then task.charge_two_id
|
|
|
+ end as finalChargeId
|
|
|
+ from
|
|
|
+ task_files tf
|
|
|
+ left join task on tf.task_id = task.id
|
|
|
+ left join project on task.project_id = project.id
|
|
|
+ left join user on task.creater_id = user.id
|
|
|
+ left join department d on user.department_id = d.department_id
|
|
|
+ <where>
|
|
|
+ task.task_status = 0 and task.final_charge_status = 0
|
|
|
+ and case task.charge_stage
|
|
|
+ when 1 then (d.manager_id = task.charge_one_id and task.charge_one_status != 2)
|
|
|
+ when 2 then (d.manager_id = task.charge_two_id and task.charge_two_status != 2)
|
|
|
+ end
|
|
|
+ <if test="queryBO.projectId != null">
|
|
|
+ and tf.project_id = #{queryBO.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.taskName != null and queryBO.taskName != ''">
|
|
|
+ and task.name like concat('%',#{queryBO.taskName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="deptIds!=null and deptIds.size()>0">
|
|
|
+ and project.dept_id in
|
|
|
+ <foreach collection="deptIds" open="(" close=")" separator="," item="item">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ )
|
|
|
+ tmp1 left join user on tmp1.finalChargeId = user.id
|
|
|
where tmp1.finalChargeId = #{queryBO.userId}
|
|
|
group by tmp1.task_id
|
|
|
ORDER BY task_id desc
|
|
@@ -572,6 +626,6 @@
|
|
|
tmp1 left join user on tmp1.finalChargeId = user.id
|
|
|
where tmp1.finalChargeId = #{queryBO.userId}
|
|
|
group by tmp1.task_id
|
|
|
- )tmpAll
|
|
|
+ )tmpAll
|
|
|
</select>
|
|
|
</mapper>
|