| | |
| | | </select> |
| | | <select id="projectList" resultType="com.ruoyi.system.vo.EntrustProjectVo"> |
| | | select |
| | | t1.*, latest.record_time as checkTime,result.risk_level |
| | | t1.*,result.risk_level |
| | | from project t1 |
| | | left join device_usage t2 on t1.id = t2.project_id |
| | | left join ( |
| | | select device_id, max(create_time) as record_time |
| | | from record |
| | | group by device_id |
| | | ) latest on t2.device_id = latest.device_id |
| | | |
| | | left join ( |
| | | select score,project_id,risk_level |
| | | from eval_result |
| | |
| | | and #{query.endTime} >=latest.record_time |
| | | </if> |
| | | GROUP BY t1.id |
| | | order by latest.record_time desc |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="projectReport" resultType="com.ruoyi.system.vo.EntrustProjectReportVo"> |
| | | select t1.name,t1.type,t2.score,t2.risk_level,t3.time as checkTime |
| | |
| | | LEFT JOIN project t3 on t2.project_id = t3.id |
| | | LEFT JOIN plan t4 on t2.plan_id = t4.id |
| | | LEFT JOIN problem t5 ON t1.problem_id = t5.id |
| | | where t1.deleted = 0 and t2.deleted = 0 and t1.`level` =1 |
| | | <if test="query.projectId != null"> |
| | | where t1.deleted = 0 and t2.deleted = 0 and t1.`level` =0 |
| | | <if test="query.recordIds != null"> |
| | | and t1.id in |
| | | <foreach item="item" index="index" collection="query.recordIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="query.projectId != null"> |
| | | and t2.project_id = #{query.projectId} |
| | | </if> |
| | | <if test="query.reformed != null"> |
| | |
| | | LEFT JOIN project t3 on t2.project_id = t3.id |
| | | LEFT JOIN plan t4 on t2.plan_id = t4.id |
| | | LEFT JOIN problem t5 ON t1.problem_id = t5.id |
| | | where t1.deleted = 0 and t2.deleted = 0 and t1.device_id is not null |
| | | where t1.deleted = 0 and t2.deleted = 0 and t1.device_id is not null and |
| | | <if test="query.recordIds != null"> |
| | | and t1.id in |
| | | <foreach item="item" index="index" collection="query.recordIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.projectId != null"> |
| | | and t2.project_id = #{query.projectId} |
| | | </if> |
| | |
| | | LEFT JOIN plan t4 on t2.plan_id = t4.id |
| | | LEFT JOIN problem t5 ON t1.problem_id = t5.id |
| | | where t1.deleted = 0 and t2.deleted = 0 and t1.device_id is null |
| | | <if test="query.recordIds != null"> |
| | | and t1.id in |
| | | <foreach item="item" index="index" collection="query.recordIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.projectId != null"> |
| | | and t2.project_id = #{query.projectId} |
| | | </if> |