|
@@ -1,210 +1,9 @@
|
|
|
<?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.xin.shardingspherejdbcdemo.mapper.UserMapper" >
|
|
|
- <resultMap id="BaseResultMap" type="com.xin.shardingspherejdbcdemo.entity.User" >
|
|
|
- <id column="id" property="id" jdbcType="BIGINT" />
|
|
|
- <result column="name" property="name" jdbcType="VARCHAR" />
|
|
|
- <result column="age" property="age" jdbcType="INTEGER" />
|
|
|
- </resultMap>
|
|
|
- <sql id="Example_Where_Clause" >
|
|
|
- <where >
|
|
|
- <foreach collection="oredCriteria" item="criteria" separator="or" >
|
|
|
- <if test="criteria.valid" >
|
|
|
- <trim prefix="(" suffix=")" prefixOverrides="and" >
|
|
|
- <foreach collection="criteria.criteria" item="criterion" >
|
|
|
- <choose >
|
|
|
- <when test="criterion.noValue" >
|
|
|
- and ${criterion.condition}
|
|
|
- </when>
|
|
|
- <when test="criterion.singleValue" >
|
|
|
- and ${criterion.condition} #{criterion.value}
|
|
|
- </when>
|
|
|
- <when test="criterion.betweenValue" >
|
|
|
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
|
- </when>
|
|
|
- <when test="criterion.listValue" >
|
|
|
- and ${criterion.condition}
|
|
|
- <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
|
|
- #{listItem}
|
|
|
- </foreach>
|
|
|
- </when>
|
|
|
- </choose>
|
|
|
- </foreach>
|
|
|
- </trim>
|
|
|
- </if>
|
|
|
- </foreach>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
- <sql id="Update_By_Example_Where_Clause" >
|
|
|
- <where >
|
|
|
- <foreach collection="example.oredCriteria" item="criteria" separator="or" >
|
|
|
- <if test="criteria.valid" >
|
|
|
- <trim prefix="(" suffix=")" prefixOverrides="and" >
|
|
|
- <foreach collection="criteria.criteria" item="criterion" >
|
|
|
- <choose >
|
|
|
- <when test="criterion.noValue" >
|
|
|
- and ${criterion.condition}
|
|
|
- </when>
|
|
|
- <when test="criterion.singleValue" >
|
|
|
- and ${criterion.condition} #{criterion.value}
|
|
|
- </when>
|
|
|
- <when test="criterion.betweenValue" >
|
|
|
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
|
- </when>
|
|
|
- <when test="criterion.listValue" >
|
|
|
- and ${criterion.condition}
|
|
|
- <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
|
|
- #{listItem}
|
|
|
- </foreach>
|
|
|
- </when>
|
|
|
- </choose>
|
|
|
- </foreach>
|
|
|
- </trim>
|
|
|
- </if>
|
|
|
- </foreach>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
- <sql id="Base_Column_List" >
|
|
|
- id, name, age
|
|
|
- </sql>
|
|
|
- <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xin.shardingspherejdbcdemo.entity.UserExample" >
|
|
|
- select
|
|
|
- <if test="distinct" >
|
|
|
- distinct
|
|
|
- </if>
|
|
|
- <include refid="Base_Column_List" />
|
|
|
- from user0
|
|
|
- <if test="_parameter != null" >
|
|
|
- <include refid="Example_Where_Clause" />
|
|
|
- </if>
|
|
|
- <if test="orderByClause != null" >
|
|
|
- order by ${orderByClause}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
|
|
- select
|
|
|
- <include refid="Base_Column_List" />
|
|
|
- from user
|
|
|
- where id = #{id,jdbcType=BIGINT}
|
|
|
- </select>
|
|
|
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
|
|
|
- delete from user
|
|
|
- where id = #{id,jdbcType=BIGINT}
|
|
|
- </delete>
|
|
|
- <delete id="deleteByExample" parameterType="com.xin.shardingspherejdbcdemo.entity.UserExample" >
|
|
|
- delete from user
|
|
|
- <if test="_parameter != null" >
|
|
|
- <include refid="Example_Where_Clause" />
|
|
|
- </if>
|
|
|
- </delete>
|
|
|
- <insert id="insert" parameterType="com.xin.shardingspherejdbcdemo.entity.User" >
|
|
|
- insert into user (id, name, age)
|
|
|
- values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER})
|
|
|
- </insert>
|
|
|
- <insert id="insertSelective" parameterType="com.xin.shardingspherejdbcdemo.entity.User" >
|
|
|
- insert into user
|
|
|
- <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
- <if test="id != null" >
|
|
|
- id,
|
|
|
- </if>
|
|
|
- <if test="name != null" >
|
|
|
- name,
|
|
|
- </if>
|
|
|
- <if test="age != null" >
|
|
|
- age,
|
|
|
- </if>
|
|
|
- </trim>
|
|
|
- <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
- <if test="id != null" >
|
|
|
- #{id,jdbcType=BIGINT},
|
|
|
- </if>
|
|
|
- <if test="name != null" >
|
|
|
- #{name,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="age != null" >
|
|
|
- #{age,jdbcType=INTEGER},
|
|
|
- </if>
|
|
|
- </trim>
|
|
|
- </insert>
|
|
|
- <select id="countByExample" parameterType="com.xin.shardingspherejdbcdemo.entity.UserExample" resultType="java.lang.Integer" >
|
|
|
- select count(*) from user
|
|
|
- <if test="_parameter != null" >
|
|
|
- <include refid="Example_Where_Clause" />
|
|
|
- </if>
|
|
|
- </select>
|
|
|
- <update id="updateByExampleSelective" parameterType="map" >
|
|
|
- update user
|
|
|
- <set >
|
|
|
- <if test="record.id != null" >
|
|
|
- id = #{record.id,jdbcType=BIGINT},
|
|
|
- </if>
|
|
|
- <if test="record.name != null" >
|
|
|
- name = #{record.name,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="record.age != null" >
|
|
|
- age = #{record.age,jdbcType=INTEGER},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- <if test="_parameter != null" >
|
|
|
- <include refid="Update_By_Example_Where_Clause" />
|
|
|
- </if>
|
|
|
- </update>
|
|
|
- <update id="updateByExample" parameterType="map" >
|
|
|
- update user
|
|
|
- set id = #{record.id,jdbcType=BIGINT},
|
|
|
- name = #{record.name,jdbcType=VARCHAR},
|
|
|
- age = #{record.age,jdbcType=INTEGER}
|
|
|
- <if test="_parameter != null" >
|
|
|
- <include refid="Update_By_Example_Where_Clause" />
|
|
|
- </if>
|
|
|
- </update>
|
|
|
- <update id="updateByPrimaryKeySelective" parameterType="com.xin.shardingspherejdbcdemo.entity.User" >
|
|
|
- update user
|
|
|
- <set >
|
|
|
- <if test="name != null" >
|
|
|
- name = #{name,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="age != null" >
|
|
|
- age = #{age,jdbcType=INTEGER},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where id = #{id,jdbcType=BIGINT}
|
|
|
- </update>
|
|
|
- <update id="updateByPrimaryKey" parameterType="com.xin.shardingspherejdbcdemo.entity.User" >
|
|
|
- update user
|
|
|
- set name = #{name,jdbcType=VARCHAR},
|
|
|
- age = #{age,jdbcType=INTEGER}
|
|
|
- where id = #{id,jdbcType=BIGINT}
|
|
|
- </update>
|
|
|
|
|
|
- <sql id="selectAll_Base_Column_List">
|
|
|
- select
|
|
|
- `id`, `name`, `age`
|
|
|
- from user
|
|
|
- </sql>
|
|
|
|
|
|
- <select id="selectAll" resultMap="BaseResultMap">
|
|
|
- <include refid="selectAll_Base_Column_List"/>
|
|
|
- where id in
|
|
|
- <foreach collection="list" item="id" open="(" close=")" separator=",">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
- </select>
|
|
|
- <insert id="insertAll">
|
|
|
- insert into user
|
|
|
- <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- id,
|
|
|
- name,
|
|
|
- age,
|
|
|
- </trim>
|
|
|
- values
|
|
|
- <foreach collection="list" item="item" separator=",">
|
|
|
- (
|
|
|
- #{item.id,jdbcType=BIGINT},
|
|
|
- #{item.name,jdbcType=VARCHAR},
|
|
|
- #{item.age,jdbcType=INTEGER}
|
|
|
- )
|
|
|
- </foreach>
|
|
|
|
|
|
- </insert>
|
|
|
+
|
|
|
+
|
|
|
</mapper>
|