<?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.cloudroam.mapper.ProjectInfoMapperCustom">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.cloudroam.bo.ProjectInfoBO">
|
<id column="id" property="id" />
|
<!--<result column="create_time" property="createTime" />
|
<result column="update_time" property="updateTime" />
|
<result column="delete_time" property="deleteTime" />-->
|
<result column="tenant_id" property="tenantId" />
|
<result column="project_no" property="projectNo" />
|
<result column="project_name" property="projectName" />
|
<result column="manager_id" property="managerId" />
|
<result column="contact_id" property="contactId" />
|
<result column="project_desc" property="projectStatus" />
|
<result column="estimate_start_time" property="estimateStartTime" />
|
<result column="estimate_complete_time" property="estimateCompleteTime" />
|
<result column="actual_start_time" property="actualStartTime" />
|
<result column="actual_complete_time" property="actualCompleteTime" />
|
<result column="inner_hours" property="innerHours" />
|
<result column="outer_hours" property="outerHours" />
|
<result column="actual_hours" property="actualHours" />
|
<result column="project_status" property="projectStatus" />
|
<result column="remark" property="remark" />
|
<result column="company_id" property="companyId" />
|
<result column="project_stage" property="projectStage" />
|
<result column="project_type" property="projectType" />
|
<result column="estimate_develop_hours" property="estimateDevelopHours" />
|
<result column="estimate_test_hours" property="estimateTestHours" />
|
<result column="need_design" property="needDesign" />
|
<result column="need_develop" property="needDevelop" />
|
<result column="need_price" property="needPrice" />
|
<result column="create_user_id" property="createUserId" />
|
<result column="create_user_name" property="createUserName" />
|
<result column="update_user_id" property="updateUserId" />
|
<result column="update_user_name" property="updateUserName" />
|
<result column="is_deleted" property="isDeleted" />
|
<result column="delete_user_id" property="deleteUserId" />
|
<result column="delete_user_name" property="deleteUserName" />
|
|
<result column="pro_estimate_start_time" property="proEstimateStartTime" />
|
<result column="pro_estimate_complete_time" property="proEstimateCompleteTime" />
|
<result column="pro_actual_start_time" property="proActualStartTime" />
|
<result column="pro_actual_complete_time" property="proActualCompleteTime" />
|
|
<result column="bus_estimate_start_time" property="busEstimateStartTime" />
|
<result column="bus_estimate_complete_time" property="busEstimateCompleteTime" />
|
<result column="bus_actual_start_time" property="busActualStartTime" />
|
<result column="bus_actual_complete_time" property="busActualCompleteTime" />
|
|
<result column="company_name" property="companyName" />
|
<result column="contact_name" property="contactName" />
|
<result column="manager_name" property="managerName" />
|
<result column="project_type_name" property="projectTypeName" />
|
<result column="project_status_name" property="projectStatusName" />
|
<result column="project_stage_name" property="projectStageName" />
|
|
|
</resultMap>
|
|
<select id="selectProjectInfoPage" resultType="com.cloudroam.bo.ProjectInfoBO">
|
select p.*,
|
c.short_name as company_name ,
|
co.name as contact_name,
|
u.nickname as manager_name,
|
dict_type.label as project_type_name,
|
dict_status.label as project_status_name,
|
dict_stage.label as project_stage_name
|
from project_info p
|
left join company_info c
|
on p.company_id= c.id
|
left join contact_info co
|
on p.contact_id =co.id
|
left join lin_user u
|
on p.manager_id=u.id
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_type' and is_deleted=0
|
) dict_type
|
on p.project_type=dict_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_status' and is_deleted=0
|
) dict_status
|
on p.project_status=dict_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_stage' and is_deleted=0
|
) dict_stage
|
on p.project_stage=dict_stage.`value`
|
where p.is_deleted=0
|
|
<if test=" keyword !=null and keyword !='' ">
|
and (
|
UPPER(p.project_name) like UPPER(concat('%',#{keyword},'%'))
|
or p.project_desc like concat('%',#{keyword},'%')
|
or p.remark like concat('%',#{keyword},'%')
|
or c.short_name like concat('%',#{keyword},'%')
|
or co.name like concat('%',#{keyword},'%')
|
or u.username like concat('%',#{keyword},'%')
|
)
|
</if>
|
|
<if test=" status !=null and status !='' ">
|
and p.project_status= #{status}
|
</if>
|
<if test=" stage !=null and stage !='' ">
|
and p.project_stage=#{stage}
|
</if>
|
<if test=" type !=null and type !='' ">
|
and p.project_type= #{type}
|
</if>
|
|
order by p.create_time desc
|
</select>
|
|
|
|
<sql id="baseInfo">
|
select p.*,
|
c.short_name as company_name ,
|
co.name as contact_name,
|
u.nickname as manager_name,
|
dict_type.label as project_type_name,
|
dict_status.label as project_status_name,
|
dict_stage.label as project_stage_name
|
from project_info p
|
left join company_info c
|
on p.company_id= c.id
|
left join contact_info co
|
on p.contact_id =co.id
|
left join lin_user u
|
on p.manager_id=u.id
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_type' and is_deleted=0
|
) dict_type
|
on p.project_type=dict_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_status' and is_deleted=0
|
) dict_status
|
on p.project_status=dict_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_stage' and is_deleted=0
|
) dict_stage
|
on p.project_stage=dict_stage.`value`
|
where p.is_deleted=0
|
|
</sql>
|
|
<select id="getProjectHourStatistics" resultType="com.cloudroam.bo.ProjectUserStatisticsBO">
|
|
|
SELECT *
|
FROM
|
(
|
SELECT i.project_name,u.nickname as create_user_name,t.* ,t2.total_actual_hours,t2.total_estimated_hours,round((t.actual_hours/t2.total_actual_hours)*100 ,2)as actual_hours_percent
|
FROM project_info i
|
INNER JOIN (
|
SELECT project_id,create_user_id, sum( estimated_hours ) AS estimated_hours,sum( actual_hours ) AS actual_hours
|
FROM project_daily
|
WHERE is_deleted = 0
|
AND daily_status != 3
|
<if test=" dto.isConfirm !=null">
|
AND is_confirm = #{dto.isConfirm}
|
</if>
|
GROUP BY project_id,create_user_id
|
) t
|
ON i.id = t.project_id
|
LEFT JOIN lin_user u ON t.create_user_id = u.id
|
left join (
|
select project_id,sum( estimated_hours ) AS total_estimated_hours,sum(actual_hours) as total_actual_hours
|
from project_daily d
|
where d.is_deleted=0
|
<if test=" dto.isConfirm !=null">
|
AND d.is_confirm = #{dto.isConfirm}
|
</if>
|
and d.daily_status != 3
|
group by project_id
|
)t2
|
on i.id=t2.project_id
|
) t3
|
WHERE 1=1
|
<if test=" dto.projectId !=null and dto.projectId !='' ">
|
and project_id=#{dto.projectId}
|
</if>
|
ORDER BY project_id,create_user_id
|
</select>
|
<select id="getDetailById" resultType="com.cloudroam.bo.ProjectInfoBO">
|
select p.*,
|
c.short_name as company_name ,
|
co.name as contact_name,
|
u.nickname as manager_name,
|
dict_type.label as project_type_name,
|
dict_status.label as project_status_name,
|
dict_stage.label as project_stage_name
|
from project_info p
|
left join company_info c
|
on p.company_id= c.id
|
left join contact_info co
|
on p.contact_id =co.id
|
left join lin_user u
|
on p.manager_id=u.id
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_type' and is_deleted=0
|
) dict_type
|
on p.project_type=dict_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_status' and is_deleted=0
|
) dict_status
|
on p.project_status=dict_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_stage' and is_deleted=0
|
) dict_stage
|
on p.project_stage=dict_stage.`value`
|
where p.is_deleted=0
|
<if test=" projectId !=null and projectId !='' ">
|
and p.id= #{projectId}
|
</if>
|
</select>
|
<select id="getBoardProjectList" resultType="com.cloudroam.bo.ProjectInfoBO">
|
|
<include refid="baseSelectSql" />
|
<if test=" dto.projecdtList !=null and dto.projecdtList.size > 0 ">
|
and p.id in
|
<foreach collection="dto.projecdtList" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
<if test=" dto.statusList !=null and dto.statusList.size > 0 ">
|
and p.project_status in
|
<foreach collection="dto.statusList" item="status" open="(" separator="," close=")">
|
#{status}
|
</foreach>
|
</if>
|
<if test=" dto.stage !=null and dto.stage !='' ">
|
and p.project_stage=#{dto.stage}
|
</if>
|
|
</select>
|
<select id="getProjectMinMaxDateList" resultType="com.cloudroam.bo.project.ProjectMinMaxDateBO">
|
select min(project_time) as min_date,max(project_time) as max_date
|
from(
|
select
|
id,pro_estimate_start_time as project_time
|
from project_info
|
union
|
select
|
id,pro_estimate_complete_time as project_time
|
from project_info
|
union
|
select
|
id,pro_actual_start_time as project_time
|
from project_info
|
union
|
select
|
id,pro_actual_complete_time as project_time
|
from project_info
|
union
|
select
|
id,bus_estimate_start_time as project_time
|
from project_info
|
union
|
select
|
id,bus_estimate_complete_time as project_time
|
from project_info
|
union
|
select
|
id,bus_actual_start_time as project_time
|
from project_info
|
union
|
select
|
id,bus_actual_complete_time as project_time
|
from project_info
|
)t
|
where t.id in
|
<foreach collection="list" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
limit 1
|
</select>
|
<select id="getProjectMinMaxDateDefaultList" resultType="com.cloudroam.bo.project.ProjectMinMaxDateBO">
|
select min(project_time) as min_date,max(project_time) as max_date
|
from(
|
select
|
id,estimate_start_time as project_time
|
from project_info
|
union
|
select
|
id,estimate_complete_time as project_time
|
from project_info
|
union
|
select
|
id,actual_start_time as project_time
|
from project_info
|
union
|
select
|
id,actual_complete_time as project_time
|
from project_info
|
)t
|
</select>
|
<select id="selectProjectInfoPageByDTO" resultType="com.cloudroam.bo.ProjectInfoBO">
|
<include refid="pageReportSql"></include>
|
</select>
|
|
<!-- 获取所有报表项目数据-->
|
<select id="getReportList" resultType="com.cloudroam.bo.ProjectInfoBO">
|
<include refid="pageReportSql"></include>
|
</select>
|
|
|
<sql id="pageReportSql">
|
select p.*,
|
c.short_name as company_name ,
|
co.name as contact_name,
|
u.nickname as manager_name,
|
dict_type.label as project_type_name,
|
dict_status.label as project_status_name,
|
dict_stage.label as project_stage_name
|
from project_info p
|
left join company_info c
|
on p.company_id= c.id
|
left join contact_info co
|
on p.contact_id =co.id
|
left join lin_user u
|
on p.manager_id=u.id
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_type' and is_deleted=0
|
) dict_type
|
on p.project_type=dict_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_status' and is_deleted=0
|
) dict_status
|
on p.project_status=dict_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_stage' and is_deleted=0
|
) dict_stage
|
on p.project_stage=dict_stage.`value`
|
where p.is_deleted=0
|
|
<if test=" dto.keyword !=null and dto.keyword !='' ">
|
and (
|
UPPER(p.project_name) like UPPER(concat('%',#{dto.keyword},'%'))
|
or p.project_desc like concat('%',#{dto.keyword},'%')
|
or p.remark like concat('%',#{dto.keyword},'%')
|
or c.short_name like concat('%',#{dto.keyword},'%')
|
or co.name like concat('%',#{dto.keyword},'%')
|
or u.username like concat('%',#{dto.keyword},'%')
|
)
|
</if>
|
|
<if test=" dto.status !=null and dto.status !='' ">
|
and p.project_status= #{dto.status}
|
</if>
|
<if test=" dto.stage !=null and dto.stage !='' ">
|
and p.project_stage=#{dto.stage}
|
</if>
|
<if test=" dto.type !=null and dto.type !='' ">
|
and p.project_type= #{dto.type}
|
</if>
|
|
<if test="dto.statusList != null and dto.statusList.size() > 0">
|
and p.project_status in
|
<foreach collection="dto.statusList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
|
<if test="dto.stageList != null and dto.stageList.size() > 0">
|
and p.project_stage in
|
<foreach collection="dto.stageList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
|
<if test="dto.typeList != null and dto.typeList.size() > 0">
|
and p.project_type in
|
<foreach collection="dto.typeList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
|
order by p.create_time desc
|
</sql>
|
|
<sql id="baseSelectSql">
|
select p.*,
|
c.short_name as company_name ,
|
co.name as contact_name,
|
u.nickname as manager_name,
|
dict_type.label as project_type_name,
|
dict_status.label as project_status_name,
|
dict_stage.label as project_stage_name
|
from project_info p
|
left join company_info c
|
on p.company_id= c.id
|
left join contact_info co
|
on p.contact_id =co.id
|
left join lin_user u
|
on p.manager_id=u.id
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_type' and is_deleted=0
|
) dict_type
|
on p.project_type=dict_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_status' and is_deleted=0
|
) dict_status
|
on p.project_status=dict_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='project_stage' and is_deleted=0
|
) dict_stage
|
on p.project_stage=dict_stage.`value`
|
where p.is_deleted=0
|
</sql>
|
|
</mapper>
|