# RocketMQ 实战:模拟电商网站场景综合案例(五)

RocketMQ 实战:模拟电商网站场景综合案例(五)

一、mybatis 逆向工程使用

4、逆向工程 生成 的 .xml 配置文件。

4.1、生成的 TradeCouponMapper.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.itheima.shop.mapper.TradeCouponMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeCoupon" >
    <id column="coupon_id" property="couponId" jdbcType="BIGINT" />
    <result column="coupon_price" property="couponPrice" jdbcType="DECIMAL" />
    <result column="user_id" property="userId" jdbcType="BIGINT" />
    <result column="order_id" property="orderId" jdbcType="BIGINT" />
    <result column="is_used" property="isUsed" jdbcType="INTEGER" />
    <result column="used_time" property="usedTime" jdbcType="TIMESTAMP" />
  </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" >
    coupon_id, coupon_price, user_id, order_id, is_used, used_time
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeCouponExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_coupon
    <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 trade_coupon
    where coupon_id = #{couponId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from trade_coupon
    where coupon_id = #{couponId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradeCouponExample" >
    delete from trade_coupon
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradeCoupon" >
    insert into trade_coupon (coupon_id, coupon_price, user_id, 
      order_id, is_used, used_time
      )
    values (#{couponId,jdbcType=BIGINT}, #{couponPrice,jdbcType=DECIMAL}, #{userId,jdbcType=BIGINT}, 
      #{orderId,jdbcType=BIGINT}, #{isUsed,jdbcType=INTEGER}, #{usedTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradeCoupon" >
    insert into trade_coupon
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="couponId != null" >
        coupon_id,
      </if>
      <if test="couponPrice != null" >
        coupon_price,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="orderId != null" >
        order_id,
      </if>
      <if test="isUsed != null" >
        is_used,
      </if>
      <if test="usedTime != null" >
        used_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="couponId != null" >
        #{couponId,jdbcType=BIGINT},
      </if>
      <if test="couponPrice != null" >
        #{couponPrice,jdbcType=DECIMAL},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="orderId != null" >
        #{orderId,jdbcType=BIGINT},
      </if>
      <if test="isUsed != null" >
        #{isUsed,jdbcType=INTEGER},
      </if>
      <if test="usedTime != null" >
        #{usedTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradeCouponExample" resultType="java.lang.Integer" >
    select count(*) from trade_coupon
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_coupon
    <set >
      <if test="record.couponId != null" >
        coupon_id = #{record.couponId,jdbcType=BIGINT},
      </if>
      <if test="record.couponPrice != null" >
        coupon_price = #{record.couponPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.userId != null" >
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.orderId != null" >
        order_id = #{record.orderId,jdbcType=BIGINT},
      </if>
      <if test="record.isUsed != null" >
        is_used = #{record.isUsed,jdbcType=INTEGER},
      </if>
      <if test="record.usedTime != null" >
        used_time = #{record.usedTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_coupon
    set coupon_id = #{record.couponId,jdbcType=BIGINT},
      coupon_price = #{record.couponPrice,jdbcType=DECIMAL},
      user_id = #{record.userId,jdbcType=BIGINT},
      order_id = #{record.orderId,jdbcType=BIGINT},
      is_used = #{record.isUsed,jdbcType=INTEGER},
      used_time = #{record.usedTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradeCoupon" >
    update trade_coupon
    <set >
      <if test="couponPrice != null" >
        coupon_price = #{couponPrice,jdbcType=DECIMAL},
      </if>
      <if test="userId != null" >
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="orderId != null" >
        order_id = #{orderId,jdbcType=BIGINT},
      </if>
      <if test="isUsed != null" >
        is_used = #{isUsed,jdbcType=INTEGER},
      </if>
      <if test="usedTime != null" >
        used_time = #{usedTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where coupon_id = #{couponId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeCoupon" >
    update trade_coupon
    set coupon_price = #{couponPrice,jdbcType=DECIMAL},
      user_id = #{userId,jdbcType=BIGINT},
      order_id = #{orderId,jdbcType=BIGINT},
      is_used = #{isUsed,jdbcType=INTEGER},
      used_time = #{usedTime,jdbcType=TIMESTAMP}
    where coupon_id = #{couponId,jdbcType=BIGINT}
  </update>
</mapper>
4.2、生成的 TradeGoodsMapper.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.itheima.shop.mapper.TradeGoodsMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeGoods" >
    <id column="goods_id" property="goodsId" jdbcType="BIGINT" />
    <result column="goods_name" property="goodsName" jdbcType="VARCHAR" />
    <result column="goods_number" property="goodsNumber" jdbcType="INTEGER" />
    <result column="goods_price" property="goodsPrice" jdbcType="DECIMAL" />
    <result column="goods_desc" property="goodsDesc" jdbcType="VARCHAR" />
    <result column="add_time" property="addTime" jdbcType="TIMESTAMP" />
  </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" >
    goods_id, goods_name, goods_number, goods_price, goods_desc, add_time
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeGoodsExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_goods
    <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 trade_goods
    where goods_id = #{goodsId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from trade_goods
    where goods_id = #{goodsId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradeGoodsExample" >
    delete from trade_goods
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradeGoods" >
    insert into trade_goods (goods_id, goods_name, goods_number, 
      goods_price, goods_desc, add_time
      )
    values (#{goodsId,jdbcType=BIGINT}, #{goodsName,jdbcType=VARCHAR}, #{goodsNumber,jdbcType=INTEGER}, 
      #{goodsPrice,jdbcType=DECIMAL}, #{goodsDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradeGoods" >
    insert into trade_goods
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="goodsId != null" >
        goods_id,
      </if>
      <if test="goodsName != null" >
        goods_name,
      </if>
      <if test="goodsNumber != null" >
        goods_number,
      </if>
      <if test="goodsPrice != null" >
        goods_price,
      </if>
      <if test="goodsDesc != null" >
        goods_desc,
      </if>
      <if test="addTime != null" >
        add_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="goodsId != null" >
        #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="goodsName != null" >
        #{goodsName,jdbcType=VARCHAR},
      </if>
      <if test="goodsNumber != null" >
        #{goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="goodsPrice != null" >
        #{goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="goodsDesc != null" >
        #{goodsDesc,jdbcType=VARCHAR},
      </if>
      <if test="addTime != null" >
        #{addTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradeGoodsExample" resultType="java.lang.Integer" >
    select count(*) from trade_goods
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_goods
    <set >
      <if test="record.goodsId != null" >
        goods_id = #{record.goodsId,jdbcType=BIGINT},
      </if>
      <if test="record.goodsName != null" >
        goods_name = #{record.goodsName,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsNumber != null" >
        goods_number = #{record.goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="record.goodsPrice != null" >
        goods_price = #{record.goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.goodsDesc != null" >
        goods_desc = #{record.goodsDesc,jdbcType=VARCHAR},
      </if>
      <if test="record.addTime != null" >
        add_time = #{record.addTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_goods
    set goods_id = #{record.goodsId,jdbcType=BIGINT},
      goods_name = #{record.goodsName,jdbcType=VARCHAR},
      goods_number = #{record.goodsNumber,jdbcType=INTEGER},
      goods_price = #{record.goodsPrice,jdbcType=DECIMAL},
      goods_desc = #{record.goodsDesc,jdbcType=VARCHAR},
      add_time = #{record.addTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradeGoods" >
    update trade_goods
    <set >
      <if test="goodsName != null" >
        goods_name = #{goodsName,jdbcType=VARCHAR},
      </if>
      <if test="goodsNumber != null" >
        goods_number = #{goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="goodsPrice != null" >
        goods_price = #{goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="goodsDesc != null" >
        goods_desc = #{goodsDesc,jdbcType=VARCHAR},
      </if>
      <if test="addTime != null" >
        add_time = #{addTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where goods_id = #{goodsId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeGoods" >
    update trade_goods
    set goods_name = #{goodsName,jdbcType=VARCHAR},
      goods_number = #{goodsNumber,jdbcType=INTEGER},
      goods_price = #{goodsPrice,jdbcType=DECIMAL},
      goods_desc = #{goodsDesc,jdbcType=VARCHAR},
      add_time = #{addTime,jdbcType=TIMESTAMP}
    where goods_id = #{goodsId,jdbcType=BIGINT}
  </update>
</mapper>
4.3、生成的 TradeGoodsNumberLogMapper.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.itheima.shop.mapper.TradeGoodsNumberLogMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeGoodsNumberLog" >
    <id column="goods_id" property="goodsId" jdbcType="BIGINT" />
    <id column="order_id" property="orderId" jdbcType="BIGINT" />
    <result column="goods_number" property="goodsNumber" jdbcType="INTEGER" />
    <result column="log_time" property="logTime" jdbcType="TIMESTAMP" />
  </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" >
    goods_id, order_id, goods_number, log_time
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeGoodsNumberLogExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_goods_number_log
    <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="com.itheima.shop.pojo.TradeGoodsNumberLogKey" >
    select 
    <include refid="Base_Column_List" />
    from trade_goods_number_log
    where goods_id = #{goodsId,jdbcType=BIGINT}
      and order_id = #{orderId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeGoodsNumberLogKey" >
    delete from trade_goods_number_log
    where goods_id = #{goodsId,jdbcType=BIGINT}
      and order_id = #{orderId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradeGoodsNumberLogExample" >
    delete from trade_goods_number_log
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradeGoodsNumberLog" >
    insert into trade_goods_number_log (goods_id, order_id, goods_number, 
      log_time)
    values (#{goodsId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{goodsNumber,jdbcType=INTEGER}, 
      #{logTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradeGoodsNumberLog" >
    insert into trade_goods_number_log
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="goodsId != null" >
        goods_id,
      </if>
      <if test="orderId != null" >
        order_id,
      </if>
      <if test="goodsNumber != null" >
        goods_number,
      </if>
      <if test="logTime != null" >
        log_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="goodsId != null" >
        #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="orderId != null" >
        #{orderId,jdbcType=BIGINT},
      </if>
      <if test="goodsNumber != null" >
        #{goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="logTime != null" >
        #{logTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradeGoodsNumberLogExample" resultType="java.lang.Integer" >
    select count(*) from trade_goods_number_log
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_goods_number_log
    <set >
      <if test="record.goodsId != null" >
        goods_id = #{record.goodsId,jdbcType=BIGINT},
      </if>
      <if test="record.orderId != null" >
        order_id = #{record.orderId,jdbcType=BIGINT},
      </if>
      <if test="record.goodsNumber != null" >
        goods_number = #{record.goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="record.logTime != null" >
        log_time = #{record.logTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_goods_number_log
    set goods_id = #{record.goodsId,jdbcType=BIGINT},
      order_id = #{record.orderId,jdbcType=BIGINT},
      goods_number = #{record.goodsNumber,jdbcType=INTEGER},
      log_time = #{record.logTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradeGoodsNumberLog" >
    update trade_goods_number_log
    <set >
      <if test="goodsNumber != null" >
        goods_number = #{goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="logTime != null" >
        log_time = #{logTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where goods_id = #{goodsId,jdbcType=BIGINT}
      and order_id = #{orderId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeGoodsNumberLog" >
    update trade_goods_number_log
    set goods_number = #{goodsNumber,jdbcType=INTEGER},
      log_time = #{logTime,jdbcType=TIMESTAMP}
    where goods_id = #{goodsId,jdbcType=BIGINT}
      and order_id = #{orderId,jdbcType=BIGINT}
  </update>
</mapper>
4.4、生成的 TradeMqConsumerLogMapper.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.itheima.shop.mapper.TradeMqConsumerLogMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeMqConsumerLog" >
    <id column="group_name" property="groupName" jdbcType="VARCHAR" />
    <id column="msg_tag" property="msgTag" jdbcType="VARCHAR" />
    <id column="msg_key" property="msgKey" jdbcType="VARCHAR" />
    <result column="msg_id" property="msgId" jdbcType="VARCHAR" />
    <result column="msg_body" property="msgBody" jdbcType="VARCHAR" />
    <result column="consumer_status" property="consumerStatus" jdbcType="INTEGER" />
    <result column="consumer_times" property="consumerTimes" jdbcType="INTEGER" />
    <result column="consumer_timestamp" property="consumerTimestamp" jdbcType="TIMESTAMP" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
  </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" >
    group_name, msg_tag, msg_key, msg_id, msg_body, consumer_status, consumer_times, 
    consumer_timestamp, remark
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeMqConsumerLogExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_mq_consumer_log
    <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="com.itheima.shop.pojo.TradeMqConsumerLogKey" >
    select 
    <include refid="Base_Column_List" />
    from trade_mq_consumer_log
    where group_name = #{groupName,jdbcType=VARCHAR}
      and msg_tag = #{msgTag,jdbcType=VARCHAR}
      and msg_key = #{msgKey,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeMqConsumerLogKey" >
    delete from trade_mq_consumer_log
    where group_name = #{groupName,jdbcType=VARCHAR}
      and msg_tag = #{msgTag,jdbcType=VARCHAR}
      and msg_key = #{msgKey,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradeMqConsumerLogExample" >
    delete from trade_mq_consumer_log
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradeMqConsumerLog" >
    insert into trade_mq_consumer_log (group_name, msg_tag, msg_key, 
      msg_id, msg_body, consumer_status, 
      consumer_times, consumer_timestamp, remark
      )
    values (#{groupName,jdbcType=VARCHAR}, #{msgTag,jdbcType=VARCHAR}, #{msgKey,jdbcType=VARCHAR}, 
      #{msgId,jdbcType=VARCHAR}, #{msgBody,jdbcType=VARCHAR}, #{consumerStatus,jdbcType=INTEGER}, 
      #{consumerTimes,jdbcType=INTEGER}, #{consumerTimestamp,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradeMqConsumerLog" >
    insert into trade_mq_consumer_log
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="groupName != null" >
        group_name,
      </if>
      <if test="msgTag != null" >
        msg_tag,
      </if>
      <if test="msgKey != null" >
        msg_key,
      </if>
      <if test="msgId != null" >
        msg_id,
      </if>
      <if test="msgBody != null" >
        msg_body,
      </if>
      <if test="consumerStatus != null" >
        consumer_status,
      </if>
      <if test="consumerTimes != null" >
        consumer_times,
      </if>
      <if test="consumerTimestamp != null" >
        consumer_timestamp,
      </if>
      <if test="remark != null" >
        remark,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="groupName != null" >
        #{groupName,jdbcType=VARCHAR},
      </if>
      <if test="msgTag != null" >
        #{msgTag,jdbcType=VARCHAR},
      </if>
      <if test="msgKey != null" >
        #{msgKey,jdbcType=VARCHAR},
      </if>
      <if test="msgId != null" >
        #{msgId,jdbcType=VARCHAR},
      </if>
      <if test="msgBody != null" >
        #{msgBody,jdbcType=VARCHAR},
      </if>
      <if test="consumerStatus != null" >
        #{consumerStatus,jdbcType=INTEGER},
      </if>
      <if test="consumerTimes != null" >
        #{consumerTimes,jdbcType=INTEGER},
      </if>
      <if test="consumerTimestamp != null" >
        #{consumerTimestamp,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null" >
        #{remark,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradeMqConsumerLogExample" resultType="java.lang.Integer" >
    select count(*) from trade_mq_consumer_log
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_mq_consumer_log
    <set >
      <if test="record.groupName != null" >
        group_name = #{record.groupName,jdbcType=VARCHAR},
      </if>
      <if test="record.msgTag != null" >
        msg_tag = #{record.msgTag,jdbcType=VARCHAR},
      </if>
      <if test="record.msgKey != null" >
        msg_key = #{record.msgKey,jdbcType=VARCHAR},
      </if>
      <if test="record.msgId != null" >
        msg_id = #{record.msgId,jdbcType=VARCHAR},
      </if>
      <if test="record.msgBody != null" >
        msg_body = #{record.msgBody,jdbcType=VARCHAR},
      </if>
      <if test="record.consumerStatus != null" >
        consumer_status = #{record.consumerStatus,jdbcType=INTEGER},
      </if>
      <if test="record.consumerTimes != null" >
        consumer_times = #{record.consumerTimes,jdbcType=INTEGER},
      </if>
      <if test="record.consumerTimestamp != null" >
        consumer_timestamp = #{record.consumerTimestamp,jdbcType=TIMESTAMP},
      </if>
      <if test="record.remark != null" >
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_mq_consumer_log
    set group_name = #{record.groupName,jdbcType=VARCHAR},
      msg_tag = #{record.msgTag,jdbcType=VARCHAR},
      msg_key = #{record.msgKey,jdbcType=VARCHAR},
      msg_id = #{record.msgId,jdbcType=VARCHAR},
      msg_body = #{record.msgBody,jdbcType=VARCHAR},
      consumer_status = #{record.consumerStatus,jdbcType=INTEGER},
      consumer_times = #{record.consumerTimes,jdbcType=INTEGER},
      consumer_timestamp = #{record.consumerTimestamp,jdbcType=TIMESTAMP},
      remark = #{record.remark,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradeMqConsumerLog" >
    update trade_mq_consumer_log
    <set >
      <if test="msgId != null" >
        msg_id = #{msgId,jdbcType=VARCHAR},
      </if>
      <if test="msgBody != null" >
        msg_body = #{msgBody,jdbcType=VARCHAR},
      </if>
      <if test="consumerStatus != null" >
        consumer_status = #{consumerStatus,jdbcType=INTEGER},
      </if>
      <if test="consumerTimes != null" >
        consumer_times = #{consumerTimes,jdbcType=INTEGER},
      </if>
      <if test="consumerTimestamp != null" >
        consumer_timestamp = #{consumerTimestamp,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null" >
        remark = #{remark,jdbcType=VARCHAR},
      </if>
    </set>
    where group_name = #{groupName,jdbcType=VARCHAR}
      and msg_tag = #{msgTag,jdbcType=VARCHAR}
      and msg_key = #{msgKey,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeMqConsumerLog" >
    update trade_mq_consumer_log
    set msg_id = #{msgId,jdbcType=VARCHAR},
      msg_body = #{msgBody,jdbcType=VARCHAR},
      consumer_status = #{consumerStatus,jdbcType=INTEGER},
      consumer_times = #{consumerTimes,jdbcType=INTEGER},
      consumer_timestamp = #{consumerTimestamp,jdbcType=TIMESTAMP},
      remark = #{remark,jdbcType=VARCHAR}
    where group_name = #{groupName,jdbcType=VARCHAR}
      and msg_tag = #{msgTag,jdbcType=VARCHAR}
      and msg_key = #{msgKey,jdbcType=VARCHAR}
  </update>
</mapper>
4.5、生成的 TradeMqProducerTempMapper.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.itheima.shop.mapper.TradeMqProducerTempMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeMqProducerTemp" >
    <id column="id" property="id" jdbcType="VARCHAR" />
    <result column="group_name" property="groupName" jdbcType="VARCHAR" />
    <result column="msg_topic" property="msgTopic" jdbcType="VARCHAR" />
    <result column="msg_tag" property="msgTag" jdbcType="VARCHAR" />
    <result column="msg_key" property="msgKey" jdbcType="VARCHAR" />
    <result column="msg_body" property="msgBody" jdbcType="VARCHAR" />
    <result column="msg_status" property="msgStatus" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  </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, group_name, msg_topic, msg_tag, msg_key, msg_body, msg_status, create_time
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeMqProducerTempExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_mq_producer_temp
    <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.String" >
    select 
    <include refid="Base_Column_List" />
    from trade_mq_producer_temp
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from trade_mq_producer_temp
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradeMqProducerTempExample" >
    delete from trade_mq_producer_temp
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradeMqProducerTemp" >
    insert into trade_mq_producer_temp (id, group_name, msg_topic, 
      msg_tag, msg_key, msg_body, 
      msg_status, create_time)
    values (#{id,jdbcType=VARCHAR}, #{groupName,jdbcType=VARCHAR}, #{msgTopic,jdbcType=VARCHAR}, 
      #{msgTag,jdbcType=VARCHAR}, #{msgKey,jdbcType=VARCHAR}, #{msgBody,jdbcType=VARCHAR}, 
      #{msgStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradeMqProducerTemp" >
    insert into trade_mq_producer_temp
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="groupName != null" >
        group_name,
      </if>
      <if test="msgTopic != null" >
        msg_topic,
      </if>
      <if test="msgTag != null" >
        msg_tag,
      </if>
      <if test="msgKey != null" >
        msg_key,
      </if>
      <if test="msgBody != null" >
        msg_body,
      </if>
      <if test="msgStatus != null" >
        msg_status,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="groupName != null" >
        #{groupName,jdbcType=VARCHAR},
      </if>
      <if test="msgTopic != null" >
        #{msgTopic,jdbcType=VARCHAR},
      </if>
      <if test="msgTag != null" >
        #{msgTag,jdbcType=VARCHAR},
      </if>
      <if test="msgKey != null" >
        #{msgKey,jdbcType=VARCHAR},
      </if>
      <if test="msgBody != null" >
        #{msgBody,jdbcType=VARCHAR},
      </if>
      <if test="msgStatus != null" >
        #{msgStatus,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradeMqProducerTempExample" resultType="java.lang.Integer" >
    select count(*) from trade_mq_producer_temp
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_mq_producer_temp
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.groupName != null" >
        group_name = #{record.groupName,jdbcType=VARCHAR},
      </if>
      <if test="record.msgTopic != null" >
        msg_topic = #{record.msgTopic,jdbcType=VARCHAR},
      </if>
      <if test="record.msgTag != null" >
        msg_tag = #{record.msgTag,jdbcType=VARCHAR},
      </if>
      <if test="record.msgKey != null" >
        msg_key = #{record.msgKey,jdbcType=VARCHAR},
      </if>
      <if test="record.msgBody != null" >
        msg_body = #{record.msgBody,jdbcType=VARCHAR},
      </if>
      <if test="record.msgStatus != null" >
        msg_status = #{record.msgStatus,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null" >
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_mq_producer_temp
    set id = #{record.id,jdbcType=VARCHAR},
      group_name = #{record.groupName,jdbcType=VARCHAR},
      msg_topic = #{record.msgTopic,jdbcType=VARCHAR},
      msg_tag = #{record.msgTag,jdbcType=VARCHAR},
      msg_key = #{record.msgKey,jdbcType=VARCHAR},
      msg_body = #{record.msgBody,jdbcType=VARCHAR},
      msg_status = #{record.msgStatus,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradeMqProducerTemp" >
    update trade_mq_producer_temp
    <set >
      <if test="groupName != null" >
        group_name = #{groupName,jdbcType=VARCHAR},
      </if>
      <if test="msgTopic != null" >
        msg_topic = #{msgTopic,jdbcType=VARCHAR},
      </if>
      <if test="msgTag != null" >
        msg_tag = #{msgTag,jdbcType=VARCHAR},
      </if>
      <if test="msgKey != null" >
        msg_key = #{msgKey,jdbcType=VARCHAR},
      </if>
      <if test="msgBody != null" >
        msg_body = #{msgBody,jdbcType=VARCHAR},
      </if>
      <if test="msgStatus != null" >
        msg_status = #{msgStatus,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeMqProducerTemp" >
    update trade_mq_producer_temp
    set group_name = #{groupName,jdbcType=VARCHAR},
      msg_topic = #{msgTopic,jdbcType=VARCHAR},
      msg_tag = #{msgTag,jdbcType=VARCHAR},
      msg_key = #{msgKey,jdbcType=VARCHAR},
      msg_body = #{msgBody,jdbcType=VARCHAR},
      msg_status = #{msgStatus,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>
4.6、生成的 TradeOrderMapper.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.itheima.shop.mapper.TradeOrderMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeOrder" >
    <id column="order_id" property="orderId" jdbcType="BIGINT" />
    <result column="user_id" property="userId" jdbcType="BIGINT" />
    <result column="order_status" property="orderStatus" jdbcType="INTEGER" />
    <result column="pay_status" property="payStatus" jdbcType="INTEGER" />
    <result column="shipping_status" property="shippingStatus" jdbcType="INTEGER" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="consignee" property="consignee" jdbcType="VARCHAR" />
    <result column="goods_id" property="goodsId" jdbcType="BIGINT" />
    <result column="goods_number" property="goodsNumber" jdbcType="INTEGER" />
    <result column="goods_price" property="goodsPrice" jdbcType="DECIMAL" />
    <result column="goods_amount" property="goodsAmount" jdbcType="DECIMAL" />
    <result column="shipping_fee" property="shippingFee" jdbcType="DECIMAL" />
    <result column="order_amount" property="orderAmount" jdbcType="DECIMAL" />
    <result column="coupon_id" property="couponId" jdbcType="BIGINT" />
    <result column="coupon_paid" property="couponPaid" jdbcType="DECIMAL" />
    <result column="money_paid" property="moneyPaid" jdbcType="DECIMAL" />
    <result column="pay_amount" property="payAmount" jdbcType="DECIMAL" />
    <result column="add_time" property="addTime" jdbcType="TIMESTAMP" />
    <result column="confirm_time" property="confirmTime" jdbcType="TIMESTAMP" />
    <result column="pay_time" property="payTime" jdbcType="TIMESTAMP" />
  </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" >
    order_id, user_id, order_status, pay_status, shipping_status, address, consignee, 
    goods_id, goods_number, goods_price, goods_amount, shipping_fee, order_amount, coupon_id, 
    coupon_paid, money_paid, pay_amount, add_time, confirm_time, pay_time
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeOrderExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_order
    <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 trade_order
    where order_id = #{orderId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from trade_order
    where order_id = #{orderId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradeOrderExample" >
    delete from trade_order
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradeOrder" >
    insert into trade_order (order_id, user_id, order_status, 
      pay_status, shipping_status, address, 
      consignee, goods_id, goods_number, 
      goods_price, goods_amount, shipping_fee, 
      order_amount, coupon_id, coupon_paid, 
      money_paid, pay_amount, add_time, 
      confirm_time, pay_time)
    values (#{orderId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{orderStatus,jdbcType=INTEGER}, 
      #{payStatus,jdbcType=INTEGER}, #{shippingStatus,jdbcType=INTEGER}, #{address,jdbcType=VARCHAR}, 
      #{consignee,jdbcType=VARCHAR}, #{goodsId,jdbcType=BIGINT}, #{goodsNumber,jdbcType=INTEGER}, 
      #{goodsPrice,jdbcType=DECIMAL}, #{goodsAmount,jdbcType=DECIMAL}, #{shippingFee,jdbcType=DECIMAL}, 
      #{orderAmount,jdbcType=DECIMAL}, #{couponId,jdbcType=BIGINT}, #{couponPaid,jdbcType=DECIMAL}, 
      #{moneyPaid,jdbcType=DECIMAL}, #{payAmount,jdbcType=DECIMAL}, #{addTime,jdbcType=TIMESTAMP}, 
      #{confirmTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradeOrder" >
    insert into trade_order
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="orderId != null" >
        order_id,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="orderStatus != null" >
        order_status,
      </if>
      <if test="payStatus != null" >
        pay_status,
      </if>
      <if test="shippingStatus != null" >
        shipping_status,
      </if>
      <if test="address != null" >
        address,
      </if>
      <if test="consignee != null" >
        consignee,
      </if>
      <if test="goodsId != null" >
        goods_id,
      </if>
      <if test="goodsNumber != null" >
        goods_number,
      </if>
      <if test="goodsPrice != null" >
        goods_price,
      </if>
      <if test="goodsAmount != null" >
        goods_amount,
      </if>
      <if test="shippingFee != null" >
        shipping_fee,
      </if>
      <if test="orderAmount != null" >
        order_amount,
      </if>
      <if test="couponId != null" >
        coupon_id,
      </if>
      <if test="couponPaid != null" >
        coupon_paid,
      </if>
      <if test="moneyPaid != null" >
        money_paid,
      </if>
      <if test="payAmount != null" >
        pay_amount,
      </if>
      <if test="addTime != null" >
        add_time,
      </if>
      <if test="confirmTime != null" >
        confirm_time,
      </if>
      <if test="payTime != null" >
        pay_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="orderId != null" >
        #{orderId,jdbcType=BIGINT},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="orderStatus != null" >
        #{orderStatus,jdbcType=INTEGER},
      </if>
      <if test="payStatus != null" >
        #{payStatus,jdbcType=INTEGER},
      </if>
      <if test="shippingStatus != null" >
        #{shippingStatus,jdbcType=INTEGER},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="consignee != null" >
        #{consignee,jdbcType=VARCHAR},
      </if>
      <if test="goodsId != null" >
        #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="goodsNumber != null" >
        #{goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="goodsPrice != null" >
        #{goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="goodsAmount != null" >
        #{goodsAmount,jdbcType=DECIMAL},
      </if>
      <if test="shippingFee != null" >
        #{shippingFee,jdbcType=DECIMAL},
      </if>
      <if test="orderAmount != null" >
        #{orderAmount,jdbcType=DECIMAL},
      </if>
      <if test="couponId != null" >
        #{couponId,jdbcType=BIGINT},
      </if>
      <if test="couponPaid != null" >
        #{couponPaid,jdbcType=DECIMAL},
      </if>
      <if test="moneyPaid != null" >
        #{moneyPaid,jdbcType=DECIMAL},
      </if>
      <if test="payAmount != null" >
        #{payAmount,jdbcType=DECIMAL},
      </if>
      <if test="addTime != null" >
        #{addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="confirmTime != null" >
        #{confirmTime,jdbcType=TIMESTAMP},
      </if>
      <if test="payTime != null" >
        #{payTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradeOrderExample" resultType="java.lang.Integer" >
    select count(*) from trade_order
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_order
    <set >
      <if test="record.orderId != null" >
        order_id = #{record.orderId,jdbcType=BIGINT},
      </if>
      <if test="record.userId != null" >
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.orderStatus != null" >
        order_status = #{record.orderStatus,jdbcType=INTEGER},
      </if>
      <if test="record.payStatus != null" >
        pay_status = #{record.payStatus,jdbcType=INTEGER},
      </if>
      <if test="record.shippingStatus != null" >
        shipping_status = #{record.shippingStatus,jdbcType=INTEGER},
      </if>
      <if test="record.address != null" >
        address = #{record.address,jdbcType=VARCHAR},
      </if>
      <if test="record.consignee != null" >
        consignee = #{record.consignee,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsId != null" >
        goods_id = #{record.goodsId,jdbcType=BIGINT},
      </if>
      <if test="record.goodsNumber != null" >
        goods_number = #{record.goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="record.goodsPrice != null" >
        goods_price = #{record.goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.goodsAmount != null" >
        goods_amount = #{record.goodsAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.shippingFee != null" >
        shipping_fee = #{record.shippingFee,jdbcType=DECIMAL},
      </if>
      <if test="record.orderAmount != null" >
        order_amount = #{record.orderAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.couponId != null" >
        coupon_id = #{record.couponId,jdbcType=BIGINT},
      </if>
      <if test="record.couponPaid != null" >
        coupon_paid = #{record.couponPaid,jdbcType=DECIMAL},
      </if>
      <if test="record.moneyPaid != null" >
        money_paid = #{record.moneyPaid,jdbcType=DECIMAL},
      </if>
      <if test="record.payAmount != null" >
        pay_amount = #{record.payAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.addTime != null" >
        add_time = #{record.addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.confirmTime != null" >
        confirm_time = #{record.confirmTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.payTime != null" >
        pay_time = #{record.payTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_order
    set order_id = #{record.orderId,jdbcType=BIGINT},
      user_id = #{record.userId,jdbcType=BIGINT},
      order_status = #{record.orderStatus,jdbcType=INTEGER},
      pay_status = #{record.payStatus,jdbcType=INTEGER},
      shipping_status = #{record.shippingStatus,jdbcType=INTEGER},
      address = #{record.address,jdbcType=VARCHAR},
      consignee = #{record.consignee,jdbcType=VARCHAR},
      goods_id = #{record.goodsId,jdbcType=BIGINT},
      goods_number = #{record.goodsNumber,jdbcType=INTEGER},
      goods_price = #{record.goodsPrice,jdbcType=DECIMAL},
      goods_amount = #{record.goodsAmount,jdbcType=DECIMAL},
      shipping_fee = #{record.shippingFee,jdbcType=DECIMAL},
      order_amount = #{record.orderAmount,jdbcType=DECIMAL},
      coupon_id = #{record.couponId,jdbcType=BIGINT},
      coupon_paid = #{record.couponPaid,jdbcType=DECIMAL},
      money_paid = #{record.moneyPaid,jdbcType=DECIMAL},
      pay_amount = #{record.payAmount,jdbcType=DECIMAL},
      add_time = #{record.addTime,jdbcType=TIMESTAMP},
      confirm_time = #{record.confirmTime,jdbcType=TIMESTAMP},
      pay_time = #{record.payTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradeOrder" >
    update trade_order
    <set >
      <if test="userId != null" >
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="orderStatus != null" >
        order_status = #{orderStatus,jdbcType=INTEGER},
      </if>
      <if test="payStatus != null" >
        pay_status = #{payStatus,jdbcType=INTEGER},
      </if>
      <if test="shippingStatus != null" >
        shipping_status = #{shippingStatus,jdbcType=INTEGER},
      </if>
      <if test="address != null" >
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="consignee != null" >
        consignee = #{consignee,jdbcType=VARCHAR},
      </if>
      <if test="goodsId != null" >
        goods_id = #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="goodsNumber != null" >
        goods_number = #{goodsNumber,jdbcType=INTEGER},
      </if>
      <if test="goodsPrice != null" >
        goods_price = #{goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="goodsAmount != null" >
        goods_amount = #{goodsAmount,jdbcType=DECIMAL},
      </if>
      <if test="shippingFee != null" >
        shipping_fee = #{shippingFee,jdbcType=DECIMAL},
      </if>
      <if test="orderAmount != null" >
        order_amount = #{orderAmount,jdbcType=DECIMAL},
      </if>
      <if test="couponId != null" >
        coupon_id = #{couponId,jdbcType=BIGINT},
      </if>
      <if test="couponPaid != null" >
        coupon_paid = #{couponPaid,jdbcType=DECIMAL},
      </if>
      <if test="moneyPaid != null" >
        money_paid = #{moneyPaid,jdbcType=DECIMAL},
      </if>
      <if test="payAmount != null" >
        pay_amount = #{payAmount,jdbcType=DECIMAL},
      </if>
      <if test="addTime != null" >
        add_time = #{addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="confirmTime != null" >
        confirm_time = #{confirmTime,jdbcType=TIMESTAMP},
      </if>
      <if test="payTime != null" >
        pay_time = #{payTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where order_id = #{orderId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeOrder" >
    update trade_order
    set user_id = #{userId,jdbcType=BIGINT},
      order_status = #{orderStatus,jdbcType=INTEGER},
      pay_status = #{payStatus,jdbcType=INTEGER},
      shipping_status = #{shippingStatus,jdbcType=INTEGER},
      address = #{address,jdbcType=VARCHAR},
      consignee = #{consignee,jdbcType=VARCHAR},
      goods_id = #{goodsId,jdbcType=BIGINT},
      goods_number = #{goodsNumber,jdbcType=INTEGER},
      goods_price = #{goodsPrice,jdbcType=DECIMAL},
      goods_amount = #{goodsAmount,jdbcType=DECIMAL},
      shipping_fee = #{shippingFee,jdbcType=DECIMAL},
      order_amount = #{orderAmount,jdbcType=DECIMAL},
      coupon_id = #{couponId,jdbcType=BIGINT},
      coupon_paid = #{couponPaid,jdbcType=DECIMAL},
      money_paid = #{moneyPaid,jdbcType=DECIMAL},
      pay_amount = #{payAmount,jdbcType=DECIMAL},
      add_time = #{addTime,jdbcType=TIMESTAMP},
      confirm_time = #{confirmTime,jdbcType=TIMESTAMP},
      pay_time = #{payTime,jdbcType=TIMESTAMP}
    where order_id = #{orderId,jdbcType=BIGINT}
  </update>
</mapper>
4.7、生成的 TradePayMapper.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.itheima.shop.mapper.TradePayMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradePay" >
    <id column="pay_id" property="payId" jdbcType="BIGINT" />
    <result column="order_id" property="orderId" jdbcType="BIGINT" />
    <result column="pay_amount" property="payAmount" jdbcType="DECIMAL" />
    <result column="is_paid" property="isPaid" 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" >
    pay_id, order_id, pay_amount, is_paid
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradePayExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_pay
    <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 trade_pay
    where pay_id = #{payId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from trade_pay
    where pay_id = #{payId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradePayExample" >
    delete from trade_pay
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradePay" >
    insert into trade_pay (pay_id, order_id, pay_amount, 
      is_paid)
    values (#{payId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{payAmount,jdbcType=DECIMAL}, 
      #{isPaid,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradePay" >
    insert into trade_pay
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="payId != null" >
        pay_id,
      </if>
      <if test="orderId != null" >
        order_id,
      </if>
      <if test="payAmount != null" >
        pay_amount,
      </if>
      <if test="isPaid != null" >
        is_paid,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="payId != null" >
        #{payId,jdbcType=BIGINT},
      </if>
      <if test="orderId != null" >
        #{orderId,jdbcType=BIGINT},
      </if>
      <if test="payAmount != null" >
        #{payAmount,jdbcType=DECIMAL},
      </if>
      <if test="isPaid != null" >
        #{isPaid,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradePayExample" resultType="java.lang.Integer" >
    select count(*) from trade_pay
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_pay
    <set >
      <if test="record.payId != null" >
        pay_id = #{record.payId,jdbcType=BIGINT},
      </if>
      <if test="record.orderId != null" >
        order_id = #{record.orderId,jdbcType=BIGINT},
      </if>
      <if test="record.payAmount != null" >
        pay_amount = #{record.payAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.isPaid != null" >
        is_paid = #{record.isPaid,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_pay
    set pay_id = #{record.payId,jdbcType=BIGINT},
      order_id = #{record.orderId,jdbcType=BIGINT},
      pay_amount = #{record.payAmount,jdbcType=DECIMAL},
      is_paid = #{record.isPaid,jdbcType=INTEGER}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradePay" >
    update trade_pay
    <set >
      <if test="orderId != null" >
        order_id = #{orderId,jdbcType=BIGINT},
      </if>
      <if test="payAmount != null" >
        pay_amount = #{payAmount,jdbcType=DECIMAL},
      </if>
      <if test="isPaid != null" >
        is_paid = #{isPaid,jdbcType=INTEGER},
      </if>
    </set>
    where pay_id = #{payId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradePay" >
    update trade_pay
    set order_id = #{orderId,jdbcType=BIGINT},
      pay_amount = #{payAmount,jdbcType=DECIMAL},
      is_paid = #{isPaid,jdbcType=INTEGER}
    where pay_id = #{payId,jdbcType=BIGINT}
  </update>
</mapper>
4.8、生成的 TradeUserMapper.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.itheima.shop.mapper.TradeUserMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeUser" >
    <id column="user_id" property="userId" jdbcType="BIGINT" />
    <result column="user_name" property="userName" jdbcType="VARCHAR" />
    <result column="user_password" property="userPassword" jdbcType="VARCHAR" />
    <result column="user_mobile" property="userMobile" jdbcType="VARCHAR" />
    <result column="user_score" property="userScore" jdbcType="INTEGER" />
    <result column="user_reg_time" property="userRegTime" jdbcType="TIMESTAMP" />
    <result column="user_money" property="userMoney" jdbcType="DECIMAL" />
  </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" >
    user_id, user_name, user_password, user_mobile, user_score, user_reg_time, user_money
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeUserExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_user
    <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 trade_user
    where user_id = #{userId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from trade_user
    where user_id = #{userId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradeUserExample" >
    delete from trade_user
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradeUser" >
    insert into trade_user (user_id, user_name, user_password, 
      user_mobile, user_score, user_reg_time, 
      user_money)
    values (#{userId,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR}, #{userPassword,jdbcType=VARCHAR}, 
      #{userMobile,jdbcType=VARCHAR}, #{userScore,jdbcType=INTEGER}, #{userRegTime,jdbcType=TIMESTAMP}, 
      #{userMoney,jdbcType=DECIMAL})
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradeUser" >
    insert into trade_user
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="userId != null" >
        user_id,
      </if>
      <if test="userName != null" >
        user_name,
      </if>
      <if test="userPassword != null" >
        user_password,
      </if>
      <if test="userMobile != null" >
        user_mobile,
      </if>
      <if test="userScore != null" >
        user_score,
      </if>
      <if test="userRegTime != null" >
        user_reg_time,
      </if>
      <if test="userMoney != null" >
        user_money,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="userId != null" >
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="userName != null" >
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="userPassword != null" >
        #{userPassword,jdbcType=VARCHAR},
      </if>
      <if test="userMobile != null" >
        #{userMobile,jdbcType=VARCHAR},
      </if>
      <if test="userScore != null" >
        #{userScore,jdbcType=INTEGER},
      </if>
      <if test="userRegTime != null" >
        #{userRegTime,jdbcType=TIMESTAMP},
      </if>
      <if test="userMoney != null" >
        #{userMoney,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradeUserExample" resultType="java.lang.Integer" >
    select count(*) from trade_user
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_user
    <set >
      <if test="record.userId != null" >
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.userName != null" >
        user_name = #{record.userName,jdbcType=VARCHAR},
      </if>
      <if test="record.userPassword != null" >
        user_password = #{record.userPassword,jdbcType=VARCHAR},
      </if>
      <if test="record.userMobile != null" >
        user_mobile = #{record.userMobile,jdbcType=VARCHAR},
      </if>
      <if test="record.userScore != null" >
        user_score = #{record.userScore,jdbcType=INTEGER},
      </if>
      <if test="record.userRegTime != null" >
        user_reg_time = #{record.userRegTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.userMoney != null" >
        user_money = #{record.userMoney,jdbcType=DECIMAL},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_user
    set user_id = #{record.userId,jdbcType=BIGINT},
      user_name = #{record.userName,jdbcType=VARCHAR},
      user_password = #{record.userPassword,jdbcType=VARCHAR},
      user_mobile = #{record.userMobile,jdbcType=VARCHAR},
      user_score = #{record.userScore,jdbcType=INTEGER},
      user_reg_time = #{record.userRegTime,jdbcType=TIMESTAMP},
      user_money = #{record.userMoney,jdbcType=DECIMAL}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradeUser" >
    update trade_user
    <set >
      <if test="userName != null" >
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="userPassword != null" >
        user_password = #{userPassword,jdbcType=VARCHAR},
      </if>
      <if test="userMobile != null" >
        user_mobile = #{userMobile,jdbcType=VARCHAR},
      </if>
      <if test="userScore != null" >
        user_score = #{userScore,jdbcType=INTEGER},
      </if>
      <if test="userRegTime != null" >
        user_reg_time = #{userRegTime,jdbcType=TIMESTAMP},
      </if>
      <if test="userMoney != null" >
        user_money = #{userMoney,jdbcType=DECIMAL},
      </if>
    </set>
    where user_id = #{userId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeUser" >
    update trade_user
    set user_name = #{userName,jdbcType=VARCHAR},
      user_password = #{userPassword,jdbcType=VARCHAR},
      user_mobile = #{userMobile,jdbcType=VARCHAR},
      user_score = #{userScore,jdbcType=INTEGER},
      user_reg_time = #{userRegTime,jdbcType=TIMESTAMP},
      user_money = #{userMoney,jdbcType=DECIMAL}
    where user_id = #{userId,jdbcType=BIGINT}
  </update>
</mapper>
4.9、生成的 TradeUserMoneyLogMapper.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.itheima.shop.mapper.TradeUserMoneyLogMapper" >
  <resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeUserMoneyLog" >
    <id column="user_id" property="userId" jdbcType="BIGINT" />
    <id column="order_id" property="orderId" jdbcType="BIGINT" />
    <id column="money_log_type" property="moneyLogType" jdbcType="INTEGER" />
    <result column="use_money" property="useMoney" jdbcType="DECIMAL" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  </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" >
    user_id, order_id, money_log_type, use_money, create_time
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeUserMoneyLogExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from trade_user_money_log
    <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="com.itheima.shop.pojo.TradeUserMoneyLogKey" >
    select 
    <include refid="Base_Column_List" />
    from trade_user_money_log
    where user_id = #{userId,jdbcType=BIGINT}
      and order_id = #{orderId,jdbcType=BIGINT}
      and money_log_type = #{moneyLogType,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeUserMoneyLogKey" >
    delete from trade_user_money_log
    where user_id = #{userId,jdbcType=BIGINT}
      and order_id = #{orderId,jdbcType=BIGINT}
      and money_log_type = #{moneyLogType,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.itheima.shop.pojo.TradeUserMoneyLogExample" >
    delete from trade_user_money_log
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itheima.shop.pojo.TradeUserMoneyLog" >
    insert into trade_user_money_log (user_id, order_id, money_log_type, 
      use_money, create_time)
    values (#{userId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{moneyLogType,jdbcType=INTEGER}, 
      #{useMoney,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.itheima.shop.pojo.TradeUserMoneyLog" >
    insert into trade_user_money_log
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="userId != null" >
        user_id,
      </if>
      <if test="orderId != null" >
        order_id,
      </if>
      <if test="moneyLogType != null" >
        money_log_type,
      </if>
      <if test="useMoney != null" >
        use_money,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="userId != null" >
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="orderId != null" >
        #{orderId,jdbcType=BIGINT},
      </if>
      <if test="moneyLogType != null" >
        #{moneyLogType,jdbcType=INTEGER},
      </if>
      <if test="useMoney != null" >
        #{useMoney,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itheima.shop.pojo.TradeUserMoneyLogExample" resultType="java.lang.Integer" >
    select count(*) from trade_user_money_log
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update trade_user_money_log
    <set >
      <if test="record.userId != null" >
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.orderId != null" >
        order_id = #{record.orderId,jdbcType=BIGINT},
      </if>
      <if test="record.moneyLogType != null" >
        money_log_type = #{record.moneyLogType,jdbcType=INTEGER},
      </if>
      <if test="record.useMoney != null" >
        use_money = #{record.useMoney,jdbcType=DECIMAL},
      </if>
      <if test="record.createTime != null" >
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update trade_user_money_log
    set user_id = #{record.userId,jdbcType=BIGINT},
      order_id = #{record.orderId,jdbcType=BIGINT},
      money_log_type = #{record.moneyLogType,jdbcType=INTEGER},
      use_money = #{record.useMoney,jdbcType=DECIMAL},
      create_time = #{record.createTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itheima.shop.pojo.TradeUserMoneyLog" >
    update trade_user_money_log
    <set >
      <if test="useMoney != null" >
        use_money = #{useMoney,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where user_id = #{userId,jdbcType=BIGINT}
      and order_id = #{orderId,jdbcType=BIGINT}
      and money_log_type = #{moneyLogType,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itheima.shop.pojo.TradeUserMoneyLog" >
    update trade_user_money_log
    set use_money = #{useMoney,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where user_id = #{userId,jdbcType=BIGINT}
      and order_id = #{orderId,jdbcType=BIGINT}
      and money_log_type = #{moneyLogType,jdbcType=INTEGER}
  </update>
</mapper>

5、创建 shop-pojo 实体类 工程,复制导入 生成的 POJO 类文件。

5.1、在 pom.xml 中,导入依赖坐标。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>shop-parent</artifactId>
        <groupId>com.iteima.shop</groupId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../shop-parent/pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>shop-pojo</artifactId>

</project>
<!-- shop\shop-pojo\pom.xml -->

5.2、创建 类 MQEntity.java
package com.itheima.entity;

import java.math.BigDecimal;

public class MQEntity {

    private Long orderId;
    private Long couponId;
    private Long userId;
    private BigDecimal userMoney;
    private Long goodsId;
    private Integer goodsNum;

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public BigDecimal getUserMoney() {
        return userMoney;
    }

    public void setUserMoney(BigDecimal userMoney) {
        this.userMoney = userMoney;
    }

    public Long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }

    public Integer getGoodsNum() {
        return goodsNum;
    }

    public void setGoodsNum(Integer goodsNum) {
        this.goodsNum = goodsNum;
    }
}

5.3、创建 类 Result.java
package com.itheima.entity;

import java.io.Serializable;

/**
 * 结果实体类
 */
public class Result implements Serializable {
    private Boolean success;
    private String message;

    public Result() {
    }

    public Result(Boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return "Result{" +
                "success=" + success +
                ", message='" + message + '\'' +
                '}';
    }
}

5.4、复制导入 POJO 类 TradeCoupon.java
5.5、复制导入 POJO 类 TradeCouponExample.java
5.6、复制导入 POJO 类 TradeGoods.java
5.7、复制导入 POJO 类 TradeGoodsExample.java
5.8、复制导入 POJO 类 TradeGoodsNumberLog.java
5.9、复制导入 POJO 类 TradeGoodsNumberLogExample.java
5.10、复制导入 POJO 类 TradeGoodsNumberLogKey.java
5.11、复制导入 POJO 类 TradeMqConsumerLog.java
5.12、复制导入 POJO 类 TradeMqConsumerLogExample.java
5.13、复制导入 POJO 类 TradeMqConsumerLogKey .java
5.14、复制导入 POJO 类 TradeMqProducerTemp.java
5.15、复制导入 POJO 类 TradeMqProducerTempExample.java
5.16、复制导入 POJO 类 TradeOrder.java
5.17、复制导入 POJO 类 TradeOrderExample.java
5.18、复制导入 POJO 类 TradePay.java
5.19、复制导入 POJO 类 TradePayExample.java
5.20、复制导入 POJO 类 TradeUser.java
5.21、复制导入 POJO 类 TradeUserExample.java
5.22、复制导入 POJO 类 TradeUserMoneyLog.java
5.23、复制导入 POJO 类 TradeUserMoneyLogExample.java
5.24、复制导入 POJO 类 TradeUserMoneyLogKey.java

6、把逆向工程生成的 mapper 类文件 和 .xml 文件,复制导入到 各模块工程。

上一节关联链接请点击:
# RocketMQ 实战:模拟电商网站场景综合案例(四)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/696807.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

设计随笔 ---- ADR4525 篇

ADR4525一颗超低噪声、高精度2.5V基准电压源&#xff1b; Fluke 17B准确度指标&#xff1a; ADR4525指标&#xff1a; Fluke 17B测试结果&#xff1a; 2.5V的基准&#xff0c;输出只有2.477V&#xff0c;其实这么高精度的电压基准用3位半的万用表来测试本身就是一个错误&#…

vscode侧边栏错乱重制

vscode 重制命令面板 View: Reset View Locations

这公司是怎么存活的?真的有存在的必要吗?

原址&#xff1a;OfferNow 大家好&#xff0c;我是白露啊。 昨天看到一个招聘经历的分享&#xff0c;简直让我怀疑人生。 还能有这样的公司&#xff1f; 对方HR说&#xff1a;“*** &#xff0c;学习期间是单休&#xff0c;每天需要加班4-5小时&#xff0c;并且学习期间每天要…

Java(十七)---ArrayList的使用

文章目录 前言1.ArrayList的简介2. ArrayList使用2.1.ArrayList的构造2.2.ArrayList的扩容机制(JDK17) 3.ArrayList的常见操作4. ArrayList的具体使用4.1.[杨辉三角](https://leetcode.cn/problems/pascals-triangle/description/)4.2.简单的洗牌游戏 5.ArrayList的问题及思考 …

操作系统入门系列-MIT6.828(操作系统工程)学习笔记(六)---- 初窥操作系统启动流程(xv6启动)

系列文章目录 操作系统入门系列-MIT6.S081&#xff08;操作系统&#xff09;学习笔记&#xff08;一&#xff09;---- 操作系统介绍与接口示例 操作系统入门系列-MIT6.828&#xff08;操作系统工程&#xff09;学习笔记&#xff08;二&#xff09;----课程实验环境搭建&#x…

SpringSecurity入门(三)

12、密码加密 12.1、不指定具体加密方式&#xff0c;通过DelegatingPasswordEncoder&#xff0c;根据前缀自动选择 PasswordEncoder passwordEncoder PasswordEncoderFactories.createDelegatingPasswordEncoder();12.2、指定具体加密方式 // Create an encoder with streng…

13. ESP32-HTTPClient(Arduino)

使用ESP32 Arduino框架的HTTPClient库进行HTTP请求 在ESP32开发里&#xff0c;网络通信是挺重要的一部分&#xff0c;你可能需要从服务器拿数据啊&#xff0c;或者把传感器数据发到云端什么的。不过别担心&#xff0c;ESP32 Arduino框架给我们提供了HTTPClient库&#xff0c;让…

阻塞队列和线程池

一、什么是阻塞队列 1.1 什么是队列 队列是先进先出。 队列是一种特殊的线性表&#xff0c;特殊之处在于它只允许在表的前端&#xff08;front&#xff09;进行删除操作&#xff0c;而在表的后端&#xff08;rear&#xff09;进行插入操作&#xff0c;和栈一样&#xff0c;队…

前端自测 - 那些经典的bug

前言 我一直坚持的一个观点&#xff0c;就是不以bug数论成败&#xff0c;但是这个需要加一个前提&#xff0c;就是不能出现那些低级的bug&#xff0c;更不能反复的出现。 由此整理了一系列我认为比较经典常见的前端bug&#xff0c;都是在项目中多次遇到过的&#xff0c;用于前…

Golang Context详解

文章目录 基本介绍context源码剖析Context接口emptyCtxcancelCtxtimerCtxvalueCtx context使用案例协程取消超时控制数据共享 基本介绍 基本介绍 在Go 1.7版本中引入了上下文&#xff08;context&#xff09;包&#xff0c;用于在并发编程中管理请求范围的数据、控制生命周期、…

vue-router全部搞定(附源码)

源码下载链接&#xff08;先转存&#xff0c;后下载&#xff09;&#xff1a;https://pan.quark.cn/s/b0c6edd68c21 怎么用vue-cli搭建项目 我们固然可以用传统htmljs的方式来搭建vue项目&#xff0c;但是如果组件很多&#xff0c;就需要通过Vue.component的方式一个个去引入…

Python的else子句7个妙用,原来还能这样用,整挺好!

## 1、条件语句else基础 &#x1f504; 1.1 简单else的常规操作 在Python中&#xff0c;else子句通常跟在if或一系列if-elif之后&#xff0c;提供一个“否则”的情况处理路径。如果前面的所有条件都不满足 &#xff0c;程序就会执行这里的代码块。例如 &#xff0c;检查一个数…

【STM32】GPIO输出(江科大)

一、GPIO简介 1.GPIO&#xff1a;通用输入输出口 2.可配置为8种输入输出模式 3.引脚电平&#xff1a;0-3.3V&#xff08;输出最大3.3V&#xff09;&#xff0c;部分引脚可容忍5V&#xff08;输入&#xff0c;有FT&#xff09; 4.输出模式下&#xff0c;可控制端口输出高低电平…

详解FedProx:FedAvg的改进版 Federated optimization in heterogeneous networks

FedProx&#xff1a;2020 FedAvg的改进 论文&#xff1a;《Federated Optimization in Heterogeneous Networks》 引用量&#xff1a;4445 源码地址&#xff1a; 官方实现&#xff08;tensorflow&#xff09;https://github.com/litian96/FedProx 几个pytorch实现&#xff1a;…

十二、【源码】配置注解执行SQL

源码地址&#xff1a;https://github.com/mybatis/mybatis-3/ 仓库地址&#xff1a;https://gitcode.net/qq_42665745/mybatis/-/tree/12-annotation 配置注解执行SQL 简化一下流程&#xff0c;主要可以分为下面几步&#xff1a; 1.解析配置&#xff0c;写入配置项 2.执行…

问题排查: Goalng Defer 带来的性能损耗

本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。 本作品 (李兆龙 博文, 由 李兆龙 创作)&#xff0c;由 李兆龙 确认&#xff0c;转载请注明版权。 文章目录 引言问题背景结论 引言 性能优化之路道阻且长&#xff0c;因为脱敏规定&#xff0c;…

Nginx 精解:正则表达式、location 匹配与 rewrite 重写

一、常见的 Nginx 正则表达式 在 Nginx 配置中&#xff0c;正则表达式用于匹配和重写 URL 请求。以下是一些常见的 Nginx 正则表达式示例&#xff1a; 当涉及正则表达式时&#xff0c;理解各个特殊字符的含义是非常重要的。以下是每个特殊字符的例子&#xff1a; ^&#xff1…

讯飞星火大模型个人API账号免费使用申请教程

文章目录 1.登录讯飞星火大模型官网 https://www.xfyun.cn/ 2.下滑找到Spark Lite&#xff0c;点击立即调用 3.星火大模型需要和具体的应用绑定&#xff0c;我们需要先创建一个新应用 https://console.xfyun.cn/app/myapp&#xff0c;应用名称可以按照自己的意愿起。 4.填写应用…

打造智慧工厂核心:ARMxy工业PC与Linux系统

智能制造正以前所未有的速度重塑全球工业格局&#xff0c;而位于这场革命核心的&#xff0c;正是那些能够精准响应复杂生产需求、高效驱动自动化流程的先进设备。钡铼技术ARMxy工业计算机&#xff0c;以其独特的设计哲学与卓越的技术性能&#xff0c;正成为众多现代化生产线背后…

ViT:2 理解CLIP

大模型技术论文不断&#xff0c;每个月总会新增上千篇。本专栏精选论文重点解读&#xff0c;主题还是围绕着行业实践和工程量产。若在某个环节出现卡点&#xff0c;可以回到大模型必备腔调或者LLM背后的基础模型新阅读。而最新科技&#xff08;Mamba,xLSTM,KAN&#xff09;则提…