zhubaomin
2025-04-11 a1744d0bf7f0ad8ac861d672cffd7c710dac4e7e
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupIntakeMapper.xml
New file
@@ -0,0 +1,93 @@
<?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.daoIr.IrGroupIntakeMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake">
    <!--@mbg.generated-->
    <!--@Table ir_group_intake-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="group_id" jdbcType="BIGINT" property="groupId" />
    <result column="intake_id" jdbcType="BIGINT" property="intakeId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, group_id, intake_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from ir_group_intake
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ir_group_intake
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake">
    <!--@mbg.generated-->
    insert into ir_group_intake (id, group_id, intake_id
      )
    values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake">
    <!--@mbg.generated-->
    insert into ir_group_intake
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="groupId != null">
        group_id,
      </if>
      <if test="intakeId != null">
        intake_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="groupId != null">
        #{groupId,jdbcType=BIGINT},
      </if>
      <if test="intakeId != null">
        #{intakeId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake">
    <!--@mbg.generated-->
    update ir_group_intake
    <set>
      <if test="groupId != null">
        group_id = #{groupId,jdbcType=BIGINT},
      </if>
      <if test="intakeId != null">
        intake_id = #{intakeId,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake">
    <!--@mbg.generated-->
    update ir_group_intake
    set group_id = #{groupId,jdbcType=BIGINT},
      intake_id = #{intakeId,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据组ID获取取水口ID集合-->
  <select id="getIntakeIdsByGroupId" resultType="java.lang.Long">
    SELECT
      intake_id AS intakeId
    FROM ir_group_intake
    WHERE group_id = #{groupId}
  </select>
  <!--根据组ID删除取水口关联-->
  <delete id="deleteByGroupId">
    DELETE FROM ir_group_intake WHERE group_id = #{groupId}
  </delete>
</mapper>