<?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.nantian.cloud.jly.mapper.CheckGroupEpcMapper">
    <delete id="deleteEpc">
        DELETE FROM check_group_epc WHERE check_plan_id = #{checkPlanId} AND group_id = #{groupId}
    </delete>


    <select id="queryEpc" resultType="java.util.Map">
        SELECT e.*,g.duties,g.name,g.dept,
        g.calculate_authority as calculateAuthority,g.personnel_authority as personnelAuthority,
        g.tool_authority as toolAuthority,g.data_authority as dataAuthority,g.record_authority as recordAuthority
        FROM check_group_epc e
        LEFT JOIN check_group g ON g.id = e.group_id
        <trim prefix="where" prefixOverrides="and">
            <if test="checkPlanId != null">
                and e.check_plan_id = #{checkPlanId}
            </if>
            <if test="epc != null">
                and e.epc = #{epc}
            </if>
            <if test="groupId != null">
                and e.group_id = #{groupId}
            </if>
        </trim>
    </select>
</mapper>
