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

news2024/7/4 5:07:22

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 实战:模拟电商网站场景综合案例(四)

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

三十七篇:大数据架构革命:Lambda与Kappa的深度剖析

大数据架构革命:Lambda与Kappa的深度剖析 1. 引言 在这个数据驱动的时代,我们面临着前所未有的挑战和机遇。随着数据量的爆炸性增长,传统的数据处理方法已无法满足现代业务的需求。大数据处理不仅涉及数据量的增加,还包括数据类型的多样化、数据来源的广泛性以及对实时数据…

3 数据类型、运算符与表达式-3.3.2 整型变量(原码,反码,补码)

在计算机科学中&#xff0c;补码、原码和反码是用来表示带符号整数的二进制编码方法&#xff0c;特别是在计算机内存中存储和处理整数时。这些编码方式帮助计算机区分正数和负数&#xff0c;并支持算术运算。以下是它们的具体含义&#xff1a; 原码&#xff08;True Form or S…

国外媒体软文发稿-引时代潮流-助力跨国企业蓬勃发展

大舍传媒&#xff1a;开疆拓土&#xff0c;引领传媒新潮流 随着全球经济的一体化和信息技术的高速发展&#xff0c;跨国企业在国际市场上的竞争越来越激烈。这也给跨国企业带来了巨大的机遇和挑战。在这个时代背景下&#xff0c;大舍传媒凭借其独特的优势和创新的服务模式&…

Java数组的定义 ,基本概念与使用

数组的定义 1.问题:想将一个数据保存起来,我们可以使用变量,但是变量一次只能存储一个数据,所以我们想能不能一次存多个数据2.数组概述:是一个容器,数组本身属于引用数据类型3.作用:一次存储多个数据4.特点:a.既可以存储基本类型的数据,还能存储引用类型的数据b.定长(定义数组…

深入探讨跨域请求(CORS):原理、解决方案与详细示例代码

深入探讨跨域请求&#xff08;CORS&#xff09;&#xff1a;原理、解决方案与详细示例代码 &#x1f310; 深入探讨跨域请求&#xff08;CORS&#xff09;&#xff1a;原理、解决方案与详细示例代码 &#x1f310;摘要引言正文内容什么是跨域&#xff1f;为什么会有跨域问题&am…

Linux网络诊断工具mtr命令详解

目录 一、mtr概述 二、mtr的特点 1、动态路由显示 2、数据包类型 3、显示延迟和丢包 4、过滤和日志 5、网络探测 三、基本用法 1、基本语法 2、帮助 3、常用选项 四、输出解释 1、常见mtr命令及其输出 2、输出解释 四、命令实例 1. 最基本的用法 2. 显示报告形式…

Golang Context详解

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

力扣----轮转数组

题目链接&#xff1a;189. 轮转数组 - 力扣&#xff08;LeetCode&#xff09; 思路一 我们可以在进行每次轮转的时候&#xff0c;先将数组的最后一个数据的值存储起来&#xff0c;接着将数组中前n-1个数据依次向后移&#xff0c;最后将存储起来的值赋给数组中的第一个数据。 …

数据结构复习笔记

简答题 (3) 顺序表和链表的概念及异同 顺序表: 把逻辑上相邻的结点储存在物理位置上的相邻储存单元中&#xff0c;结点的逻辑关系由储存单元的邻接关系来体现.链表: 逻辑上相邻的结点存储再物理位置上非连续非顺序的存储单元中, 结点的逻辑关系由指向下一个结点的指针确保.相…

2024.6.10学习记录

1、代码随想录二刷 2、项目难点 review 3、计组复习

常见的api:BigDecima

一.计算中的小数 float和double占有的位置是有限的 二.BigDecima的作用 1.用于小数的精确计算 2.用来表示很大的小数 三.使用(传入小数) BigDecimal b1 new BigDecimal(0.01);BigDecimal b2 new BigDecimal(0.09);System.out.println(b1);System.out.println(b2); 不精确&…

C++面向对象程序设计 - 输入输出流进一步研究

在C中&#xff0c;输入输出流&#xff08;I/O&#xff09;是一个强大的特性&#xff0c;它允许程序与各种输入/输出设备&#xff08;如键盘、显示器、文件等&#xff09;进行交互。C标准库中的<iostream>头文件定义了基本的输入输出流类&#xff0c;如std::cin&#xff0…

流批一体计算引擎-9-[Flink]中的数量窗与时间窗

1 数量窗 1.1 数量滚动窗口 0基础学习PyFlink——个数滚动窗口(Tumbling Count Windows) 1.1.1 代码分析 Tumbling Count Windows是指按元素个数计数的滚动窗口。 滚动窗口是指没有元素重叠的窗口。 (1)构造了一个KeyedStream&#xff0c;用于存储word_count_data中的数据。…

creo学习一

设置好当前配置后&#xff0c;导出config配置文件&#xff0c;并覆盖掉此路径下的旧文件&#xff0c;使得新配置永久生效&#xff0c;这样每次打开软件都是新配置的设置&#xff1a; 系统颜色的导出&#xff1a; 打开版本的问题&#xff1a; 不能有弱尺寸&#xff1a; 注意&a…

【Android Studio】导入import android.support.v7.app.AppcompatActivity;时报错

一、问题描述 在进行安卓项目开发时使用import android.support.v7.app.AppcompatActivity;报错&#xff1a; 运行后会有乱码出现&#xff1a; 二、解决办法 将import android.support.v7.app.AppcompatActivity;改为import androidx.appcompat.app.AppCompatActivity;基本上…

代码随想录算法训练营第五十四 | ● 392.判断子序列 ● 115.不同的子序列

392.判断子序列 https://programmercarl.com/0392.%E5%88%A4%E6%96%AD%E5%AD%90%E5%BA%8F%E5%88%97.html class Solution { public:bool isSubsequence(string s, string t) {if(s.size()0 )return true;if(t.size()0)return false;vector<vector<int>> dp(s.size(…

学生信息管理(C语言)

学生信息管理 (1)问题描述 学生信息包括:学号,姓名,年龄,性别,出生年月,地址,电话,E-mail等。试设计一学生信息管理系统,使之能提供以下功能: 系统以菜单方式工作学生信息录入功能(学生信息用文件保存)---输入学生信息浏览功能---输出查询、排序功能---算法1、…

Zabbix6.0自动发现Linux服务器并添加主机

文章目录 一、整体流程二、操作过程 一、整体流程 Zabbix自动发现主机功能是Zabbix监控系统的一个重要功能&#xff0c;它能够自动发现并添加新的主机到监控系统中&#xff0c;从而减少人为繁琐的操作&#xff01; 步骤操作1️⃣ 第一步创建自动发现规则2️⃣ ​第二步创建自…

上汽集团25届暑期实习测评校招笔试题库已发(真题)

&#x1f4e3;上汽集团 25届暑期实习测评已发&#xff0c;正在申请的小伙伴看过来哦&#x1f440; ㊙️本次实习项目面向2025届国内外毕业生&#xff0c;开放了新媒体运营、销售策略、市场运营、物流、质量分析等岗位~ ✅测评讲解&#xff1a; &#x1f449;测评自收到起需在…

PawSQL优化 | 分页查询太慢?别忘了投影下推

​在进行数据库应用开发中&#xff0c;分页查询是一项非常常见而又至关重要的任务。但你是否曾因为需要获取总记录数的性能而感到头疼&#xff1f;现在&#xff0c;让PawSQL的投影下推优化来帮你轻松解决这一问题&#xff01;本文以TPCH的Q12为案例进行验证&#xff0c;经过Paw…