|
@@ -12,104 +12,60 @@
|
|
|
SELECT
|
|
|
DISTINCT a.id,
|
|
|
a.`no`,
|
|
|
- (
|
|
|
- CASE
|
|
|
-
|
|
|
- WHEN a.source_type = 1 THEN
|
|
|
- b.type_id
|
|
|
- WHEN a.source_type = 2 THEN
|
|
|
- b2.type_id
|
|
|
- WHEN a.source_type = 3 THEN
|
|
|
- b3.type_id
|
|
|
- WHEN a.source_type = 4 THEN
|
|
|
- b4.type_id ELSE b5.type_id
|
|
|
- END
|
|
|
- ) AS type_id,
|
|
|
- (
|
|
|
- CASE
|
|
|
-
|
|
|
- WHEN a.source_type = 1 THEN
|
|
|
- t.NAME
|
|
|
- WHEN a.source_type = 2 THEN
|
|
|
- t2.NAME
|
|
|
- WHEN a.source_type = 3 THEN
|
|
|
- t3.NAME
|
|
|
- WHEN a.source_type = 4 THEN
|
|
|
- t4.NAME ELSE t5.NAME
|
|
|
- END
|
|
|
- ) AS type_name,
|
|
|
- (
|
|
|
- CASE
|
|
|
-
|
|
|
- WHEN a.source_type = 1 THEN
|
|
|
- b.project_id
|
|
|
- WHEN a.source_type = 2 THEN
|
|
|
- b2.contract_id
|
|
|
- WHEN a.source_type = 3 THEN
|
|
|
- b3.project_id
|
|
|
- WHEN a.source_type = 4 THEN
|
|
|
- b4.project_id ELSE b5.project_id
|
|
|
- END
|
|
|
- ) AS project_id,
|
|
|
- (
|
|
|
- CASE
|
|
|
-
|
|
|
- WHEN a.source_type = 4 THEN
|
|
|
- b4.project_name ELSE b5.project_name
|
|
|
- END
|
|
|
- ) AS project_name,
|
|
|
- (
|
|
|
- CASE
|
|
|
-
|
|
|
- WHEN a.source_type = 1 THEN
|
|
|
- b.report_number
|
|
|
- WHEN a.source_type = 2 THEN
|
|
|
- b2.report_number
|
|
|
- WHEN a.source_type = 3 THEN
|
|
|
- b3.report_number
|
|
|
- WHEN a.source_type = 4 THEN
|
|
|
- b4.report_number ELSE b5.report_number
|
|
|
- END
|
|
|
- ) AS report_number,
|
|
|
- (
|
|
|
- CASE
|
|
|
-
|
|
|
- WHEN a.source_type = 1 THEN
|
|
|
- so.NAME
|
|
|
- WHEN a.source_type = 2 THEN
|
|
|
- so2.NAME
|
|
|
- WHEN a.source_type = 3 THEN
|
|
|
- so3.NAME
|
|
|
- WHEN a.source_type = 4 THEN
|
|
|
- so4.NAME ELSE so5.NAME
|
|
|
- END
|
|
|
- ) AS dept_name,
|
|
|
- (
|
|
|
- CASE
|
|
|
-
|
|
|
- WHEN a.source_type = 1 THEN
|
|
|
- us.NAME
|
|
|
- WHEN a.source_type = 2 THEN
|
|
|
- us2.NAME
|
|
|
- WHEN a.source_type = 3 THEN
|
|
|
- us3.NAME
|
|
|
- WHEN a.source_type = 4 THEN
|
|
|
- us4.NAME ELSE us5.NAME
|
|
|
- END
|
|
|
- ) AS NAME,
|
|
|
- (
|
|
|
- CASE
|
|
|
-
|
|
|
- WHEN a.source_type = 1 THEN
|
|
|
- b.`number`
|
|
|
- WHEN a.source_type = 2 THEN
|
|
|
- b2.`number`
|
|
|
- WHEN a.source_type = 3 THEN
|
|
|
- b3.`number`
|
|
|
- WHEN a.source_type = 4 THEN
|
|
|
- b4.`number` ELSE b5.`number`
|
|
|
- END
|
|
|
- ) AS `number`,
|
|
|
+ (CASE
|
|
|
+ WHEN a.source_type = 1 THEN b.type_id
|
|
|
+ WHEN a.source_type = 2 THEN b2.type_id
|
|
|
+ WHEN a.source_type = 3 THEN b3.type_id
|
|
|
+ WHEN a.source_type = 4 THEN b4.type_id
|
|
|
+ WHEN a.source_type = 6 THEN b6.type_id
|
|
|
+ ELSE b5.type_id END) AS type_id,
|
|
|
+ (CASE
|
|
|
+ WHEN a.source_type = 1 THEN t.name
|
|
|
+ WHEN a.source_type = 2 THEN t2.name
|
|
|
+ WHEN a.source_type = 3 THEN t3.name
|
|
|
+ WHEN a.source_type = 4 THEN t4.name
|
|
|
+ WHEN a.source_type = 6 THEN t6.name
|
|
|
+ ELSE t5.name END) AS type_name,
|
|
|
+ (CASE
|
|
|
+ WHEN a.source_type = 1 THEN b.project_id
|
|
|
+ WHEN a.source_type = 2 THEN b2.contract_id
|
|
|
+ WHEN a.source_type = 3 THEN b3.project_id
|
|
|
+ WHEN a.source_type = 4 THEN b4.project_id
|
|
|
+ ELSE b5.project_id END) AS project_id,
|
|
|
+ (CASE
|
|
|
+ WHEN a.source_type = 1 THEN p.project_name
|
|
|
+ WHEN a.source_type = 2 THEN contr2.contract_name
|
|
|
+ WHEN a.source_type = 3 THEN p3.project_name
|
|
|
+ WHEN a.source_type = 4 THEN b4.project_name
|
|
|
+ WHEN a.source_type = 6 THEN b6.reimbuser_name
|
|
|
+ ELSE b5.project_name END) AS project_name,
|
|
|
+ (CASE
|
|
|
+ WHEN a.source_type = 1 THEN b.report_number
|
|
|
+ WHEN a.source_type = 2 THEN b2.report_number
|
|
|
+ WHEN a.source_type = 3 THEN b3.report_number
|
|
|
+ WHEN a.source_type = 4 THEN b4.report_number
|
|
|
+ ELSE b5.report_number END) AS report_number,
|
|
|
+ (CASE
|
|
|
+ WHEN a.source_type = 1 THEN so.name
|
|
|
+ WHEN a.source_type = 2 THEN so2.name
|
|
|
+ WHEN a.source_type = 3 THEN so3.name
|
|
|
+ WHEN a.source_type = 4 THEN so4.name
|
|
|
+ WHEN a.source_type = 6 THEN so6.name
|
|
|
+ ELSE so5.name END) AS dept_name,
|
|
|
+ (CASE
|
|
|
+ WHEN a.source_type = 1 THEN us.name
|
|
|
+ WHEN a.source_type = 2 THEN us2.name
|
|
|
+ WHEN a.source_type = 3 THEN us3.name
|
|
|
+ WHEN a.source_type = 4 THEN us4.name
|
|
|
+ WHEN a.source_type = 6 THEN us6.name
|
|
|
+ ELSE us5.name END) AS name,
|
|
|
+ (CASE
|
|
|
+ WHEN a.source_type = 1 THEN b.`number`
|
|
|
+ WHEN a.source_type = 2 THEN b2.`number`
|
|
|
+ WHEN a.source_type = 3 THEN b3.`number`
|
|
|
+ WHEN a.source_type = 4 THEN b4.`number`
|
|
|
+ WHEN a.source_type = 6 THEN b6.`number`
|
|
|
+ ELSE b5.`number` END) AS `number`,
|
|
|
a.user_name,
|
|
|
a.reim_date,
|
|
|
a.type,
|
|
@@ -123,50 +79,50 @@
|
|
|
a.payment_time,
|
|
|
a.reimbursement_type,
|
|
|
pru.purchase_no,
|
|
|
+ b.user_id as projectUser,
|
|
|
+ b.dept_id as projectOffice,
|
|
|
+ b3.user_id as reportUser,
|
|
|
+ b3.dept_id as reportOffice,
|
|
|
a.update_time,
|
|
|
a.approval_time
|
|
|
FROM
|
|
|
zs_reimbursement_info a
|
|
|
- LEFT JOIN zs_reimbursement_detail_info b ON a.id = b.info_id
|
|
|
- AND b.del_flag = 0
|
|
|
- LEFT JOIN cw_reimbursement_type_info t ON b.type_id = t.id
|
|
|
- AND t.del_flag = 0
|
|
|
- LEFT JOIN sys_office so ON so.id = b.dept_id
|
|
|
- AND so.del_flag = 0
|
|
|
- LEFT JOIN sys_user us ON us.id = b.user_id
|
|
|
- AND us.del_flag = 0
|
|
|
- LEFT JOIN zs_reimbursement_detail_info_contract b2 ON a.id = b2.info_id
|
|
|
- AND b2.del_flag = 0
|
|
|
- LEFT JOIN cw_reimbursement_type_info t2 ON b2.type_id = t2.id
|
|
|
- AND t2.del_flag = 0
|
|
|
- LEFT JOIN sys_office so2 ON so2.id = b2.dept_id
|
|
|
- AND so2.del_flag = 0
|
|
|
- LEFT JOIN sys_user us2 ON us2.id = b2.user_id
|
|
|
- AND us2.del_flag = 0
|
|
|
- LEFT JOIN zs_reimbursement_detail_info_report b3 ON a.id = b3.info_id
|
|
|
- AND b3.del_flag = 0
|
|
|
- LEFT JOIN cw_reimbursement_type_info t3 ON b3.type_id = t3.id
|
|
|
- AND t3.del_flag = 0
|
|
|
- LEFT JOIN sys_office so3 ON so3.id = b3.dept_id
|
|
|
- AND so3.del_flag = 0
|
|
|
- LEFT JOIN sys_user us3 ON us3.id = b3.user_id
|
|
|
- AND us3.del_flag = 0
|
|
|
- LEFT JOIN zs_reimbursement_detail_info_other b4 ON a.id = b4.info_id
|
|
|
- AND b4.del_flag = 0
|
|
|
- LEFT JOIN cw_reimbursement_type_info t4 ON b4.type_id = t4.id
|
|
|
- AND t4.del_flag = 0
|
|
|
- LEFT JOIN sys_office so4 ON so4.id = b4.dept_id
|
|
|
- AND so4.del_flag = 0
|
|
|
- LEFT JOIN sys_user us4 ON us4.id = b4.user_id
|
|
|
- AND us4.del_flag = 0
|
|
|
- LEFT JOIN zs_reimbursement_detail_info_procured b5 ON a.id = b5.info_id
|
|
|
- AND b5.del_flag = 0
|
|
|
- LEFT JOIN cw_reimbursement_type_info t5 ON b5.type_id = t5.id
|
|
|
- AND t5.del_flag = 0
|
|
|
- LEFT JOIN sys_office so5 ON so5.id = b5.dept_id
|
|
|
- AND so5.del_flag = 0
|
|
|
- LEFT JOIN sys_user us5 ON us5.id = b5.user_id
|
|
|
- AND us5.del_flag = 0
|
|
|
+ LEFT JOIN zs_reimbursement_detail_info b ON a.id = b.info_id AND b.del_flag = 0
|
|
|
+ left join cw_reimbursement_type_info t on b.type_id = t.id and t.del_flag = 0
|
|
|
+ left join cw_project_records p on p.id = b.project_id and p.del_flag = 0
|
|
|
+ left join sys_office so on so.id = b.dept_id and so.del_flag = 0
|
|
|
+ left join sys_user us on us.id = b.user_id and us.del_flag = 0
|
|
|
+
|
|
|
+ LEFT JOIN cw_reimbursement_detail_info_contract b2 ON a.id = b2.info_id AND b2.del_flag = 0
|
|
|
+ left join cw_reimbursement_type_info t2 on b2.type_id = t2.id and t2.del_flag = 0
|
|
|
+ left join cw_work_contract_info contr2 on contr2.id = b2.contract_id and contr2.del_flag = 0
|
|
|
+ left join sys_office so2 on so2.id = b2.dept_id and so2.del_flag = 0
|
|
|
+ left join sys_user us2 on us2.id = b2.user_id and us2.del_flag = 0
|
|
|
+
|
|
|
+ LEFT JOIN cw_reimbursement_detail_info_report b3 ON a.id = b3.info_id AND b3.del_flag = 0
|
|
|
+ left join cw_reimbursement_type_info t3 on b3.type_id = t3.id and t3.del_flag = 0
|
|
|
+ left join cw_project_records p3 on p3.id = b3.project_id and p3.del_flag = 0
|
|
|
+ left join sys_office so3 on so3.id = b3.dept_id and so3.del_flag = 0
|
|
|
+ left join sys_user us3 on us3.id = b3.user_id and us3.del_flag = 0
|
|
|
+
|
|
|
+ LEFT JOIN zs_reimbursement_detail_info_other b4 ON a.id = b4.info_id AND b4.del_flag = 0
|
|
|
+ left join cw_reimbursement_type_info t4 on b4.type_id = t4.id and t4.del_flag = 0
|
|
|
+ left join cw_project_records p4 on p4.id = b4.project_id and p4.del_flag = 0
|
|
|
+ left join sys_office so4 on so4.id = b4.dept_id and so4.del_flag = 0
|
|
|
+ left join sys_user us4 on us4.id = b4.user_id and us4.del_flag = 0
|
|
|
+
|
|
|
+ LEFT JOIN zs_reimbursement_detail_info_procured b5 ON a.id = b5.info_id AND b5.del_flag = 0
|
|
|
+ left join cw_reimbursement_type_info t5 on b5.type_id = t5.id and t5.del_flag = 0
|
|
|
+ left join cw_project_records p5 on p5.id = b5.project_id and p5.del_flag = 0
|
|
|
+ left join sys_office so5 on so5.id = b5.dept_id and so5.del_flag = 0
|
|
|
+ left join sys_user us5 on us5.id = b5.user_id and us5.del_flag = 0
|
|
|
+
|
|
|
+
|
|
|
+ LEFT JOIN human_reimbursement_detail_info_procured b6 ON a.id = b6.info_id AND b6.del_flag = 0
|
|
|
+ left join cw_reimbursement_type_info t6 on b6.type_id = t6.id and t6.del_flag = 0
|
|
|
+ left join sys_office so6 on so6.id = b6.dept_id and so6.del_flag = 0
|
|
|
+ left join sys_user us6 on us6.id = b6.user_id and us6.del_flag = 0
|
|
|
+
|
|
|
LEFT JOIN sys_user c ON a.create_by_id = c.id
|
|
|
LEFT JOIN act_ru_task d ON a.proc_ins_id = d.PROC_INST_ID_
|
|
|
LEFT JOIN material_management_pruchase_request_basics pru ON pru.id = a.purchase_id
|
|
@@ -518,6 +474,38 @@
|
|
|
order by a.number asc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getCwReportDetailList" resultType="com.jeeplus.centrecareful.approvalInfo.domain.ZsReimbursementDetailInfoReport">
|
|
|
+ select
|
|
|
+ a.id,
|
|
|
+ a.create_by_id,
|
|
|
+ a.create_time,
|
|
|
+ a.del_flag,
|
|
|
+ a.info_id,
|
|
|
+ a.user_id,
|
|
|
+ a.dept_id,
|
|
|
+ a.type_id,
|
|
|
+ a.report_id,
|
|
|
+ a.report_number,
|
|
|
+ a.number,
|
|
|
+ a.receipt_number,
|
|
|
+ a.days,
|
|
|
+ a.content,
|
|
|
+ su.name as user_name,
|
|
|
+ so.name as dept_name,
|
|
|
+ cw_type.name as type_name,
|
|
|
+ cw_report.document_no as document_no,
|
|
|
+ cw_project.project_name as project_name,
|
|
|
+ a.project_id
|
|
|
+ from cw_reimbursement_detail_info_report a
|
|
|
+ left join sys_user su on a.user_id = su.id and su.del_flag = '0'
|
|
|
+ left join sys_office so on a.dept_id = so.id and so.del_flag = '0'
|
|
|
+ left join cw_reimbursement_type_info cw_type on cw_type.id = a.type_id and cw_type.del_flag = '0'
|
|
|
+ left join cw_project_report cw_report on cw_report.id = a.report_id and cw_report.del_flag = '0'
|
|
|
+ left join cw_project_records cw_project on cw_project.id = a.project_id and cw_project.del_flag = '0'
|
|
|
+ where a.del_flag = '0' and a.info_id = #{id}
|
|
|
+ order by a.number asc
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getDetailList" resultType="com.jeeplus.centrecareful.approvalInfo.domain.ZsReimbursementDetailInfo">
|
|
|
select
|
|
|
a.id,
|
|
@@ -677,4 +665,11 @@
|
|
|
</where>
|
|
|
</delete>
|
|
|
|
|
|
+ <select id="findUserById" resultType="string">
|
|
|
+ select name from sys_user where id = #{projectUser}
|
|
|
+ </select>
|
|
|
+ <select id="findOfficeById" resultType="string">
|
|
|
+ select name from sys_office where id = #{projectOffice}
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|