zhubaomin
2025-04-11 a1744d0bf7f0ad8ac861d672cffd7c710dac4e7e
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDivideMapper.xml
New file
@@ -0,0 +1,283 @@
<?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.daoBa.BaDivideMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaDivide">
    <!--@mbg.generated-->
    <!--@Table ba_divide-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="countyId" jdbcType="BIGINT" property="countyId" />
    <result column="townId" jdbcType="BIGINT" property="townId" />
    <result column="villageId" jdbcType="BIGINT" property="villageId" />
    <result column="blockId" jdbcType="BIGINT" property="blockId" />
    <result column="villages" jdbcType="VARCHAR" property="villages" />
    <result column="area" jdbcType="FLOAT" property="area" />
    <result column="header" jdbcType="VARCHAR" property="header" />
    <result column="phone" jdbcType="VARCHAR" property="phone" />
    <result column="lng" jdbcType="DOUBLE" property="lng" />
    <result column="lat" jdbcType="DOUBLE" property="lat" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, `name`, countyId, townId, villageId, blockId, villages, area, `header`, phone,
    lng, lat, remark, deleted
  </sql>  <sql id="Base2_Column_List">
    <!--@mbg.generated-->
  ${alias}.id, ${alias}.name, ${alias}.countyId, ${alias}.townId, ${alias}.villageId, ${alias}.blockId, ${alias}.villages, ${alias}.area, ${alias}.header, ${alias}.phone, ${alias}.lng, ${alias}.lat, ${alias}.remark
  </sql>
  <sql id="part_Column_List">
    <!--@mbg.generated-->
    id, `name`
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from ba_divide
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectAll" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="part_Column_List"/>
    from ba_divide
  </select>
  <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long">
    <!--@mbg.generated-->
    select
    count(*)
    from ba_divide bd
    left join ba_block bbk on bd.blockId = bbk.id
    where bd.deleted != 1
    <trim prefix="and" suffixOverrides="and">
      <if test="name != null and name != ''">
        bd.name like concat('%', #{name}, '%') and
      </if>
      <if test="header != null and header != ''">
        bd.header = '#{header,jdbcType=VARCHAR}' and
      </if>
      <if test="phone != null and phone != ''">
        bd.phone = '#{phone,jdbcType=VARCHAR}' and
      </if>
      <if test="blockName != null">
        bbk.name like concat('%', #{blockName}, '%') and
      </if>
    </trim>
  </select>
  <select id="selectSome" parameterType="java.util.Map" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base2_Column_List" >
      <property name="alias" value="bd"/>
    </include>,
    bbk.name blockName,
    bdtt.name townName,
    bdtv.name villageName
    from ba_divide bd
    left join ba_block bbk on bd.blockId = bbk.id
    left join ba_district bdtt on bd.townId=bdtt.id
    left join ba_district bdtv on bd.villageId=bdtv.id
    where bd.deleted != 1
    <trim prefix="and" suffixOverrides="and">
      <if test="name != null and name != ''">
        bd.name like concat('%', #{name}, '%') and
      </if>
      <if test="header != null and header != ''">
        bd.header = '#{header,jdbcType=VARCHAR}' and
      </if>
      <if test="phone != null and phone != ''">
        bd.phone = '#{phone,jdbcType=VARCHAR}' and
      </if>
      <if test="blockName != null">
        bbk.name like concat('%', #{blockName}, '%') and
      </if>
    </trim>
    order by bd.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>
  <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDivide">
    <!--@mbg.generated-->
    insert into ba_divide (id, `name`, countyId,
      townId, villageId, blockId,
      villages, area, header,
      phone, lng, lat, remark,
      deleted)
    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{countyId,jdbcType=BIGINT},
      #{townId,jdbcType=BIGINT}, #{villageId,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT},
      #{villages,jdbcType=VARCHAR}, #{area,jdbcType=FLOAT}, #{header,jdbcType=VARCHAR},
      #{phone,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{remark,jdbcType=VARCHAR},
      #{deleted,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDivide">
    <!--@mbg.generated-->
    insert into ba_divide
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="countyId != null">
        countyId,
      </if>
      <if test="townId != null">
        townId,
      </if>
      <if test="villageId != null">
        villageId,
      </if>
      <if test="blockId != null">
        blockId,
      </if>
      <if test="villages != null">
        villages,
      </if>
      <if test="area != null">
        area,
      </if>
      <if test="header != null">
        `header`,
      </if>
      <if test="phone != null">
        phone,
      </if>
      <if test="lng != null">
        lng,
      </if>
      <if test="lat != null">
        lat,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="countyId != null">
        #{countyId,jdbcType=BIGINT},
      </if>
      <if test="townId != null">
        #{townId,jdbcType=BIGINT},
      </if>
      <if test="villageId != null">
        #{villageId,jdbcType=BIGINT},
      </if>
      <if test="blockId != null">
        #{blockId,jdbcType=BIGINT},
      </if>
      <if test="villages != null">
        #{villages,jdbcType=VARCHAR},
      </if>
      <if test="area != null">
        #{area,jdbcType=FLOAT},
      </if>
      <if test="header != null">
        #{header,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="lng != null">
        #{lng,jdbcType=DOUBLE},
      </if>
      <if test="lat != null">
        #{lat,jdbcType=DOUBLE},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDivide">
    <!--@mbg.generated-->
    update ba_divide
    <set>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="countyId != null">
        countyId = #{countyId,jdbcType=BIGINT},
      </if>
      <if test="townId != null">
        townId = #{townId,jdbcType=BIGINT},
      </if>
      <if test="villageId != null">
        villageId = #{villageId,jdbcType=BIGINT},
      </if>
      <if test="blockId != null">
        blockId = #{blockId,jdbcType=BIGINT},
      </if>
      <if test="villages != null">
        villages = #{villages,jdbcType=VARCHAR},
      </if>
      <if test="area != null">
        area = #{area,jdbcType=FLOAT},
      </if>
      <if test="header != null">
        `header` = #{header,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="lng != null">
        lng = #{lng,jdbcType=DOUBLE},
      </if>
      <if test="lat != null">
        lat = #{lat,jdbcType=DOUBLE},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDivide">
    <!--@mbg.generated-->
    update ba_divide
    set `name` = #{name,jdbcType=VARCHAR},
      countyId = #{countyId,jdbcType=BIGINT},
      townId = #{townId,jdbcType=BIGINT},
      villageId = #{villageId,jdbcType=BIGINT},
      blockId = #{blockId,jdbcType=BIGINT},
      villages = #{villages,jdbcType=VARCHAR},
      area = #{area,jdbcType=FLOAT},
      `header` = #{header,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      lng = #{lng,jdbcType=DOUBLE},
      lat = #{lat,jdbcType=DOUBLE},
      remark = #{remark,jdbcType=VARCHAR},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ba_divide
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteLogicById" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    update ba_divide set deleted = 1
    where id = #{id,jdbcType=BIGINT}
  </delete>
</mapper>