liurunyu
2025-08-21 5715d16c6fc4842191c802adb2e3b94d19f44f17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?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.dy.pipIrrGlobal.daoMd.MdEt0Mapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    <!--@Table md_et0-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="crop_id" jdbcType="BIGINT" property="cropId" />
    <result column="weather_id" jdbcType="BIGINT" property="weatherId" />
    <result column="factor" jdbcType="DOUBLE" property="factor" />
    <result column="max_tmp" jdbcType="DOUBLE" property="maxTmp" />
    <result column="min_tmp" jdbcType="DOUBLE" property="minTmp" />
    <result column="dt" jdbcType="DATE" property="dt" />
    <result column="et0" jdbcType="DOUBLE" property="et0" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, crop_id, weather_id, factor, max_tmp, min_tmp, dt, et0
  </sql>
  <sql id="Base_Column_List_with_alias">
    <!--@mbg.generated-->
    ${alias}.id, ${alias}.crop_id, ${alias}.weather_id,
    ${alias}.factor, ${alias}.max_tmp, ${alias}.min_tmp,
    ${alias}.dt, ${alias}.et0
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from md_et0
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectByCropWeatherDt" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from md_et0
    where crop_id = #{cropId,jdbcType=BIGINT}
    and weather_id = #{weatherId,jdbcType=BIGINT}
    and dt = #{dt,jdbcType=DATE}
  </select>
 
  <select id="selectEt0ByDt" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List_with_alias" >
      <property name="alias" value="et"/>
    </include>,
    mc.name as cropName
    from md_et0 et
    inner join md_crops mc on et.crop_id = mc.id
    where mc.stopped != 1 and et.dt = #{ymd,jdbcType=DATE}
  </select>
  <!--根据指定条件查询记录-->
  <select id="selectEt0ByCropAndDt" resultType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    SELECT
    <include refid="Base_Column_List_with_alias" >
      <property name="alias" value="et"/>
    </include>,
    mc.name as cropName
    from md_et0 et
    inner join md_crops mc on et.crop_id = mc.id
    <where>
      <if test="cropId != null">
        AND et.crop_id = #{cropId}
      </if>
      <if test = "timeStart != null and timeStart !='' and timeStop != null and timeStop != ''">
        AND et.dt BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
    ORDER BY et.id ASC
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from md_et0
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    insert into md_et0 (id, crop_id, weather_id, 
      factor, max_tmp, min_tmp, 
      dt, et0)
    values (#{id,jdbcType=BIGINT}, #{cropId,jdbcType=BIGINT}, #{weatherId,jdbcType=BIGINT}, 
      #{factor,jdbcType=DOUBLE}, #{maxTmp,jdbcType=DOUBLE}, #{minTmp,jdbcType=DOUBLE}, 
      #{dt,jdbcType=DATE}, #{et0,jdbcType=DOUBLE})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    insert into md_et0
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="cropId != null">
        crop_id,
      </if>
      <if test="weatherId != null">
        weather_id,
      </if>
      <if test="factor != null">
        factor,
      </if>
      <if test="maxTmp != null">
        max_tmp,
      </if>
      <if test="minTmp != null">
        min_tmp,
      </if>
      <if test="dt != null">
        dt,
      </if>
      <if test="et0 != null">
        et0,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="cropId != null">
        #{cropId,jdbcType=BIGINT},
      </if>
      <if test="weatherId != null">
        #{weatherId,jdbcType=BIGINT},
      </if>
      <if test="factor != null">
        #{factor,jdbcType=DOUBLE},
      </if>
      <if test="maxTmp != null">
        #{maxTmp,jdbcType=DOUBLE},
      </if>
      <if test="minTmp != null">
        #{minTmp,jdbcType=DOUBLE},
      </if>
      <if test="dt != null">
        #{dt,jdbcType=DATE},
      </if>
      <if test="et0 != null">
        #{et0,jdbcType=DOUBLE},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    update md_et0
    <set>
      <if test="cropId != null">
        crop_id = #{cropId,jdbcType=BIGINT},
      </if>
      <if test="weatherId != null">
        weather_id = #{weatherId,jdbcType=BIGINT},
      </if>
      <if test="factor != null">
        factor = #{factor,jdbcType=DOUBLE},
      </if>
      <if test="maxTmp != null">
        max_tmp = #{maxTmp,jdbcType=DOUBLE},
      </if>
      <if test="minTmp != null">
        min_tmp = #{minTmp,jdbcType=DOUBLE},
      </if>
      <if test="dt != null">
        dt = #{dt,jdbcType=DATE},
      </if>
      <if test="et0 != null">
        et0 = #{et0,jdbcType=DOUBLE},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    update md_et0
    set crop_id = #{cropId,jdbcType=BIGINT},
      weather_id = #{weatherId,jdbcType=BIGINT},
      factor = #{factor,jdbcType=DOUBLE},
      max_tmp = #{maxTmp,jdbcType=DOUBLE},
      min_tmp = #{minTmp,jdbcType=DOUBLE},
      dt = #{dt,jdbcType=DATE},
      et0 = #{et0,jdbcType=DOUBLE}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>