Files
TKDataSave/src/main/resources/mapper/CountryInfoMapper.xml

174 lines
6.7 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.yupi.springbootinit.mapper.CountryInfoMapper">
<resultMap id="BaseResultMap" type="com.yupi.springbootinit.model.entity.CountryInfo">
<!--@mbg.generated-->
<!--@Table country_info-->
<id column="id" jdbcType="INTEGER" property="id" />
<id column="country_id" jdbcType="VARCHAR" property="countryId" />
<result column="country_group" jdbcType="VARCHAR" property="countryGroup" />
<result column="country_group_name" jdbcType="VARCHAR" property="countryGroupName" />
<result column="country_name" jdbcType="VARCHAR" property="countryName" />
<result column="language" jdbcType="VARCHAR" property="language" />
<result column="language_name" jdbcType="VARCHAR" property="languageName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="updater" jdbcType="VARCHAR" property="updater" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, country_id, country_group, country_group_name, country_name, `language`, language_name,
create_time, creator, update_time, updater
</sql>
<select id="selectByPrimaryKey" parameterType="map" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from country_info
where id = #{id,jdbcType=INTEGER}
and country_id = #{countryId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="map">
<!--@mbg.generated-->
delete from country_info
where id = #{id,jdbcType=INTEGER}
and country_id = #{countryId,jdbcType=VARCHAR}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yupi.springbootinit.model.entity.CountryInfo" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into country_info (country_id, country_group, country_group_name,
country_name, `language`, language_name,
create_time, creator, update_time,
updater)
values (#{countryId,jdbcType=VARCHAR}, #{countryGroup,jdbcType=VARCHAR}, #{countryGroupName,jdbcType=VARCHAR},
#{countryName,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, #{languageName,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{updater,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yupi.springbootinit.model.entity.CountryInfo" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into country_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="countryId != null">
country_id,
</if>
<if test="countryGroup != null">
country_group,
</if>
<if test="countryGroupName != null">
country_group_name,
</if>
<if test="countryName != null">
country_name,
</if>
<if test="language != null">
`language`,
</if>
<if test="languageName != null">
language_name,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updater != null">
updater,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="countryId != null">
#{countryId,jdbcType=VARCHAR},
</if>
<if test="countryGroup != null">
#{countryGroup,jdbcType=VARCHAR},
</if>
<if test="countryGroupName != null">
#{countryGroupName,jdbcType=VARCHAR},
</if>
<if test="countryName != null">
#{countryName,jdbcType=VARCHAR},
</if>
<if test="language != null">
#{language,jdbcType=VARCHAR},
</if>
<if test="languageName != null">
#{languageName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creator != null">
#{creator,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
#{updater,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yupi.springbootinit.model.entity.CountryInfo">
<!--@mbg.generated-->
update country_info
<set>
<if test="countryGroup != null">
country_group = #{countryGroup,jdbcType=VARCHAR},
</if>
<if test="countryGroupName != null">
country_group_name = #{countryGroupName,jdbcType=VARCHAR},
</if>
<if test="countryName != null">
country_name = #{countryName,jdbcType=VARCHAR},
</if>
<if test="language != null">
`language` = #{language,jdbcType=VARCHAR},
</if>
<if test="languageName != null">
language_name = #{languageName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
updater = #{updater,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
and country_id = #{countryId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.yupi.springbootinit.model.entity.CountryInfo">
<!--@mbg.generated-->
update country_info
set country_group = #{countryGroup,jdbcType=VARCHAR},
country_group_name = #{countryGroupName,jdbcType=VARCHAR},
country_name = #{countryName,jdbcType=VARCHAR},
`language` = #{language,jdbcType=VARCHAR},
language_name = #{languageName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
creator = #{creator,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
updater = #{updater,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
and country_id = #{countryId,jdbcType=VARCHAR}
</update>
<select id="selectCountryGroupCountryByCountryName" resultType="com.yupi.springbootinit.model.vo.country.CountryInfoVO">
SELECT c2.country_name
FROM country_info c1
JOIN country_info c2 ON c1.country_group = c2.country_group
WHERE c1.country_name = #{countryName,jdbcType=VARCHAR}
</select>
</mapper>