|
@@ -118,6 +118,63 @@
|
|
ORDER BY a.creator_id, a.create_date desc
|
|
ORDER BY a.creator_id, a.create_date desc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="getAllReportByDateNew" resultType="java.util.Map">
|
|
|
|
+ SELECT a.id, a.creator_id as creatorId, c.name,uwb.name as realName,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId,c.corpwx_deptid as corpwxDeptId, b.project_name AS project,b.project_code as projectCode,b.category_name as categoryName, a.working_time AS duration, a.content, a.create_time AS time,a.create_date as createDate,
|
|
|
|
+ a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType,a.start_time as startTime,u.job_number as jobNumber,
|
|
|
|
+ a.end_time as endTime, d.name as subProjectName,d.code as subProjectCode,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime,a.progress as progress,
|
|
|
|
+ a.department_audit_state as departmentAuditState, a.stage, a.pic_str as picStr, multi_worktime as multiWorktime,a.is_dept_audit as isDeptAudit,a.group_audit_state as groupAuditState,task_group.incharger_id as inchargerId,a.project_audit_state as projectAuditState,a.audit_dept_managerid as deptAuditorName
|
|
|
|
+ ,c.plate1 as plate1,c.plate2 as plate2,c.plate3 as plate3,c.plate4 as plate4,c.plate5 as plate5
|
|
|
|
+ , reject_reason as rejectReason, reject_username as rejectUsername, reject_userid as rejectUserid, degree_id as degree_id,report_extra_degree.name as degreeName,task_group.name as groupName,a.group_id as groupId,a.custom_data as customData
|
|
|
|
+ ,u.name as projectAuditorName,u.corpwx_userid as projectAuditorCorpwxUserId, a.project_auditor_id as projectAuditorId, department.department_name as departmentName,dp2.department_name as buDepartmentName,department.department_id as departmentId, a.overtime_hours as overtimeHours, a.custom_text as customText,a.project_audit_time as projectAuditTime,project_main.name as projectMainName,
|
|
|
|
+ a.extra_field1 as extraField1,a.extra_field2 as extraField2,a.extra_field3 as extraField3, a.batch_id as batchId,a.sap_service_id as sapServiceId,b.status as projectStatus,DATE_FORMAT(b.finish_date,'%Y-%m-%d') as finishDate,ps.project_category_sub as projectCategorySub
|
|
|
|
+ ,u2.name as projectManagerName,u2.corpwx_userid as projectManagerCorpwxUserId, multi_degr_id as multiDegrId,b.current_stage_name as stageName
|
|
|
|
+ FROM report AS a
|
|
|
|
+ JOIN project AS b ON a.project_id=b.id
|
|
|
|
+ LEFT JOIN project_separate AS ps on b.id=ps.id
|
|
|
|
+ LEFT JOIN user AS c ON a.creator_id=c.id
|
|
|
|
+ LEFT JOIN user_with_beisen AS uwb ON uwb.job_number=c.job_number and uwb.company_id=c.company_id
|
|
|
|
+ left join sub_project as d on d.id = a.sub_project_id
|
|
|
|
+ left join task on task.id = a.task_id
|
|
|
|
+ left join report_extra_degree on report_extra_degree.id = a.degree_id
|
|
|
|
+ left join task_group on task_group.id = a.group_id
|
|
|
|
+ left join user u on u.id = a.project_auditor_id
|
|
|
|
+ left join user u2 on u2.id = b.incharger_id
|
|
|
|
+ left join department on department.department_id = a.dept_id
|
|
|
|
+ left join department dp2 on dp2.department_id = b.bu_id
|
|
|
|
+ left join project_main on b.project_main_id=project_main.id
|
|
|
|
+ WHERE (<if test="stateKey == null or stateKey == 0">
|
|
|
|
+ a.state = 1
|
|
|
|
+ </if>
|
|
|
|
+ <if test="stateKey!=null">
|
|
|
|
+ <if test="stateKey==1">
|
|
|
|
+ (a.state = 1 or a.state = 0 or a.state = -1)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="stateKey==2">
|
|
|
|
+ (a.state=0 or a.state = -1)
|
|
|
|
+ </if>
|
|
|
|
+ </if>)
|
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
|
+ AND a.create_date between #{startDate} and #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="projectId != null">
|
|
|
|
+ AND a.project_id = #{projectId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyId != null">
|
|
|
|
+ AND c.company_id = #{companyId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="userId != null">
|
|
|
|
+ AND a.creator_id = #{userId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="organizationId !=1 and branchDepartment != null and branchDepartment.size()>0">
|
|
|
|
+ AND department.department_id in
|
|
|
|
+ <foreach collection="branchDepartment" item="deptId" separator="," close=")" open="(" index="index">
|
|
|
|
+ #{deptId}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ ORDER BY a.creator_id, a.create_date desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<select id="getAllReportByDateWithReportLog" resultType="java.util.Map">
|
|
<select id="getAllReportByDateWithReportLog" resultType="java.util.Map">
|
|
SELECT a.id, a.creator_id as creatorId, c.name,uwb.name as realName,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId,c.corpwx_deptid as corpwxDeptId, b.project_name AS project,b.project_code as projectCode,b.category_name as categoryName, a.working_time AS duration, a.content, a.create_time AS time,a.create_date as createDate,
|
|
SELECT a.id, a.creator_id as creatorId, c.name,uwb.name as realName,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId,c.corpwx_deptid as corpwxDeptId, b.project_name AS project,b.project_code as projectCode,b.category_name as categoryName, a.working_time AS duration, a.content, a.create_time AS time,a.create_date as createDate,
|
|
a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType,a.start_time as startTime,u.job_number as jobNumber,
|
|
a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType,a.start_time as startTime,u.job_number as jobNumber,
|
|
@@ -176,6 +233,64 @@
|
|
ORDER BY a.creator_id, a.create_date desc
|
|
ORDER BY a.creator_id, a.create_date desc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="getAllReportByDateWithReportLogNew" resultType="java.util.Map">
|
|
|
|
+ SELECT a.id, a.creator_id as creatorId, c.name,uwb.name as realName,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId,c.corpwx_deptid as corpwxDeptId, b.project_name AS project,b.project_code as projectCode,b.category_name as categoryName, a.working_time AS duration, a.content, a.create_time AS time,a.create_date as createDate,
|
|
|
|
+ a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType,a.start_time as startTime,u.job_number as jobNumber,
|
|
|
|
+ a.end_time as endTime, d.name as subProjectName,d.code as subProjectCode,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime,a.progress as progress,
|
|
|
|
+ a.department_audit_state as departmentAuditState, a.stage, a.pic_str as picStr, multi_worktime as multiWorktime,a.is_dept_audit as isDeptAudit,a.group_audit_state as groupAuditState,task_group.incharger_id as inchargerId,a.project_audit_state as projectAuditState,a.audit_dept_managerid as deptAuditorName
|
|
|
|
+ ,c.plate1 as plate1,c.plate2 as plate2,c.plate3 as plate3,c.plate4 as plate4,c.plate5 as plate5
|
|
|
|
+ , reject_reason as rejectReason, reject_username as rejectUsername, reject_userid as rejectUserid, degree_id as degree_id,report_extra_degree.name as degreeName,task_group.name as groupName,a.group_id as groupId,a.custom_data as customData
|
|
|
|
+ ,u.name as projectAuditorName,u.corpwx_userid as projectAuditorCorpwxUserId, a.project_auditor_id as projectAuditorId, department.department_name as departmentName,dp2.department_name as buDepartmentName,department.department_id as departmentId, a.overtime_hours as overtimeHours, a.custom_text as customText,a.project_audit_time as projectAuditTime,project_main.name as projectMainName,
|
|
|
|
+ GROUP_CONCAT(rlog.operator_id,'@', rlog.operate_date,'@', rlog.msg SEPARATOR '❤') AS logMsg,a.extra_field1 as extraField1,a.extra_field2 as extraField2,a.extra_field3 as extraField3,a.batch_id as batchId,a.sap_service_id as sapServiceId,b.status as projectStatus,DATE_FORMAT(b.finish_date,'%Y-%m-%d') as finishDate,ps.project_category_sub as projectCategorySub
|
|
|
|
+ ,u2.name as projectManagerName,u2.corpwx_userid as projectManagerCorpwxUserId, multi_degr_id as multiDegrId,b.current_stage_name as stageName
|
|
|
|
+ FROM report AS a
|
|
|
|
+ JOIN project AS b ON a.project_id=b.id
|
|
|
|
+ LEFT JOIN project_separate AS ps on b.id=ps.id
|
|
|
|
+ LEFT JOIN user AS c ON a.creator_id=c.id
|
|
|
|
+ LEFT JOIN user_with_beisen AS uwb ON uwb.job_number=c.job_number and uwb.company_id=c.company_id
|
|
|
|
+ left join sub_project as d on d.id = a.sub_project_id
|
|
|
|
+ left join task on task.id = a.task_id
|
|
|
|
+ left join report_extra_degree on report_extra_degree.id = a.degree_id
|
|
|
|
+ left join task_group on task_group.id = a.group_id
|
|
|
|
+ left join user u on u.id = a.project_auditor_id
|
|
|
|
+ left join user u2 on u2.id = b.incharger_id
|
|
|
|
+ left join department on department.department_id = a.dept_id
|
|
|
|
+ left join department dp2 on dp2.department_id = b.bu_id
|
|
|
|
+ left join project_main on b.project_main_id=project_main.id
|
|
|
|
+ left join report_log_detail rlog on rlog.report_id = a.id
|
|
|
|
+ WHERE (<if test="stateKey == null or stateKey == 0">
|
|
|
|
+ a.state = 1
|
|
|
|
+ </if>
|
|
|
|
+ <if test="stateKey!=null">
|
|
|
|
+ <if test="stateKey==1">
|
|
|
|
+ (a.state = 1 or a.state = 0 or a.state = -1)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="stateKey==2">
|
|
|
|
+ (a.state=0 or a.state = -1)
|
|
|
|
+ </if>
|
|
|
|
+ </if>)
|
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
|
+ AND a.create_date between #{startDate} and #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="projectId != null">
|
|
|
|
+ AND a.project_id = #{projectId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyId != null">
|
|
|
|
+ AND c.company_id = #{companyId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="userId != null">
|
|
|
|
+ AND a.creator_id = #{userId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="organizationId != 1 and branchDepartment != null and branchDepartment.size()>0">
|
|
|
|
+ AND department.department_id in
|
|
|
|
+ <foreach collection="branchDepartment" item="deptId" separator="," close=")" open="(" index="index">
|
|
|
|
+ #{deptId}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ group by a.id
|
|
|
|
+ ORDER BY a.creator_id, a.create_date desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
|
|
<select id="geReportByProject" resultType="java.util.Map">
|
|
<select id="geReportByProject" resultType="java.util.Map">
|
|
SELECT project_main.name as projectMainName,project_main.code as projectMainCode,
|
|
SELECT project_main.name as projectMainName,project_main.code as projectMainCode,
|