| New file | 
|  |  |  | 
|---|
|  |  |  | <?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.AreaCode2023Mapper"> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.AreaCode2023"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | <!--@Table area_code_2023--> | 
|---|
|  |  |  | <id column="code" jdbcType="BIGINT" property="code" /> | 
|---|
|  |  |  | <result column="name" jdbcType="VARCHAR" property="name" /> | 
|---|
|  |  |  | <result column="level" jdbcType="BOOLEAN" property="level" /> | 
|---|
|  |  |  | <result column="pcode" jdbcType="BIGINT" property="pcode" /> | 
|---|
|  |  |  | <result column="category" jdbcType="INTEGER" property="category" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | code, `name`, `level`, pcode, category | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List" /> | 
|---|
|  |  |  | from area_code_2023 | 
|---|
|  |  |  | where code = #{code,jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | delete from area_code_2023 | 
|---|
|  |  |  | where code = #{code,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.AreaCode2023"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into area_code_2023 (code, `name`, `level`, | 
|---|
|  |  |  | pcode, category) | 
|---|
|  |  |  | values (#{code,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=BOOLEAN}, | 
|---|
|  |  |  | #{pcode,jdbcType=BIGINT}, #{category,jdbcType=INTEGER}) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.AreaCode2023"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into area_code_2023 | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="code != null"> | 
|---|
|  |  |  | code, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="name != null"> | 
|---|
|  |  |  | `name`, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="level != null"> | 
|---|
|  |  |  | `level`, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="pcode != null"> | 
|---|
|  |  |  | pcode, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="category != null"> | 
|---|
|  |  |  | category, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="code != null"> | 
|---|
|  |  |  | #{code,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="name != null"> | 
|---|
|  |  |  | #{name,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="level != null"> | 
|---|
|  |  |  | #{level,jdbcType=BOOLEAN}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="pcode != null"> | 
|---|
|  |  |  | #{pcode,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="category != null"> | 
|---|
|  |  |  | #{category,jdbcType=INTEGER}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.AreaCode2023"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update area_code_2023 | 
|---|
|  |  |  | <set> | 
|---|
|  |  |  | <if test="name != null"> | 
|---|
|  |  |  | `name` = #{name,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="level != null"> | 
|---|
|  |  |  | `level` = #{level,jdbcType=BOOLEAN}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="pcode != null"> | 
|---|
|  |  |  | pcode = #{pcode,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="category != null"> | 
|---|
|  |  |  | category = #{category,jdbcType=INTEGER}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | where code = #{code,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.AreaCode2023"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update area_code_2023 | 
|---|
|  |  |  | set `name` = #{name,jdbcType=VARCHAR}, | 
|---|
|  |  |  | `level` = #{level,jdbcType=BOOLEAN}, | 
|---|
|  |  |  | pcode = #{pcode,jdbcType=BIGINT}, | 
|---|
|  |  |  | category = #{category,jdbcType=INTEGER} | 
|---|
|  |  |  | where code = #{code,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据区划代码查询指定级别行政区划--> | 
|---|
|  |  |  | <select id="getDistrictS" resultType="com.dy.pipIrrGlobal.voBa.VoDistrict"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | name, | 
|---|
|  |  |  | CASE | 
|---|
|  |  |  | WHEN level = 4 THEN SUBSTRING(code,7,3) | 
|---|
|  |  |  | WHEN level = 5 THEN SUBSTRING(code,10,3) | 
|---|
|  |  |  | END AS code, | 
|---|
|  |  |  | level | 
|---|
|  |  |  | FROM area_code_2023 | 
|---|
|  |  |  | WHERE code LIKE CONCAT('%', #{aredCode}, '%') AND level = #{level} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|