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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.nantian.cloud.jly.entity.CheckGauges">
        <id column="id" property="id" />
        <result column="check_plan_id" property="checkPlanId" />
        <result column="epc" property="epc" />
        <result column="num" property="num" />
        <result column="gauge_name" property="gaugeName" />
        <result column="gauge_type" property="gaugeType" />
        <result column="accuracy_levels" property="accuracyLevels" />
        <result column="test_region" property="testRegion" />
        <result column="product_factory" property="productFactory" />
        <result column="num_factrory" property="numFactrory" />
        <result column="energy_name" property="energyName" />
        <result column="table_type" property="tableType" />
        <result column="gauge_class" property="gaugeClass" />
        <result column="energy_class" property="energyClass" />
        <result column="manager_num" property="managerNum" />
        <result column="location" property="location" />
        <result column="check_time" property="checkTime" />
        <result column="gauge_status" property="gaugeStatus" />
        <result column="userid" property="userid" />
        <result column="update_time" property="updateTime" />
        <result column="del_flag" property="delFlag" />
        <result column="dept_id" property="deptId" />
    </resultMap>


    <select id="getListPage" resultMap="BaseResultMap">
		SELECT
			*
		FROM
		check_gauges
        <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.gaugeName != null">
                and gauge_name = #{query.gaugeName}
            </if>
            <if test="query.gaugeType != null">
                and gauge_type = #{query.gaugeType}
            </if>
            <if test="query.tableType != null">
                and table_type = #{query.tableType}
            </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 num
	</select>

</mapper>
