<?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.diagbot.bigdata.dao.mapper.ResultMappingVitalMapper">
    <!-- 映射定义列-->
    <resultMap type="org.diagbot.bigdata.dao.model.ResultMappingVital" id="resultMappingVitalMap">
        <id property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="nameMapping" column="name_mapping"/>
    </resultMap>

    <!-- 映射定义列-->
    <resultMap type="org.diagbot.bigdata.dao.model.wrapper.ResultMappingVitalWrapper" id="resultMappingVitalWrapperMap">
        <id property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="nameMapping" column="name_mapping"/>
    </resultMap>

    <!-- 通用查询结果列-->
    <sql id="Base_Column_List">
		 t.id,	 t.name,	 t.name_mapping
	</sql>

    <!-- 查询（根据主键ID查询） -->
    <select id="selectByPrimaryKey" resultMap="resultMappingVitalMap" parameterType="java.lang.Integer">
        SELECT
        <include refid="Base_Column_List"/>
        FROM doc_result_mapping_vital t
        WHERE t.id = #{id}
    </select>

    <!-- 查询（根据主键ID查询） -->
    <select id="selectWrapperByPrimaryKey" resultMap="resultMappingVitalWrapperMap" parameterType="java.lang.Integer">
        SELECT
        <include refid="Base_Column_List"/>
        FROM doc_result_mapping_vital t
        WHERE t.id = #{id}
    </select>

    <!-- 依据Map查询条件返回结果集-->
    <select id="selectList" resultMap="resultMappingVitalMap" parameterType="java.util.Map">
        SELECT
        <include refid="Base_Column_List"/>
        FROM doc_result_mapping_vital t WHERE 1=1
        <if test="id != null and id != ''">
            and t.id = #{id}
        </if>
        <if test="name != null and name != ''">
            and t.name = #{name}
        </if>
        <if test="nameMapping != null and nameMapping != ''">
            and t.name_mapping = #{nameMapping}
        </if>
    </select>

    <!-- 依据Map查询条件返回扩展属性结果集-->
    <select id="selectListWrapper" resultMap="resultMappingVitalWrapperMap" parameterType="java.util.Map">
        SELECT
        <include refid="Base_Column_List"/>
        FROM doc_result_mapping_vital t WHERE 1=1
        <if test="id != null and id != ''">
            and t.id = #{id}
        </if>
        <if test="name != null and name != ''">
            and t.name = #{name}
        </if>
        <if test="nameMapping != null and nameMapping != ''">
            and t.name_mapping = #{nameMapping}
        </if>
    </select>

    <!--删除：根据主键ID删除-->
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
		 DELETE FROM doc_result_mapping_vital
		 WHERE id = #{id}
	</delete>
</mapper>