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

        <result property="id" column="id"/>
        <result property="zone" column="zone"/>
        <result property="verySuitable" column="very_suitable"/>
        <result property="suitable" column="Suitable"/>
        <result property="notSuitable" column="Not_Suitable"/>
        <result property="totalArea" column="Total_Area"/>
        <result property="imageDate" column="Image_date"/>
        <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"/>

    </resultMap>

    <sql id="columns">
	    <![CDATA[
        ID,zone,very_suitable,year1,Suitable,Not_Suitable,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  suitability
        WHERE 1=1
        <if test="zone!= null and zone !=''">
            AND zone = #{zone}
        </if>
    </select>

    <select id="sqlYear" resultMap="RM_Seeding">
        SELECT  distinct year1,ZONE  FROM  suitability
    </select>

    <insert id="InsertSeeding">
        <![CDATA[
        INSERT INTO suitability (
            zone ,
            very_suitable,
            Suitable ,
            Not_Suitable ,
            Total_Area,
            Image_date ,
            Product_code1 ,
            Product_code2,
            Product_code3,
            year1,
            created_by
        ) VALUES (
                     #{zone,jdbcType=VARCHAR},
                     #{verySuitable,jdbcType=DOUBLE},
                     #{suitable,jdbcType=DOUBLE},
                     #{notSuitable,jdbcType=DOUBLE},
                     #{totalArea,jdbcType=DOUBLE},
                     #{imageDate,jdbcType=VARCHAR},
                     #{productCode1,jdbcType=VARCHAR},
                     #{productCode2,jdbcType=VARCHAR},
                     #{productCode3,jdbcType=VARCHAR},
                     #{year,jdbcType=VARCHAR},
                     #{createdBy,jdbcType=VARCHAR}
                 )
        ]]>
    </insert>
</mapper>