<?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.wb.config.mapper.WbCheckItemMapper">

    <select id="queryWbCheckItems" resultType="org.jeecg.modules.stm.wb.config.entity.WbCheckItem">
        SELECT A.id,A.tp,A.check_id as checkId,A.tid,A.des,B.name as tname,
               B.tp as targitTp
        FROM  wb_check_item A
        INNER JOIN audit_inner_ctrl_item B ON A.tid = B.id

        <where>
            A.tp=1
            <if test="checkId!=null">
                and A.check_id = #{checkId}
            </if>
        </where>
    </select>

    <select id="queryWbCheckMtrics" resultType="org.jeecg.modules.stm.wb.config.entity.WbCheckItem">
        SELECT A.id,A.tp,A.check_id as checkId,A.tid,A.des,B.mtrc_name as tname,
               B.mtrc_ctp as mtrcCtp,B.domain_no as domainNo,B.des as mtrcDes
        FROM  wb_check_item A
        INNER JOIN metric_monitor_set B ON A.tid = B.id

        <where>
            A.tp=2
            <if test="checkId!=null">
                and A.check_id = #{checkId}
            </if>
        </where>
    </select>

</mapper>