<?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.ProjectDailyMapperCustom">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.cloudroam.bo.ProjectDailyBO">
|
<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_id" property="projectId" />
|
<result column="project_name" property="projectName" />
|
<result column="task_id" property="taskId" />
|
<result column="task_desc" property="taskDesc" />
|
<result column="begin_date" property="beginDate" />
|
<result column="end_date" property="endDate" />
|
<result column="task_name" property="taskName" />
|
<result column="daily_type" property="dailyType" />
|
<result column="daily_content" property="dailyContent" />
|
<result column="daily_status" property="dailyStatus" />
|
<result column="daily_date" property="dailyDate" />
|
|
|
<result column="supplementary_flag" property="supplementaryFlag" />
|
|
<result column="is_commit" property="isCommit" />
|
<result column="commit_user_id" property="commitUserId" />
|
<result column="commit_user_name" property="commitUserName" />
|
<result column="commit_time" property="commitTime" />
|
|
<result column="is_confirm" property="isConfirm" />
|
<result column="confirm_user_id" property="confirmUserId" />
|
<result column="confirm_user_name" property="confirmUserName" />
|
<result column="confirm_time" property="confirmTime" />
|
<result column="confirm_content" property="confirmContent" />
|
|
|
<result column="estimated_hours" property="estimatedHours" />
|
<result column="actual_hours" property="actualHours" />
|
<result column="remark" property="remark" />
|
<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="daily_process_meeting_id" property="dailyProcessMeetingId" />
|
<result column="daily_process_state" property="dailyProcessState" />
|
<result column="daily_process_remark" property="dailyProcessRemark" />
|
<result column="daily_process_user_name" property="dailyProcessUserName" />
|
<result column="daily_process_user_id" property="dailyProcessUserId" />
|
<result column="daily_process_time" property="dailyProcessTime" />
|
|
<result column="daily_process_percent" property="dailyProcessPercent" />
|
|
|
<result column="project_name2" property="projectName2" />
|
<result column="daily_status_name" property="dailyStatusName" />
|
<result column="daily_type_name" property="dailyTypeName" />
|
<result column="daily_commit_name" property="dailyCommitName" />
|
<result column="daily_confirm_name" property="dailyConfirmName" />
|
|
|
|
|
</resultMap>
|
<insert id="insertBatch">
|
|
insert into project_daily(
|
id,
|
tenant_id,
|
project_id,
|
project_name,
|
task_id,
|
task_desc,
|
begin_date,
|
end_date,
|
task_name,
|
daily_type,
|
daily_content,
|
daily_status,
|
daily_date,
|
supplementary_flag,
|
is_commit,
|
commit_user_id,
|
commit_user_name,
|
commit_time,
|
is_confirm,
|
confirm_user_id,
|
confirm_user_name,
|
confirm_time,
|
confirm_content,
|
estimated_hours,
|
actual_hours,
|
remark,
|
create_user_id,
|
create_user_name,
|
create_time,
|
update_user_id,
|
update_user_name,
|
update_time,
|
is_deleted,
|
delete_user_id,
|
delete_user_name,
|
delete_time
|
)
|
values
|
<foreach collection="list" item="item" index="index" separator=",">
|
(
|
#{item.id},
|
#{item.tenantId},
|
#{item.projectId},
|
#{item.projectName},
|
#{item.taskId},
|
#{item.taskDesc},
|
#{item.beginDate},
|
#{item.endDate},
|
#{item.taskName},
|
#{item.dailyType},
|
#{item.dailyContent},
|
#{item.dailyStatus},
|
#{item.dailyDate},
|
|
#{item.supplementaryFlag},
|
|
#{item.isCommit},
|
#{item.commitUserId},
|
#{item.commitUserName},
|
#{item.commitTime},
|
|
#{item.isConfirm},
|
#{item.confirmUserId},
|
#{item.confirmUserName},
|
#{item.confirmTime},
|
|
#{item.confirmContent},
|
|
#{item.estimatedHours},
|
#{item.actualHours},
|
#{item.remark},
|
#{item.createUserId},
|
#{item.createUserName},
|
#{item.createTime},
|
#{item.updateUserId},
|
#{item.updateUserName},
|
#{item.updateTime},
|
#{item.isDeleted},
|
#{item.deleteUserId},
|
#{item.deleteUserName},
|
#{item.deleteTime}
|
)
|
</foreach>
|
|
</insert>
|
<!-- <update id="deleteDailysByDateUser">-->
|
<!-- update project_daily set is_deleted=1 where create_user_id= #{createUserId} and daily_date= #{dailyDate}-->
|
<!-- </update>-->
|
|
<delete id="deleteDailysByDateUser">
|
delete from project_daily where create_user_id= #{createUserId} and daily_date= #{dailyDate}
|
</delete>
|
|
|
<select id="selectProjectDailyPage" resultType="com.cloudroam.bo.ProjectDailyBO">
|
<include refid="selectSql" />
|
where t.is_deleted=0
|
<if test=" dailyDate !=null and dailyDate !='' ">
|
and t.daily_date= #{dailyDate}
|
</if>
|
|
<if test=" projectId !=null and projectId !='' ">
|
and t.project_id= #{projectId}
|
</if>
|
|
<if test=" createUserId !=null and createUserId !='' ">
|
and t.create_user_id= #{createUserId}
|
</if>
|
|
<if test=" keyword !=null and keyword !='' ">
|
and (
|
t.daily_content like concat('%',#{keyword},'%')
|
or t.remark like concat('%',#{keyword},'%')
|
)
|
</if>
|
|
<if test=" dailyType !=null and dailyType !='' ">
|
and t.daily_type= #{dailyType}
|
</if>
|
<if test=" dailyStatus !=null and dailyStatus !='' ">
|
and t.daily_status= #{dailyStatus}
|
</if>
|
|
<if test=" isCommit !=null ">
|
and t.is_commit= #{isCommit}
|
</if>
|
|
<if test=" isConfirm !=null ">
|
and t.is_confirm= #{isConfirm}
|
</if>
|
order by t.daily_date desc ,t.create_user_id,t.project_id,t.create_time
|
|
</select>
|
<select id="selectProjectDailyList" resultType="com.cloudroam.bo.ProjectDailyBO">
|
|
<include refid="selectSql" />
|
<include refid="whereCauseProjectDaily" />
|
order by t.daily_date desc ,t.create_user_id,t.project_id,t.create_time
|
|
</select>
|
|
|
|
<sql id="selectSql">
|
select t.* from (
|
select d.* ,
|
i.project_name as project_name2,
|
pm.module_name as module_name2,
|
pt.`name` as task_name2,
|
pt.description as task_desc2,
|
pt.plan_begin_date as task_plan_begin_date,
|
pt.plan_end_date as task_plan_end_date,
|
daily_status.label as daily_status_name,
|
daily_type.label as daily_type_name,
|
daily_commit.label as daily_commit_name,
|
daily_confirm.label as daily_confirm_name,
|
daily_process_state.label as daily_process_state_name
|
|
from project_daily d
|
left join project_info i
|
on d.project_id = i.id
|
left join project_module pm
|
on d.module_id=pm.id
|
left join project_task pt
|
on d.task_id =pt.id
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_status' and is_deleted=0
|
) daily_status
|
on d.daily_status=daily_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_type' and is_deleted=0
|
) daily_type
|
on d.daily_type=daily_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_commit' and is_deleted=0
|
) daily_commit
|
on d.is_commit=daily_commit.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_confirm' and is_deleted=0
|
) daily_confirm
|
on d.is_confirm=daily_confirm.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_process_state' and is_deleted=0
|
) daily_process_state
|
on d.daily_process_state=daily_process_state.`value`
|
)t
|
</sql>
|
|
<sql id="whereCauseProjectDaily">
|
where t.is_deleted=0
|
<if test=" startDate !=null and startDate !='' ">
|
and t.daily_date >= #{startDate}
|
</if>
|
|
<if test=" endDate !=null and endDate !='' ">
|
and t.daily_date <= #{endDate}
|
</if>
|
|
<if test=" dailyDate !=null and dailyDate !='' ">
|
and t.daily_date= #{dailyDate}
|
</if>
|
|
<if test=" projectId !=null and projectId !='' ">
|
and t.project_id= #{projectId}
|
</if>
|
|
<if test=" createUserId !=null and createUserId !='' ">
|
and t.create_user_id= #{createUserId}
|
</if>
|
|
</sql>
|
<sql id="whereCause">
|
where t.is_deleted=0
|
<if test=" startDate !=null and startDate !='' ">
|
and t.daily_date >= #{startDate}
|
</if>
|
|
<if test=" endDate !=null and endDate !='' ">
|
and t.daily_date <= #{endDate}
|
</if>
|
|
<if test=" dailyDate !=null and dailyDate !='' ">
|
and t.daily_date= #{dailyDate}
|
</if>
|
|
<if test=" projectId !=null and projectId !='' ">
|
and t.project_id= #{projectId}
|
</if>
|
|
<if test=" createUserId !=null and createUserId !='' ">
|
and t.create_user_id= #{createUserId}
|
</if>
|
|
<if test=" keyword !=null and keyword !='' ">
|
and (
|
t.daily_content like concat('%',#{keyword},'%')
|
or t.remark like concat('%',#{keyword},'%')
|
)
|
</if>
|
|
<if test=" dailyType !=null and dailyType !='' ">
|
and t.daily_type= #{dailyType}
|
</if>
|
<if test=" dailyStatus !=null and dailyStatus !='' ">
|
and t.daily_status= #{dailyStatus}
|
</if>
|
|
<if test=" isCommit !=null ">
|
and t.is_commit= #{isCommit}
|
</if>
|
|
<if test=" isConfirm !=null ">
|
and t.is_confirm= #{isConfirm}
|
</if>
|
</sql>
|
|
|
<select id="getYesterdayUncommittedProjectDailys" resultType="com.cloudroam.bo.ProjectDailyBO">
|
select t.* from (
|
select d.* ,
|
i.project_name as project_name2,
|
daily_status.label as daily_status_name,
|
daily_type.label as daily_type_name,
|
daily_commit.label as daily_commit_name,
|
daily_confirm.label as daily_confirm_name
|
|
from project_daily d
|
left join project_info i
|
on d.project_id = i.id
|
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_status' and is_deleted=0
|
) daily_status
|
on d.daily_status=daily_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_type' and is_deleted=0
|
) daily_type
|
on d.daily_type=daily_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_commit' and is_deleted=0
|
) daily_commit
|
on d.is_commit=daily_commit.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_confirm' and is_deleted=0
|
) daily_confirm
|
on d.is_confirm=daily_confirm.`value`
|
|
)t
|
|
where t.is_deleted=0
|
and t.daily_date=DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY)
|
and t.is_commit=0
|
and t.create_user_id=#{createUserId}
|
|
</select>
|
|
<select id="getYesterdayUnconfirmedProjectDailys" resultType="com.cloudroam.bo.ProjectDailyBO">
|
select t.* from (
|
select d.* ,
|
i.project_name as project_name2,
|
daily_status.label as daily_status_name,
|
daily_type.label as daily_type_name,
|
daily_commit.label as daily_commit_name,
|
daily_confirm.label as daily_confirm_name
|
|
from project_daily d
|
left join project_info i
|
on d.project_id = i.id
|
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_status' and is_deleted=0
|
) daily_status
|
on d.daily_status=daily_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_type' and is_deleted=0
|
) daily_type
|
on d.daily_type=daily_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_commit' and is_deleted=0
|
) daily_commit
|
on d.is_commit=daily_commit.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_confirm' and is_deleted=0
|
) daily_confirm
|
on d.is_confirm=daily_confirm.`value`
|
|
)t
|
|
where t.is_deleted=0
|
and t.daily_date=DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY)
|
and t.is_confirm=0
|
and t.create_user_id=#{createUserId}
|
</select>
|
|
<select id="getTodayNoDailyPeoples" resultType="com.cloudroam.model.UserDO">
|
select u.* from lin_user u
|
where u.id not in (
|
select create_user_id from project_daily where daily_date=CURRENT_DATE and is_deleted=0 group by create_user_id
|
)
|
and u.id !=1
|
and u.is_deleted=0
|
</select>
|
|
<select id="getYesterdayUncommittedProjectDailysPeoples" resultType="com.cloudroam.model.UserDO">
|
select * from lin_user u where u.id in(
|
select create_user_id from project_daily d
|
where d.is_deleted=0
|
and d.daily_date=DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY)
|
and d.is_commit=0
|
)
|
and u.is_deleted=0
|
|
</select>
|
|
<select id="getYesterdayUncomfirmedProjectDailysPeoples" resultType="com.cloudroam.model.UserDO">
|
select * from lin_user u where u.id in(
|
select create_user_id from project_daily d
|
where d.is_deleted=0
|
and d.daily_date=DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY)
|
and d.is_confirm=0
|
|
)
|
and u.is_deleted=0
|
</select>
|
<select id="getActualHoursStatistic" resultType="com.cloudroam.bo.ProjectStatisticsBO">
|
select
|
project_id,sum(actual_hours) as actual_hours,sum(estimated_hours) as estimated_hours
|
from project_daily d
|
where d.is_deleted=0
|
-- and d.is_confirm=1
|
and d.daily_status != 3
|
and project_id=#{projectId}
|
group by project_id
|
</select>
|
<select id="getToadyUncomfirmedActualHoursProjectDailysPeoples" resultType="com.cloudroam.model.UserDO">
|
|
select * from lin_user where id in(
|
select create_user_id
|
from project_daily d
|
where d.is_deleted=0
|
and d.is_commit=1
|
and d.is_confirm=1
|
and d.actual_hours=0
|
and d.daily_status!='3'
|
<if test=" dailyDate !=null and dailyDate !='' ">
|
and d.daily_date= #{dailyDate}
|
</if>
|
)
|
|
|
</select>
|
|
<select id="getTodayUnConfirmedActualHours" resultType="com.cloudroam.bo.ProjectDailyBO">
|
|
select t.* from (
|
select d.* ,
|
i.project_name as project_name2,
|
daily_status.label as daily_status_name,
|
daily_type.label as daily_type_name,
|
daily_commit.label as daily_commit_name,
|
daily_confirm.label as daily_confirm_name
|
|
from project_daily d
|
left join project_info i
|
on d.project_id = i.id
|
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_status' and is_deleted=0
|
) daily_status
|
on d.daily_status=daily_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_type' and is_deleted=0
|
) daily_type
|
on d.daily_type=daily_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_commit' and is_deleted=0
|
) daily_commit
|
on d.is_commit=daily_commit.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_confirm' and is_deleted=0
|
) daily_confirm
|
on d.is_confirm=daily_confirm.`value`
|
|
)t
|
|
where t.is_deleted=0
|
and t.is_commit=1
|
and t.is_confirm=1
|
and t.daily_status!='3'
|
and t.daily_date=#{dailyDate}
|
and t.create_user_id=#{createUserId}
|
</select>
|
<select id="getUnComfirmedPeoples" resultType="com.cloudroam.model.UserDO">
|
|
SELECT
|
*
|
FROM
|
lin_user u
|
WHERE
|
u.id IN (
|
SELECT
|
create_user_id
|
FROM
|
project_daily d
|
WHERE
|
d.is_deleted = 0
|
AND d.is_confirm = 0
|
AND d.daily_date = #{dailyDate}
|
)
|
and u.is_deleted=0
|
</select>
|
<select id="getTodayUncommittedProjectDailysPeoples" resultType="com.cloudroam.model.UserDO">
|
select * from lin_user u where u.id in(
|
select create_user_id from project_daily d
|
where d.is_deleted=0
|
and d.daily_date=CURDATE()
|
and d.is_commit=0
|
)
|
and u.is_deleted=0
|
|
|
|
</select>
|
<select id="getTodayUncommittedProjectDailys" resultType="com.cloudroam.bo.ProjectDailyBO">
|
select t.* from (
|
select d.* ,
|
i.project_name as project_name2,
|
daily_status.label as daily_status_name,
|
daily_type.label as daily_type_name,
|
daily_commit.label as daily_commit_name,
|
daily_confirm.label as daily_confirm_name
|
|
from project_daily d
|
left join project_info i
|
on d.project_id = i.id
|
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_status' and is_deleted=0
|
) daily_status
|
on d.daily_status=daily_status.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_type' and is_deleted=0
|
) daily_type
|
on d.daily_type=daily_type.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_commit' and is_deleted=0
|
) daily_commit
|
on d.is_commit=daily_commit.`value`
|
left join (
|
select id,label,value from sys_dict_item where dict_type='daily_confirm' and is_deleted=0
|
) daily_confirm
|
on d.is_confirm=daily_confirm.`value`
|
|
) t
|
|
where t.is_deleted=0
|
and t.daily_date=CURDATE()
|
and t.is_commit=0
|
and t.create_user_id=#{createUserId}
|
</select>
|
|
<select id="getDailyDatePlanTime" resultType="java.lang.Double">
|
select sum(estimated_hours) from project_daily d where d.is_deleted=0 and d.create_user_id=#{createUserId} and d.daily_date=#{dailyDate}
|
</select>
|
<select id="getDailyDateActualTime" resultType="java.lang.Double">
|
select sum(actual_hours) from project_daily d where d.is_deleted=0 and d.create_user_id=#{createUserId} and d.daily_date=#{dailyDate}
|
</select>
|
|
<select id="existsHoursWithoutIds" resultType="com.cloudroam.vo.projectDaily.ProjectDailyHourVO">
|
SELECT
|
t.*
|
FROM
|
(
|
SELECT
|
d.create_user_id,
|
sum(d.actual_hours) as actual_hours,
|
sum(d.estimated_hours ) as estimated_hours
|
FROM
|
project_daily d
|
WHERE
|
d.is_deleted = 0
|
AND d.create_user_id = #{createUserId}
|
AND d.daily_date = #{dailyDate}
|
<if test="idList != null and idList.size() > 0">
|
AND d.id NOT IN
|
<foreach collection="idList" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
) t
|
LIMIT 1
|
</select>
|
|
|
<select id="getActualHourStatistics" resultType="com.cloudroam.vo.projectDaily.ProjectDailyStatisticsVO">
|
select info.project_name,p.project_id,date_format(p.daily_date,'%Y-%m') as year_mon , sum(p.actual_hours) as actual_hours ,sum(p.estimated_hours) as estimated_hours
|
from project_daily p
|
left join project_info info
|
on p.project_id=info.id
|
where p.is_deleted=0
|
-- and p.is_confirm=1
|
and p.daily_status != 3
|
group by project_id, year_mon,project_name
|
</select>
|
<select id="getEvaluateiActualHourStatistics"
|
resultType="com.cloudroam.vo.projectDaily.ProjectDailyStatisticsVO">
|
<if test=" type !=null and type =='month' ">
|
select info.project_name,p.project_id,date_format(p.daily_date,'%Y-%m') as year_mon , sum(p.actual_hours) as actual_hours ,sum(p.estimated_hours) as estimated_hours
|
</if>
|
<if test=" type !=null and type =='day' ">
|
select info.project_name,p.project_id,date_format(p.daily_date,'%Y-%m-%d') as year_mon , sum(p.actual_hours) as actual_hours ,sum(p.estimated_hours) as estimated_hours
|
</if>
|
from project_daily p
|
left join project_info info
|
on p.project_id=info.id
|
where p.is_deleted=0 and p.daily_status != 3
|
<if test=" projectId !=null and projectId !='' ">
|
and p.project_id= #{projectId}
|
</if>
|
<if test=" startDate !=null and startDate !='' ">
|
and DATE_FORMAT(p.daily_date,'%Y-%m-%d') >= #{startDate}
|
</if>
|
<if test=" endDate !=null and endDate !='' ">
|
and DATE_FORMAT(p.daily_date,'%Y-%m-%d') <= #{endDate}
|
</if>
|
|
<if test=" confirmState !=null and confirmState !='' ">
|
and p.is_confirm = #{confirmState}
|
</if>
|
<if test=" createUserId !=null and createUserId !='' ">
|
and p.create_user_id = #{createUserId}
|
</if>
|
group by project_id, year_mon,project_name
|
order by project_id,year_mon
|
|
</select>
|
|
<select id="getUserActualHourStatistics"
|
resultType="com.cloudroam.vo.projectDaily.ProjectDailyStatisticsVO">
|
|
select * from (
|
select ym.year_mon,ym.create_user_id,ym.project_id,s.project_name,u.nickname as user_name,ifnull(s.actual_hours,0) as actual_hours,ifnull(s.estimated_hours,0) as estimated_hours,u.show_board_flag from (
|
SELECT year_mon, project_id,u.id AS create_user_id
|
FROM (
|
<if test=" type !=null and type =='month' ">
|
SELECT date_format( p.daily_date, '%Y-%m' ) AS year_mon,project_id
|
</if>
|
<if test=" type !=null and type =='day' ">
|
SELECT date_format( p.daily_date, '%Y-%m-%d' ) AS year_mon,project_id
|
</if>
|
FROM project_daily p
|
<include refid="projectDailyCause"></include>
|
GROUP BY year_mon, id
|
) t,lin_user u
|
GROUP BY year_mon,project_id,create_user_id
|
)ym
|
left join(
|
<if test=" type !=null and type =='month' ">
|
SELECT info.project_name, p.project_id,p.create_user_id,date_format( p.daily_date, '%Y-%m' ) AS year_mon,sum( p.actual_hours ) AS actual_hours,sum( p.estimated_hours ) AS estimated_hours
|
</if>
|
<if test=" type !=null and type =='day' ">
|
SELECT info.project_name, p.project_id,p.create_user_id,date_format( p.daily_date, '%Y-%m-%d' ) AS year_mon,sum( p.actual_hours ) AS actual_hours,sum( p.estimated_hours ) AS estimated_hours
|
</if>
|
FROM project_daily p
|
LEFT JOIN project_info info ON p.project_id = info.id
|
<include refid="projectDailyCause"></include>
|
GROUP BY project_id,year_mon,project_name,create_user_id
|
)s
|
on ym.year_mon=s.year_mon and ym.create_user_id=s.create_user_id and ym.project_id=s.project_id
|
left join lin_user u on u.id=ym.create_user_id
|
) t
|
where show_board_flag=1
|
<if test=" createUserId !=null and createUserId !='' ">
|
and create_user_id = #{createUserId}
|
</if>
|
order by project_id,create_user_id,year_mon
|
</select>
|
|
|
|
<select id="getRoleHourStatistics" resultType="com.cloudroam.vo.projectDaily.ProjectDailyStatisticsVO">
|
|
select ym.year_mon,ym.project_id,ym.group_id,s.project_name,s.actual_hours,s.estimated_hours,g.name as group_name
|
from (
|
SELECT year_mon,project_id,g.id AS group_id
|
FROM(
|
<if test=" type !=null and type =='month' ">
|
SELECT date_format( p.daily_date, '%Y-%m' ) AS year_mon,project_id
|
</if>
|
<if test=" type !=null and type =='day' ">
|
SELECT date_format( p.daily_date, '%Y-%m-%d' ) AS year_mon,project_id
|
</if>
|
FROM project_daily p
|
<include refid="projectDailyCause"></include>
|
GROUP BY year_mon, id
|
) t,lin_group g
|
GROUP BY year_mon,project_id,group_id
|
)ym
|
left join (
|
<if test=" type !=null and type =='month' ">
|
SELECT info.project_name,p.project_id,g.id AS group_id,g.NAME AS group_name,date_format( p.daily_date, '%Y-%m' ) AS year_mon,sum( p.actual_hours ) AS actual_hours,sum( p.estimated_hours ) AS estimated_hours
|
</if>
|
<if test=" type !=null and type =='day' ">
|
SELECT info.project_name,p.project_id,g.id AS group_id,g.NAME AS group_name,date_format( p.daily_date, '%Y-%m-%d' ) AS year_mon,sum( p.actual_hours ) AS actual_hours,sum( p.estimated_hours ) AS estimated_hours
|
</if>
|
|
FROM project_daily p
|
LEFT JOIN project_info info ON p.project_id = info.id
|
LEFT JOIN lin_user u ON u.id = p.create_user_id
|
LEFT JOIN lin_user_group ug ON u.id = ug.user_id
|
LEFT JOIN lin_group g ON ug.group_id = g.id
|
<include refid="projectDailyCause"></include>
|
GROUP BY project_id, year_mon, project_name,group_id, group_name
|
)s
|
on ym.year_mon=s.year_mon and ym.project_id=s.project_id and ym.group_id=s.group_id
|
LEFT JOIN lin_group g ON ym.group_id = g.id
|
where 1=1
|
<if test=" createUserId !=null and createUserId !='' ">
|
and ym.group_id in (
|
select group_id from lin_user_group where user_id=#{createUserId}
|
)
|
</if>
|
|
|
order by group_id,year_mon
|
</select>
|
|
<!-- 提取会议人员日志记录-->
|
<select id="selectProjectDailyProcessList" resultType="com.cloudroam.bo.ProjectDailyBO">
|
|
select * from (
|
<include refid="selectSql"/>
|
where daily_date in (#{dailyDate},DATE_SUB(#{dailyDate},INTERVAL 1 DAY))
|
union
|
<include refid="selectSql"/>
|
where daily_date >= DATE_SUB(#{dailyDate},INTERVAL 1 Week) and daily_date<=#{dailyDate}
|
and daily_process_state is null
|
<if test=" meetingId !=null and meetingId!='' ">
|
union
|
<include refid="selectSql"/>
|
where daily_process_meeting_id=#{meetingId}
|
</if>
|
|
)t3
|
where t3.is_deleted=0
|
<if test=" createUserId !=null and createUserId !='' ">
|
and t3.create_user_id = #{createUserId}
|
</if>
|
|
|
order by daily_date
|
</select>
|
<select id="selectProjectDailyProcessWithMeetingIdList" resultType="com.cloudroam.bo.ProjectDailyBO">
|
select * from (
|
<include refid="selectSql"/>
|
where 1=1
|
<if test=" meetingId !=null and meetingId !='' ">
|
and daily_process_meeting_id=#{meetingId}
|
</if>
|
<if test=" dailyDate !=null and dailyDate !='' ">
|
and daily_date= #{dailyDate}
|
</if>
|
|
)t3
|
where t3.is_deleted=0
|
<if test=" createUserId !=null and createUserId !='' ">
|
and t3.create_user_id = #{createUserId}
|
</if>
|
|
order by daily_date
|
</select>
|
<select id="getDailyDateByMeetingId" resultType="java.lang.String">
|
select distinct DATE_FORMAT(meeting_date,'%Y-%m-%d') meeting_date from (
|
select meeting_date from meeting where id =#{meetingId}
|
union
|
select DATE_SUB(meeting_date, INTERVAL 1 DAY) as meeting_date from meeting where id =#{meetingId}
|
union
|
select daily_date as meeting_date from project_daily where daily_process_meeting_id=#{meetingId}
|
) t
|
order by meeting_date desc
|
</select>
|
<select id="selectProjectDailyTaskPage" resultType="com.cloudroam.bo.ProjectDailyBO">
|
<include refid="selectSql" />
|
where t.is_deleted=0
|
<if test=" dto.dailyDate !=null and dto.dailyDate !='' ">
|
and t.daily_date= #{dto.dailyDate}
|
</if>
|
|
<if test=" dto.projectId !=null and dto.projectId !='' ">
|
and t.project_id= #{dto.projectId}
|
</if>
|
|
<if test=" dto.createUserId !=null and dto.createUserId !='' ">
|
and t.create_user_id= #{dto.createUserId}
|
</if>
|
|
<if test=" dto.keyword !=null and dto.keyword !='' ">
|
and (
|
t.daily_content like concat('%',#{dto.keyword},'%')
|
or t.remark like concat('%',#{dto.keyword},'%')
|
or t.task_name2 like concat('%',#{dto.keyword},'%')
|
or t.task_desc2 like concat('%',#{dto.keyword},'%')
|
)
|
</if>
|
|
<if test=" dto.dailyType !=null and dto.dailyType !='' ">
|
and t.daily_type= #{dto.dailyType}
|
</if>
|
<if test=" dto.dailyStatus !=null and dto.dailyStatus !='' ">
|
and t.daily_status= #{dto.dailyStatus}
|
</if>
|
|
<if test=" dto.isCommit !=null ">
|
and t.is_commit= #{dto.isCommit}
|
</if>
|
|
<if test=" dto.isConfirm !=null ">
|
and t.is_confirm= #{dto.isConfirm}
|
</if>
|
|
<if test="dto.moduleIds != null and dto.moduleIds.size() > 0 ">
|
AND t.module_id IN
|
<foreach collection="dto.moduleIds" item="moduleId" index="index" open="(" close=")" separator=",">
|
#{moduleId}
|
</foreach>
|
</if>
|
|
order by t.daily_date desc ,t.create_user_id,t.project_id,t.create_time
|
</select>
|
<select id="getProjectDailyTaskInfo" resultType="com.cloudroam.dto.projectTask.QueryTaskDailyDTO">
|
SELECT
|
min( d.daily_date ) as minStartTime,
|
max( d.daily_date ) as maxEndTime,
|
sum( d.actual_hours ) as actualHours
|
FROM
|
project_daily d
|
WHERE
|
d.is_deleted = 0
|
<if test=" taskId !=null and taskId !='' ">
|
AND d.task_id =#{taskId}
|
</if>
|
<if test=" userId !=null and userId !='' ">
|
and d.create_user_id =#{userId}
|
</if>
|
</select>
|
|
<sql id="projectDailyCause">
|
WHERE p.is_deleted = 0
|
AND p.daily_status != 3
|
<if test=" projectId !=null and projectId !='' ">
|
and p.project_id= #{projectId}
|
</if>
|
<if test=" startDate !=null and startDate !='' ">
|
and DATE_FORMAT(p.daily_date,'%Y-%m-%d') >= #{startDate}
|
</if>
|
<if test=" endDate !=null and endDate !='' ">
|
and DATE_FORMAT(p.daily_date,'%Y-%m-%d') <= #{endDate}
|
</if>
|
|
<if test=" confirmState !=null and confirmState !='' ">
|
and p.is_confirm = #{confirmState}
|
</if>
|
<if test=" createUserId !=null and createUserId !='' ">
|
and p.create_user_id = #{createUserId}
|
</if>
|
</sql>
|
|
|
|
</mapper>
|