<?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="org.jeecg.modules.stm.audit.mapper.AuditCheckMethodMapper">
    <select id="getAllCheckMethod" resultType="java.util.Map">
        SELECT B.content,B.des,C.checkid,D.item,D.content AS complineContent,D.cgrp,
        D.cgrp_path AS cgrpPath,E.file_tp AS fileTp,E.file_path AS filePath,E.file_name AS fileName,E.id AS fileId,
        GROUP_CONCAT(G.ca_name SEPARATOR ',') AS actNames,GROUP_CONCAT(G.id SEPARATOR ',') AS actIds
        FROM audit_check_method B
        INNER JOIN audit_item_rel_check C ON B.id = C.checkid
        INNER JOIN audit_compliane_item D ON C.citemid = D.id
        LEFT JOIN  doc_files E ON D.file_id = E.id
        LEFT JOIN audit_act_rel_others F ON C.checkid = F.tid AND F.tp = 5
        LEFT JOIN audit_act G ON F.act_id = G.id
        <where>
            <if test="query.content!=null">
                B.content like CONCAT('%',#{query.content},'%')
            </if>
            <if test="query.isPublic!=null">
                and B.is_public = #{query.isPublic}
            </if>
            <if test="query.fileId!=null">
                and D.file_id = #{query.fileId}
            </if>
            <if test="query.projectid!=null">
                and B.id not in (select checkid from audit_task where projectid = #{query.projectid})
            </if>
        </where>
        GROUP BY B.content, B.des, C.checkid, D.item, D.content, D.cgrp, D.cgrp_path,E.file_tp, E.file_path, E.file_name, E.id
        ORDER BY C.citemid,B.id
    </select>
</mapper>