郑永安
2023-06-19 2fcd97552d16718cc7997629fd637a73a5a4483f
src/main/java/com/gk/firework/Mapper/mybatis/DistrictInfoMapper.xml
对比新文件
@@ -0,0 +1,80 @@
<?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.gk.firework.Mapper.DistrictInfoMapper" >
  <resultMap id="BaseResultMap" type="com.gk.firework.Domain.DistrictInfo" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="code" property="code" jdbcType="VARCHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="parentcode" property="parentcode" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="TINYINT" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, code, name, parentcode, type
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    <!--          -->
    select
    <include refid="Base_Column_List" />
    from district
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectDistrictInfo" resultType="com.gk.firework.Domain.DistrictInfo">
    select
    <include refid="Base_Column_List" />
    from district
    where type = #{type}
    and parentcode = #{parentcode}
  </select>
  <select id="selectDistrictByName" resultType="com.gk.firework.Domain.DistrictInfo">
    SELECT
   district.*
    FROM
   district
    WHERE
   district.type = #{type}
    AND district.parentcode IN (
   SELECT
      `code`
   FROM
      district
   WHERE
   type = #{parenttype}
   and   district.NAME = #{parentname}
    )
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    <!--          -->
    delete from district
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <update id="updateByPrimaryKeySelective" parameterType="com.gk.firework.Domain.DistrictInfo" >
    <!--          -->
    update district
    <set >
      <if test="code != null" >
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="parentcode != null" >
        parentcode = #{parentcode,jdbcType=VARCHAR},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gk.firework.Domain.DistrictInfo" >
    <!--          -->
    update district
    set code = #{code,jdbcType=VARCHAR},
      name = #{name,jdbcType=VARCHAR},
      parentcode = #{parentcode,jdbcType=VARCHAR},
      type = #{type,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>