You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
4.2 KiB
98 lines
4.2 KiB
<?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.biutag.supervision.mapper.Report.ReportProjectMapper"> |
|
<!-- flow.report_link != "state"--> |
|
<select id="getProjectWorkVoList" resultType="com.biutag.supervision.pojo.vo.work.ProjectWorkVo"> |
|
SELECT |
|
if(w.id is not null ,p2.id ,project.id) as reportId, |
|
if(w.id is not null ,p2.report_name ,project.report_name) as reportName, |
|
if(w.id is not null ,p2.report_type ,project.report_type) as reportType, |
|
flow.report_code as work, |
|
flow.areport_time as time, |
|
flow.approver_state as flowState, |
|
flow.report_link as flowCode, |
|
flow.approver_state as approverState, |
|
if(w.id is not null ,1,0) as isWarning, |
|
w.id as warningId, |
|
flow.id as flowId |
|
FROM |
|
report_flow as flow |
|
LEFT JOIN report_project as project on project.id = flow.report_id |
|
LEFT JOIN warning_record as w on w.id = flow.report_id |
|
LEFT JOIN report_project as p2 on p2.id = w.report_id |
|
<where> |
|
flow.is_init is null |
|
AND ( |
|
(w.id IS NULL AND project.delete_flag = 0) |
|
OR (w.id IS NOT NULL AND p2.delete_flag = 0) |
|
) |
|
<if test="userId != null and userId != ''"> |
|
and flow.approver_id = #{userId} |
|
</if> |
|
<if test="code != null and code != ''"> |
|
<if test="code != 'second'"> |
|
and flow.approver_state = 'start' and (project.is_recessed = 0 or project.is_recessed is NULL) |
|
</if> |
|
<if test="code != 'first' "> |
|
and ( flow.approver_state = 'end' or flow.approver_state = 'reject') |
|
</if> |
|
</if> |
|
</where> |
|
order by flow.areport_time desc |
|
</select> |
|
|
|
<select id="getProjectTabWorkVo" resultType="com.biutag.supervision.pojo.vo.work.ProjectTabWorkVo"> |
|
SELECT |
|
SUM(case when flow.approver_state = 'start' then 1 ELSE 0 end) as first, |
|
SUM(case when flow.approver_state in ('end','reject') then 1 ELSE 0 end) as second |
|
from |
|
report_flow flow |
|
LEFT JOIN report_project as project on project.id = flow.report_id |
|
<where> |
|
flow.is_init is null and project.is_recessed = 0 AND project.delete_flag = 0 |
|
<if test="userId != null and userId != ''"> |
|
and flow.approver_id = #{userId} |
|
</if> |
|
</where> |
|
</select> |
|
|
|
<select id="queryPage" resultType="com.biutag.supervision.pojo.vo.entryWindow.EntryWindowVo"> |
|
SELECT p.*,f.approver_id as flowUserId from report_project as p |
|
LEFT JOIN report_flow as f on p.id = f.report_id |
|
${ew.getCustomSqlSegment} |
|
</select> |
|
|
|
<select id="queryPageWarning" resultType="com.biutag.supervision.pojo.vo.entryWindow.EntryWindowVo"> |
|
SELECT |
|
p.*, |
|
COUNT(wr.id) AS count |
|
FROM |
|
report_project p |
|
LEFT JOIN |
|
report_flow f ON p.id = f.report_id |
|
LEFT JOIN |
|
warning_record wr ON wr.report_id = p.id |
|
${ew.getCustomSqlSegment} |
|
</select> |
|
|
|
<select id="queryPageCondition" resultType="com.biutag.supervision.pojo.vo.statement.ConditionVo"> |
|
SELECT |
|
p.*, |
|
if(p.archiving_reduce_money is not null,(p.archiving_reduce_money / p.report_money) * 100,0) as reductionRate, |
|
( |
|
SELECT f.approver from report_flow f WHERE f.report_id = p.id AND f.report_link = 'audit' and (f.approver_state = 'start' or f.approver_state ='end') |
|
LIMIT 1 |
|
) as approvalSupervisor, |
|
rv.review_content as content |
|
from report_project p LEFT JOIN report_flow flow on p.id = flow.report_id |
|
left join report_review rv on p.id = rv.report_id |
|
${ew.getCustomSqlSegment} |
|
</select> |
|
<select id="selectByIdIncludeDeleted" resultType="com.biutag.supervision.pojo.entity.report.ReportProject"> |
|
SELECT * |
|
FROM report_project |
|
WHERE id = #{id} |
|
</select> |
|
</mapper>
|
|
|