mybatis-generator 产生出来的一个 小毛驴(xml) 文件

mybatis-generator 产生出来的一个 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.YKenan.YKenan.mapper.YHideMapper">
  <resultMap id="BaseResultMap" type="com.YKenan.YKenan.pojo.YHide">
    <constructor>
      <idArg column="y_id" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="y_age" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="y_hoppy" javaType="java.lang.String" jdbcType="VARCHAR" />
    </constructor>
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" 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="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    y_id, y_age, y_hoppy
  </sql>
  <select id="selectByExample" parameterType="com.hyd.YKenan.pojo.YHideExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from y_hide
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from y_hide
    where y_id = #{yId,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from y_hide
    where y_id = #{yId,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.hyd.YKenan.pojo.YHideExample">
    delete from y_hide
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.hyd.YKenan.pojo.YHide">
    insert into y_hide (y_id, y_age, y_hoppy
      )
    values (#{yId,jdbcType=VARCHAR}, #{yAge,jdbcType=VARCHAR}, #{yHoppy,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.hyd.YKenan.pojo.YHide">
    insert into y_hide
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="yId != null">
        y_id,
      </if>
      <if test="yAge != null">
        y_age,
      </if>
      <if test="yHoppy != null">
        y_hoppy,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="yId != null">
        #{yId,jdbcType=VARCHAR},
      </if>
      <if test="yAge != null">
        #{yAge,jdbcType=VARCHAR},
      </if>
      <if test="yHoppy != null">
        #{yHoppy,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.hyd.YKenan.pojo.YHideExample" resultType="java.lang.Long">
    select count(*) from y_hide
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update y_hide
    <set>
      <if test="record.yId != null">
        y_id = #{record.yId,jdbcType=VARCHAR},
      </if>
      <if test="record.yAge != null">
        y_age = #{record.yAge,jdbcType=VARCHAR},
      </if>
      <if test="record.yHoppy != null">
        y_hoppy = #{record.yHoppy,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update y_hide
    set y_id = #{record.yId,jdbcType=VARCHAR},
      y_age = #{record.yAge,jdbcType=VARCHAR},
      y_hoppy = #{record.yHoppy,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.hyd.YKenan.pojo.YHide">
    update y_hide
    <set>
      <if test="yAge != null">
        y_age = #{yAge,jdbcType=VARCHAR},
      </if>
      <if test="yHoppy != null">
        y_hoppy = #{yHoppy,jdbcType=VARCHAR},
      </if>
    </set>
    where y_id = #{yId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.hyd.YKenan.pojo.YHide">
    update y_hide
    set y_age = #{yAge,jdbcType=VARCHAR},
      y_hoppy = #{yHoppy,jdbcType=VARCHAR}
    where y_id = #{yId,jdbcType=VARCHAR}
  </update>
</mapper>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值