Files
smart_storage_java/file-center/src/main/resources/mapper/CityMapper.xml
2025-06-30 10:11:32 +08:00

135 lines
5.6 KiB
XML

<?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.ho.filecenter.mapper.CityMapper">
<sql id="Base_Column_List">
id,cityEn,cityZh,
provinceEn,provinceZh,countryEn,
countryZh,leaderEn,leaderZh,
lat,lon
</sql>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from city
where id = #{id,jdbcType=VARCHAR}
</delete>
<select id="selectByPrimaryKey" resultType="com.ho.filecenter.entity.City">
select
<include refid="Base_Column_List" />
from city
where id = #{id,jdbcType=VARCHAR}
</select>
<select id="selectByProvinceAndCity" resultType="com.ho.filecenter.entity.City">
select
<include refid="Base_Column_List" />
from city
<where>
<if test="cityzh != null">
and cityZh = #{cityzh}
</if>
<if test="provincezh != null">
and provinceZh= #{provincezh}
</if>
</where>
</select>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ho.filecenter.entity.City" useGeneratedKeys="true">
insert into city
( id,cityEn,cityZh
,provinceEn,provinceZh,countryEn
,countryZh,leaderEn,leaderZh
,lat,lon)
values (#{id,jdbcType=VARCHAR},#{cityen,jdbcType=VARCHAR},#{cityzh,jdbcType=VARCHAR}
,#{provinceen,jdbcType=VARCHAR},#{provincezh,jdbcType=VARCHAR},#{countryen,jdbcType=VARCHAR}
,#{countryzh,jdbcType=VARCHAR},#{leaderen,jdbcType=VARCHAR},#{leaderzh,jdbcType=VARCHAR}
,#{lat,jdbcType=VARCHAR},#{lon,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ho.filecenter.entity.City" useGeneratedKeys="true">
insert into city
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="cityen != null">cityEn,</if>
<if test="cityzh != null">cityZh,</if>
<if test="provinceen != null">provinceEn,</if>
<if test="provincezh != null">provinceZh,</if>
<if test="countryen != null">countryEn,</if>
<if test="countryzh != null">countryZh,</if>
<if test="leaderen != null">leaderEn,</if>
<if test="leaderzh != null">leaderZh,</if>
<if test="lat != null">lat,</if>
<if test="lon != null">lon,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=VARCHAR},</if>
<if test="cityen != null">#{cityen,jdbcType=VARCHAR},</if>
<if test="cityzh != null">#{cityzh,jdbcType=VARCHAR},</if>
<if test="provinceen != null">#{provinceen,jdbcType=VARCHAR},</if>
<if test="provincezh != null">#{provincezh,jdbcType=VARCHAR},</if>
<if test="countryen != null">#{countryen,jdbcType=VARCHAR},</if>
<if test="countryzh != null">#{countryzh,jdbcType=VARCHAR},</if>
<if test="leaderen != null">#{leaderen,jdbcType=VARCHAR},</if>
<if test="leaderzh != null">#{leaderzh,jdbcType=VARCHAR},</if>
<if test="lat != null">#{lat,jdbcType=VARCHAR},</if>
<if test="lon != null">#{lon,jdbcType=VARCHAR},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.ho.filecenter.entity.City">
update city
<set>
<if test="cityen != null">
cityEn = #{cityen,jdbcType=VARCHAR},
</if>
<if test="cityzh != null">
cityZh = #{cityzh,jdbcType=VARCHAR},
</if>
<if test="provinceen != null">
provinceEn = #{provinceen,jdbcType=VARCHAR},
</if>
<if test="provincezh != null">
provinceZh = #{provincezh,jdbcType=VARCHAR},
</if>
<if test="countryen != null">
countryEn = #{countryen,jdbcType=VARCHAR},
</if>
<if test="countryzh != null">
countryZh = #{countryzh,jdbcType=VARCHAR},
</if>
<if test="leaderen != null">
leaderEn = #{leaderen,jdbcType=VARCHAR},
</if>
<if test="leaderzh != null">
leaderZh = #{leaderzh,jdbcType=VARCHAR},
</if>
<if test="lat != null">
lat = #{lat,jdbcType=VARCHAR},
</if>
<if test="lon != null">
lon = #{lon,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.ho.filecenter.entity.City">
update city
set
cityEn = #{cityen,jdbcType=VARCHAR},
cityZh = #{cityzh,jdbcType=VARCHAR},
provinceEn = #{provinceen,jdbcType=VARCHAR},
provinceZh = #{provincezh,jdbcType=VARCHAR},
countryEn = #{countryen,jdbcType=VARCHAR},
countryZh = #{countryzh,jdbcType=VARCHAR},
leaderEn = #{leaderen,jdbcType=VARCHAR},
leaderZh = #{leaderzh,jdbcType=VARCHAR},
lat = #{lat,jdbcType=VARCHAR},
lon = #{lon,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>