zuoxiao
2025-06-25 d2fc819dc069c7b8d338ae52a90a7f38704fac08
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmManureLastMapper.xml
New file
@@ -0,0 +1,300 @@
<?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.daoRm.RmManureLastMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmManureLast">
    <!--@mbg.generated-->
    <!--@Table rm_manure_last-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="last_history_id" jdbcType="BIGINT" property="lastHistoryId" />
    <result column="manure_id" jdbcType="BIGINT" property="manureId" />
    <result column="dt" jdbcType="TIMESTAMP" property="dt" />
    <result column="stir_running1" jdbcType="TINYINT" property="stirRunning1" />
    <result column="stir_running2" jdbcType="TINYINT" property="stirRunning2" />
    <result column="stir_running3" jdbcType="TINYINT" property="stirRunning3" />
    <result column="stir_running4" jdbcType="TINYINT" property="stirRunning4" />
    <result column="inject_running" jdbcType="TINYINT" property="injectRunning" />
    <result column="irr_running" jdbcType="TINYINT" property="irrRunning" />
    <result column="alarm" jdbcType="TINYINT" property="alarm" />
    <result column="manure_flow" jdbcType="FLOAT" property="manureFlow" />
    <result column="manure_time" jdbcType="INTEGER" property="manureTime" />
    <result column="stir_time" jdbcType="INTEGER" property="stirTime" />
    <result column="stir_duration" jdbcType="INTEGER" property="stirDuration" />
    <result column="inject_duration" jdbcType="INTEGER" property="injectDuration" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, last_history_id, manure_id, dt, stir_running1, stir_running2, stir_running3,
    stir_running4, inject_running, irr_running, alarm, manure_flow, manure_time, stir_time,
    stir_duration, inject_duration
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from rm_manure_last
    where id = #{id,jdbcType=BIGINT}
  </select>
  <!--根据指定条件获取记录-->
  <select id="selectRmManureLast" resultType="com.dy.pipIrrGlobal.pojoRm.RmManureLast">
    select
    <include refid="Base_Column_List" />
    from rm_manure_last
    <where>
      <if test="stManureId != null and stManureId != ''">
        and manure_id = #{stManureId}
      </if>
    </where>
    limit 0,1
  </select>
  <!--根据指定条件查询历史记录数量-->
  <select id="selectCount" resultType="java.lang.Long">
    SELECT
    COUNT(*) AS recordCount
    FROM rm_manure_last ltb
    INNER JOIN pr_st_manure mtb ON mtb.id = ltb.manure_id
    <where>
      <if test="manureId != null">
        AND ltb.manure_id = #{manureId}
      </if>
      <if test = "no != null">
        AND mtb.no = #{no}
      </if>
      <if test = "name != null and name !=''">
        AND mtb.name LIKE CONCAT('%',#{intakeNum},'%')
      </if>
      <if test = "timeStart != null and timeStop != null">
        AND ltb.dt BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
  </select>
  <!--根据指定条件查询历史记录-->
  <select id="selectSome" resultType="com.dy.pipIrrGlobal.voRm.VoManure">
    SELECT
    <include refid="Base_Column_List" />,
    mtb.`name` AS manureName
    FROM rm_manure_last ltb
    INNER JOIN pr_st_manure mtb ON mtb.id = ltb.manure_id
    <where>
      <if test="manureId != null">
        AND ltb.manure_id = #{manureId}
      </if>
      <if test = "no != null">
        AND mtb.no = #{no}
      </if>
      <if test = "name != null and name !=''">
        AND mtb.name LIKE CONCAT('%',#{intakeNum},'%')
      </if>
      <if test = "timeStart != null and timeStop != null">
        AND ltb.dt BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
    ORDER BY ltb.manure_id DESC
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from rm_manure_last
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmManureLast">
    <!--@mbg.generated-->
    insert into rm_manure_last (id, last_history_id, manure_id,
      dt, stir_running1, stir_running2,
      stir_running3, stir_running4, inject_running,
      irr_running, alarm, manure_flow,
      manure_time, stir_time, stir_duration,
      inject_duration)
    values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, #{manureId,jdbcType=BIGINT},
      #{dt,jdbcType=TIMESTAMP}, #{stirRunning1,jdbcType=TINYINT}, #{stirRunning2,jdbcType=TINYINT},
      #{stirRunning3,jdbcType=TINYINT}, #{stirRunning4,jdbcType=TINYINT}, #{injectRunning,jdbcType=TINYINT},
      #{irrRunning,jdbcType=TINYINT}, #{alarm,jdbcType=TINYINT}, #{manureFlow,jdbcType=FLOAT},
      #{manureTime,jdbcType=INTEGER}, #{stirTime,jdbcType=INTEGER}, #{stirDuration,jdbcType=INTEGER},
      #{injectDuration,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmManureLast">
    <!--@mbg.generated-->
    insert into rm_manure_last
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="lastHistoryId != null">
        last_history_id,
      </if>
      <if test="manureId != null">
        manure_id,
      </if>
      <if test="dt != null">
        dt,
      </if>
      <if test="stirRunning1 != null">
        stir_running1,
      </if>
      <if test="stirRunning2 != null">
        stir_running2,
      </if>
      <if test="stirRunning3 != null">
        stir_running3,
      </if>
      <if test="stirRunning4 != null">
        stir_running4,
      </if>
      <if test="injectRunning != null">
        inject_running,
      </if>
      <if test="irrRunning != null">
        irr_running,
      </if>
      <if test="alarm != null">
        alarm,
      </if>
      <if test="manureFlow != null">
        manure_flow,
      </if>
      <if test="manureTime != null">
        manure_time,
      </if>
      <if test="stirTime != null">
        stir_time,
      </if>
      <if test="stirDuration != null">
        stir_duration,
      </if>
      <if test="injectDuration != null">
        inject_duration,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="lastHistoryId != null">
        #{lastHistoryId,jdbcType=BIGINT},
      </if>
      <if test="manureId != null">
        #{manureId,jdbcType=BIGINT},
      </if>
      <if test="dt != null">
        #{dt,jdbcType=TIMESTAMP},
      </if>
      <if test="stirRunning1 != null">
        #{stirRunning1,jdbcType=TINYINT},
      </if>
      <if test="stirRunning2 != null">
        #{stirRunning2,jdbcType=TINYINT},
      </if>
      <if test="stirRunning3 != null">
        #{stirRunning3,jdbcType=TINYINT},
      </if>
      <if test="stirRunning4 != null">
        #{stirRunning4,jdbcType=TINYINT},
      </if>
      <if test="injectRunning != null">
        #{injectRunning,jdbcType=TINYINT},
      </if>
      <if test="irrRunning != null">
        #{irrRunning,jdbcType=TINYINT},
      </if>
      <if test="alarm != null">
        #{alarm,jdbcType=TINYINT},
      </if>
      <if test="manureFlow != null">
        #{manureFlow,jdbcType=FLOAT},
      </if>
      <if test="manureTime != null">
        #{manureTime,jdbcType=INTEGER},
      </if>
      <if test="stirTime != null">
        #{stirTime,jdbcType=INTEGER},
      </if>
      <if test="stirDuration != null">
        #{stirDuration,jdbcType=INTEGER},
      </if>
      <if test="injectDuration != null">
        #{injectDuration,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmManureLast">
    <!--@mbg.generated-->
    update rm_manure_last
    <set>
      <if test="lastHistoryId != null">
        last_history_id = #{lastHistoryId,jdbcType=BIGINT},
      </if>
      <if test="manureId != null">
        manure_id = #{manureId,jdbcType=BIGINT},
      </if>
      <if test="dt != null">
        dt = #{dt,jdbcType=TIMESTAMP},
      </if>
      <if test="stirRunning1 != null">
        stir_running1 = #{stirRunning1,jdbcType=TINYINT},
      </if>
      <if test="stirRunning2 != null">
        stir_running2 = #{stirRunning2,jdbcType=TINYINT},
      </if>
      <if test="stirRunning3 != null">
        stir_running3 = #{stirRunning3,jdbcType=TINYINT},
      </if>
      <if test="stirRunning4 != null">
        stir_running4 = #{stirRunning4,jdbcType=TINYINT},
      </if>
      <if test="injectRunning != null">
        inject_running = #{injectRunning,jdbcType=TINYINT},
      </if>
      <if test="irrRunning != null">
        irr_running = #{irrRunning,jdbcType=TINYINT},
      </if>
      <if test="alarm != null">
        alarm = #{alarm,jdbcType=TINYINT},
      </if>
      <if test="manureFlow != null">
        manure_flow = #{manureFlow,jdbcType=FLOAT},
      </if>
      <if test="manureTime != null">
        manure_time = #{manureTime,jdbcType=INTEGER},
      </if>
      <if test="stirTime != null">
        stir_time = #{stirTime,jdbcType=INTEGER},
      </if>
      <if test="stirDuration != null">
        stir_duration = #{stirDuration,jdbcType=INTEGER},
      </if>
      <if test="injectDuration != null">
        inject_duration = #{injectDuration,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmManureLast">
    <!--@mbg.generated-->
    update rm_manure_last
    set last_history_id = #{lastHistoryId,jdbcType=BIGINT},
      manure_id = #{manureId,jdbcType=BIGINT},
      dt = #{dt,jdbcType=TIMESTAMP},
      stir_running1 = #{stirRunning1,jdbcType=TINYINT},
      stir_running2 = #{stirRunning2,jdbcType=TINYINT},
      stir_running3 = #{stirRunning3,jdbcType=TINYINT},
      stir_running4 = #{stirRunning4,jdbcType=TINYINT},
      inject_running = #{injectRunning,jdbcType=TINYINT},
      irr_running = #{irrRunning,jdbcType=TINYINT},
      alarm = #{alarm,jdbcType=TINYINT},
      manure_flow = #{manureFlow,jdbcType=FLOAT},
      manure_time = #{manureTime,jdbcType=INTEGER},
      stir_time = #{stirTime,jdbcType=INTEGER},
      stir_duration = #{stirDuration,jdbcType=INTEGER},
      inject_duration = #{injectDuration,jdbcType=INTEGER}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>