pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDivideMapper.xml
@@ -6,10 +6,10 @@
    <!--@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="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" />
@@ -23,6 +23,13 @@
    <!--@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-->
@@ -31,20 +38,78 @@
    from ba_divide
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  <select id="selectAll" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    delete from ba_divide
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDivide">
    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`,
      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},
    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})
@@ -59,16 +124,16 @@
      <if test="name != null">
        `name`,
      </if>
      <if test="countyid != null">
      <if test="countyId != null">
        countyId,
      </if>
      <if test="townid != null">
      <if test="townId != null">
        townId,
      </if>
      <if test="villageid != null">
      <if test="villageId != null">
        villageId,
      </if>
      <if test="blockid != null">
      <if test="blockId != null">
        blockId,
      </if>
      <if test="villages != null">
@@ -103,17 +168,17 @@
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="countyid != null">
        #{countyid,jdbcType=BIGINT},
      <if test="countyId != null">
        #{countyId,jdbcType=BIGINT},
      </if>
      <if test="townid != null">
        #{townid,jdbcType=BIGINT},
      <if test="townId != null">
        #{townId,jdbcType=BIGINT},
      </if>
      <if test="villageid != null">
        #{villageid,jdbcType=BIGINT},
      <if test="villageId != null">
        #{villageId,jdbcType=BIGINT},
      </if>
      <if test="blockid != null">
        #{blockid,jdbcType=BIGINT},
      <if test="blockId != null">
        #{blockId,jdbcType=BIGINT},
      </if>
      <if test="villages != null">
        #{villages,jdbcType=VARCHAR},
@@ -148,17 +213,17 @@
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="countyid != null">
        countyId = #{countyid,jdbcType=BIGINT},
      <if test="countyId != null">
        countyId = #{countyId,jdbcType=BIGINT},
      </if>
      <if test="townid != null">
        townId = #{townid,jdbcType=BIGINT},
      <if test="townId != null">
        townId = #{townId,jdbcType=BIGINT},
      </if>
      <if test="villageid != null">
        villageId = #{villageid,jdbcType=BIGINT},
      <if test="villageId != null">
        villageId = #{villageId,jdbcType=BIGINT},
      </if>
      <if test="blockid != null">
        blockId = #{blockid,jdbcType=BIGINT},
      <if test="blockId != null">
        blockId = #{blockId,jdbcType=BIGINT},
      </if>
      <if test="villages != null">
        villages = #{villages,jdbcType=VARCHAR},
@@ -191,10 +256,10 @@
    <!--@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},
      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},
@@ -205,4 +270,14 @@
      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>