<?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.CheckGaugesTypeReportMapper">

    <!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.nantian.cloud.jly.entity.CheckGaugesTypeReport" id="checkGaugesTypeReportMap">
        <result property="id" column="id"/>
        <result property="checkPlanId" column="check_plan_id"/>
        <result property="epc" column="epc"/>
        <result property="num" column="num"/>
        <result property="userid" column="userid"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>
        <result property="deptId" column="dept_id"/>
        <result property="item" column="item"/>
        <result property="name" column="name"/>
        <result property="inoutShouldMatch" column="inout_should_match"/>
        <result property="inoutRealMatch" column="inout_real_match"/>
        <result property="inoutRate" column="inout_rate"/>
        <result property="secondaryShouldMatch" column="secondary_should_match"/>
        <result property="secondaryRealMatch" column="secondary_real_match"/>
        <result property="secondaryRate" column="secondary_rate"/>
        <result property="mainShouldMatch" column="main_should_match"/>
        <result property="mainRealMatch" column="main_real_match"/>
        <result property="mainRate" column="main_rate"/>
        <result property="otherShouldMatch" column="other_should_match"/>
        <result property="otherRealMatch" column="other_real_match"/>
        <result property="otherRate" column="other_rate"/>
        <result property="inoutShouldGBRequire" column="inout_should_GBRequire"/>
        <result property="secondaryRateGBRequire" column="secondary_rate_GBRequire"/>
        <result property="mainRealGBRequire" column="main_real_GBRequire"/>
    </resultMap>


    <select id="getListPage" resultMap="checkGaugesTypeReportMap">
        SELECT
        *
        FROM
        check_gauges_type_report
        <trim prefix="where" prefixOverrides="and">
            <if test="query.checkPlanId != null">
                and check_plan_id = #{query.checkPlanId}
            </if>
            <if test="query.epc != null">
                and epc = #{query.epc}
            </if>
            <if test="query.name != null">
                and name = #{query.name}
            </if>
            <if test="query.item != null">
                and item = #{query.item}
            </if>
            <if test="query.delFlag != null">
                and del_flag = #{query.delFlag}
            </if>
            <if test="query.deptId != null">
                and dept_id = #{query.deptId}
            </if>
            <if test="query.userid != null">
                and userid = #{query.userid}
            </if>
        </trim>
        ORDER BY update_time DESC
    </select>
    <select id="selectByCheckPlanidAndEpc" resultType="com.nantian.cloud.jly.entity.CheckGaugesTypeReport">
        select * from check_gauges_type_report where check_plan_id = #{checkPlanId} and epc = #{enterpriseCode}
    </select>

    <select id="getInfoList" resultType="com.nantian.cloud.jly.entity.CheckGaugesTypeReport">
select * from check_gauges_type_report where epc = #{query.epc} and check_plan_id = #{query.checkPlanId} and del_flag = '1'

    </select>


</mapper>
