<?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.ruoyi.system.mapper_shate.VegetationHealthMapper">
    <resultMap id="RM_Seeding" type="com.ruoyi.system.domain_shate.VegetationHealth">

        <result property="id" column="id"/>
        <result property="zone" column="zone"/>
        <result property="healthy" column="healthy"/>
        <result property="normal" column="Normal"/>
        <result property="notHealthy" column="Not_Healthy"/>
        <result property="totalArea" column="Total_Area"/>
        <result property="imageDate" column="image_date"/>
        <result property="resolution" column="resolution"/>
        <result property="productCode1" column="Product_code1"/>
        <result property="productCode2" column="Product_code2"/>
        <result property="productCode3" column="Product_code3"/>
        <result property="createdBy" column="created_by"/>
        <result property="year" column="year1"/>
        <result property="craeteTime" column="created_time"/>

    </resultMap>

    <insert id="insertSeeding">
        <![CDATA[
        INSERT INTO healthy (
            zone ,
            healthy,
            normal ,
            Not_Healthy ,
            Total_Area,
            image_date ,
            resolution,
            Product_code1 ,
            Product_code2,
            Product_code3,
            year1,
            created_by
        ) VALUES (
                     #{zone,jdbcType=VARCHAR},
                     #{healthy,jdbcType=DOUBLE},
                     #{normal,jdbcType=DOUBLE},
                     #{notHealthy,jdbcType=DOUBLE},
                     #{totalArea,jdbcType=DOUBLE},
                     #{imageDate,jdbcType=VARCHAR},
                     #{resolution,jdbcType=VARCHAR},
                     #{productCode1,jdbcType=VARCHAR},
                     #{productCode2,jdbcType=VARCHAR},
                     #{productCode3,jdbcType=VARCHAR},
                     #{year,jdbcType=VARCHAR},
                     #{createdBy,jdbcType=VARCHAR}
                 )
        ]]>
        </insert>

    <sql id="columns">
	    <![CDATA[
        ID,zone,healthy,resolution,year1,Normal,Not_Healthy,Total_Area,Image_date,Product_code1,Product_code2,Product_code3,created_by,created_time
        ]]>
	</sql>

    <select id="sqlSeeding" resultMap="RM_Seeding">
        SELECT  <include refid="columns"/>  FROM  healthy
        WHERE 1=1
        <if test="zone!= null and zone !=''">
            AND zone = #{zone}
        </if>
        <if test="name!= null and name !=''">
            AND product_code1 like #{name}
        </if>
        <if test="year!= null and year !=''">
            AND year1=#{year}
        </if>

    </select>
    <select id="sqlYear" resultMap="RM_Seeding">
        SELECT  distinct year1,ZONE  FROM  healthy
    </select>
    <select id="sqlInfo" resultMap="RM_Seeding">
        select * from healthy
        where 1=1
        <if test="zone!= null and zone !=''">
            AND zone = #{zone}
        </if>
        <if test="year!= null and year !=''">
            AND year1=#{year}
        </if>
    </select>


</mapper>