当前位置: 首页 > news >正文

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

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

一、mybatis 逆向工程使用

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

4.1、生成的 TradeCouponMapper.xml 文件。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.shop.mapper.TradeCouponMapper" ><resultMap id="BaseResultMap" type="com.itheima.shop.pojo.TradeCoupon" ><id column="coupon_id" property="couponId" jdbcType="BIGINT" /><result column="coupon_price" property="couponPrice" jdbcType="DECIMAL" /><result column="user_id" property="userId" jdbcType="BIGINT" /><result column="order_id" property="orderId" jdbcType="BIGINT" /><result column="is_used" property="isUsed" jdbcType="INTEGER" /><result column="used_time" property="usedTime" jdbcType="TIMESTAMP" /></resultMap><sql id="Example_Where_Clause" ><where ><foreach collection="oredCriteria" item="criteria" separator="or" ><if test="criteria.valid" ><trim prefix="(" suffix=")" prefixOverrides="and" ><foreach collection="criteria.criteria" item="criterion" ><choose ><when test="criterion.noValue" >and ${criterion.condition}</when><when test="criterion.singleValue" >and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue" >and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue" >and ${criterion.condition}<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Update_By_Example_Where_Clause" ><where ><foreach collection="example.oredCriteria" item="criteria" separator="or" ><if test="criteria.valid" ><trim prefix="(" suffix=")" prefixOverrides="and" ><foreach collection="criteria.criteria" item="criterion" ><choose ><when test="criterion.noValue" >and ${criterion.condition}</when><when test="criterion.singleValue" >and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue" >and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue" >and ${criterion.condition}<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Base_Column_List" >coupon_id, coupon_price, user_id, order_id, is_used, used_time</sql><select id="selectByExample" resultMap="BaseResultMap" parameterType="com.itheima.shop.pojo.TradeCouponExample" >select<if test="distinct" >distinct</if><include refid="Base_Column_List" />from trade_coupon<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if><if test="orderByClause != null" >order by ${orderByClause}</if></select><select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >select <include refid="Base_Column_List" />from trade_couponwhere coupon_id = #{couponId,jdbcType=BIGINT}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >delete from trade_couponwhere 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_couponset 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_couponset 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_goodswhere goods_id = #{goodsId,jdbcType=BIGINT}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >delete from trade_goodswhere 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_goodsset 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_goodsset 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_logwhere 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_logwhere 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_logset 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_logset 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_logwhere 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_logwhere 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_logset 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_logset 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_tempwhere id = #{id,jdbcType=VARCHAR}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.String" >delete from trade_mq_producer_tempwhere 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_tempset 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_tempset 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_orderwhere order_id = #{orderId,jdbcType=BIGINT}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >delete from trade_orderwhere 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_orderset 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_orderset 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_paywhere pay_id = #{payId,jdbcType=BIGINT}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >delete from trade_paywhere 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_payset 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_payset 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_userwhere user_id = #{userId,jdbcType=BIGINT}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >delete from trade_userwhere 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_userset 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_userset 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_logwhere 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_logwhere 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_logset 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_logset 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;}@Overridepublic 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 实战:模拟电商网站场景综合案例(四)

环境搭建:数据库表结构介绍–项目工程初始化 查看 请点击:
# RocketMQ 实战:模拟电商网站场景综合案例(三)

mybatis 逆向工程 生成 POJO 类 源文件 和 mapper 映射文件 查看 请点击:
RocketMQ 实战:模拟电商网站场景综合案例(四)

相关文章:

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

RocketMQ 实战&#xff1a;模拟电商网站场景综合案例&#xff08;五&#xff09; 一、mybatis 逆向工程使用 4、逆向工程 生成 的 .xml 配置文件。 4.1、生成的 TradeCouponMapper.xml 文件。 <?xml version"1.0" encoding"UTF-8" ?> <!DOC…...

Cesium4Unreal - # 009 直接加载显示shapefile

文章目录 直接加载显示shapefile1 思路2 步骤2.1 下载shapelib2.2 添加依赖模块2.3 创建Actor2.3.1 MyShapeLoaderActor.h2.3.2 MyShapeLoaderActor.cpp2.3 蓝图代码直接加载显示shapefile 1 思路 在Unreal Engine中加载显示shapefile无非就是从shapefile中读取几何数据,并且…...

Release和Debug的区别?Release有什么好处?【面试】

Release和Debug的区别&#xff1a; 优化&#xff1a;Debug版本通常不进行优化&#xff0c;以便更容易调试&#xff1b;Release版本则经过高度优化&#xff0c;以提高性能。调试信息&#xff1a;Debug版本包含详尽的调试信息&#xff0c;如符号信息和源代码映射&#xff1b;Rel…...

DevExpress 控件和库

UI控件和组件 DevExpress WinForms包括以下Windows窗体库和控件&#xff1a; Grids and Editors Data Grid Tree List Vertical Grid Property Grid Gantt Control Data Editors and Simple Controls Office-inspired Ribbon, Bars and Menu Rich Text Editor Scheduler S…...

车载以太网测试

一、车载以太网的发展 IEEE&#xff1a; 电气与电子工程师协会&#xff0c;其中IEEE802.3工作小组致力于推进以太网相关标准的制定与完善&#xff0c;其发展主要经过一下三个阶段: 1.诊断/程序更新 2.智驾座舱 3.主干网 二、车载以太网协议&#xff08;OSI七层模型&#x…...

181.二叉树:验证二叉树(力扣)

代码解决 /*** Definition for a binary tree node.* struct TreeNode {* int val;* TreeNode *left;* TreeNode *right;* TreeNode() : val(0), left(nullptr), right(nullptr) {}* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}* Tre…...

陪诊小程序开发,陪诊师在线接单

近几年&#xff0c;陪诊师成为了一个新兴行业&#xff0c;在科技时代中&#xff0c;陪诊小程序作为互联网下的产物&#xff0c;为陪诊市场带来了更多的便利。 当下生活压力大&#xff0c;老龄化逐渐严重&#xff0c;年轻人很难做到陪同家属看病。此外&#xff0c;就诊中出现了…...

【全开源】Java无人共享棋牌室茶室台球室系统JAVA版本支持微信小程序+微信公众号

无人共享棋牌室系统——棋牌娱乐新体验 &#x1f3b2;引言 随着科技的不断发展&#xff0c;传统棋牌室正逐渐迈向智能化、无人化。今天&#xff0c;我要为大家介绍的就是这款引领潮流的“无人共享棋牌室系统”。它不仅为棋牌爱好者提供了全新的娱乐体验&#xff0c;更在便捷性…...

2024-6-10-zero shot,few shot以及无监督学习之间的关系是什么

Zero-shot learning、few-shot learning和无监督学习都是机器学习中的方法&#xff0c;它们共同的特点是在有限或没有标签数据的情况下进行学习。下面是这三种方法之间的关系和区别&#xff1a; Zero-shot Learning (零样本学习)&#xff1a; 零样本学习是在模型训练过程中完全…...

C语言|十进制数转换任意进制数

将十进制数转换成任意进制数。 思路分析&#xff1a; 先举一个具体的例子&#xff1a;十进制转换为二进制数 1 定义一个数组a[100]&#xff0c;先归0&#xff0c;再存放运算过程中的余数 2 定义变量m, 先存放键盘上输入的十进制数 3 定义变量R 表示几进制数&#xff0c;循环变量…...

驱动开发(二):创建字符设备驱动

往期文章&#xff1a; 驱动开发&#xff08;一&#xff09;&#xff1a;驱动代码的基本框架 驱动开发&#xff08;二&#xff09;&#xff1a;创建字符设备驱动 ←本文 目录 字符驱动设备的作用 函数 字符驱动设备注册和注销 注册 注销 自动创建设备节点 创建class类…...

Golang:使用时会遇到的错误及解决方法详解

Go语言使用时常常会遇到的一些错误及解决方法&#xff0c;文中的示例代码讲解详细&#xff0c;感兴趣的小伙伴可以了解一下 1、go: go.mod file not found in current directory or any parent directory go mod init name 2、Failed to build the application: main.go:4:2:…...

r语言数据分析案例25-基于向量自回归模型的标准普尔 500 指数长期预测与机制分析

一、背景介绍 2007 年的全球经济危机深刻改变了世界经济格局&#xff0c;引发了一系列连锁反应&#xff0c;波及各大洲。经济增长停滞不前&#xff0c;甚至在某些情况下出现负增长&#xff0c;给出口导向型发展中国家带来了不确定性。实体经济受到的冲击尤为严重&#xff0c;生…...

解决使用Jmeter进行测试时出现“302“,‘‘401“等用户未登录的问题

使用 JMeter 压力测试时解决登录问题的两种方法 在使用 JMeter 进行压力测试时&#xff0c;可能会遇程序存在安全验证&#xff0c;必须登录后才能对里面的具体方法进行测试&#xff1a; 如果遇到登录问题&#xff0c;通常是因为 JMeter 无法模拟用户的登录状态&#xff0c;导…...

MySql通过 Procedure 循环删除数据

一、问题描述 在日常使用运维中&#xff0c;一些特殊情况需要批量删除陈旧或异常数据。 如果通过 delete from 【表名】 where 【条件】 直接删除&#xff0c;可能会由于数据量过大&#xff0c;事务执行时间过长&#xff0c;造成死锁。 二、解决方案 通过 Procedure 使用循环…...

Spring Boot 的启动原理、Spring Boot 自动配置原理

Spring Boot启动原理包含自动装配原理。 Spring Boot 的启动原理&#xff1a; 1. 入口类与 SpringApplication 初始化&#xff1a; 应用程序通常从一个带有 SpringBootApplication 注解的主类开始&#xff0c;这个注解是一个组合注解&#xff0c;包含了 SpringBootConfigurat…...

不会开发的你也能管理好企业漏洞,开源免费工具:洞察(insight II)

公司刚开始建设安全管理时&#xff0c;都是从一片混沌开始的&#xff0c;资源总是不够的&#xff0c;我们每个做安全的人员&#xff0c;又要会渗透&#xff0c;又要抓制度&#xff0c;还得管理各种漏洞。在管理楼栋是&#xff0c;我相信大家都遇到过以下几个问题&#xff1a; …...

java实现两个不同对象的集合复制

场景&#xff1a; 我们开发中会遇到集合对象复制的场景&#xff0c;可以避免代码的重复编写 基于 com.alibaba.fastjson.JSON 实现对象集合的拷贝 对象定义&#xff1a;ObjectA属性&#xff1a;id&#xff0c;name&#xff0c;ageObjectB属性&#xff1a;id&#xff0c;name…...

bind failed: Address already in use

添加代码 这是个很常见的问题&#xff1a;在bind函数之前添加如下代码即可。 int yes 1; if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) -1) { perror("setsockopt"); exit(1); } 查看端口 如果还是不能结果&#xff0c;那么说…...

LabVIEW结构体内部缺陷振动检测

结构体内部缺陷会改变其振动特性&#xff0c;通过振动分析可以检测并定位这些缺陷。本文详细分析内部缺陷对振动的影响&#xff0c;从频谱分析、时域分析和模态分析等多角度探讨基于LabVIEW的检测方法&#xff0c;提供实施步骤和注意事项&#xff0c;帮助工程师有效利用LabVIEW…...

RK3568技术笔记六 新建 Ubuntu Linux 虚拟机

VMware 安装完成后&#xff0c;启动 VMware 软件。启动后在 VMware 主界面点击“创建新的虚拟机”。如下图所示&#xff1a; 开始对新建的虚拟机进行设置。选择“自定义”&#xff0c;然后点击“下一步”。如下图所示&#xff1a; 使用默认配置&#xff0c;单击“下一步”。如下…...

Web前端博客模板下载:一站式解决方案与深度探索

Web前端博客模板下载&#xff1a;一站式解决方案与深度探索 在当今数字化时代&#xff0c;拥有一个美观且功能强大的博客网站已成为许多人的追求。而Web前端博客模板作为构建博客网站的重要工具&#xff0c;其选择和下载对于实现这一目标至关重要。本文将从四个方面、五个方面…...

Docker部署常见应用之大数据实时计算引擎Flink

文章目录 Flink 简介Docker 部署Docker Compose 部署参考文章 Flink 简介 Apache Flink 是一个开源的分布式流批一体化的计算框架&#xff0c;它提供了一个流计算引擎&#xff0c;能够处理有界和无界的数据流。Flink 的核心优势在于其高吞吐量、低延迟的处理能力&#xff0c;以…...

python使用os.getcwd()获取当前路径不正确

# codinggbk import ostry:current_dir os.getcwd()#print(os.path.dirname(os.path.realpath(__file__)))#获取错误print("当前工作目录[不想要]&#xff1a;",current_dir)#获取真实文件夹路径print("当前工作目录[想要]&#xff1a;",os.path.dirname(…...

pycharm终端pip安装模块成功但还是显示找不到 ModuleNotFoundError: No module named

报错信息&#xff1a; ModuleNotFoundError: No module named 但是分明已经安装过此模块&#xff1a; 在cmd运行pip list 查看所有安装过的包找到了安装过&#xff1a; 如果重新安装就是这样&#xff1a;显示已经存在了 问题排查&#xff1a; 直接根据重新安装的显示已存在的…...

iptables教程

1 iptables安装 1.1 iptables和iptables-service的关系 iptables 是基于内核的&#xff0c;和 iptables-services 没有关系&#xff0c;不用安装任何工具包就可以使用 iptable 命令添加的防火墙规则&#xff0c; 但是iptables添加的规则是临时的&#xff0c;基于内存的&…...

破局外贸企业海外通邮难题,U-Mail邮件中继有绝招

在当今全球化的商业环境中&#xff0c;国内企业正扮演着越来越重要的角色&#xff0c;它们不仅在国内市场活跃&#xff0c;而且在全球范围内拓展业务&#xff0c;成为国际贸易中不可或缺的一部分。然而&#xff0c;尽管这些企业在业务扩展上取得了显著成就&#xff0c;但在与海…...

支持向量机(SVM): 从理论到实践的指南(2)

葡萄酒数据集经常被用于机器学习、模式识别和统计分类算法的测试中。由于其特征维度较高&#xff0c;非常适合于验证特征选择和降维方法&#xff0c;例如主成分分析&#xff08;PCA&#xff09;或线性判别分析&#xff08;LDA&#xff09;的效果。同时&#xff0c;由于数据集包…...

PDF格式分析(八十六)——修订注释(Redaction)

修订注释(PDF 1.7及其以上版本),该注释的做用是标识要从文档中删除的内容。 修订注释启用的步骤如下: 1、内容标识。PDF编辑器可指定应删除的文档内容片段或区域,在执行下一个步骤前,用户可以看到、移动和重新定义这些注释。 2、内容移除。PDF阅读器应删除修订注释指…...

【python】flask中Session忽然取不到存储内容怎么办?

尚未确定,后续更新,先别以此为准。 【背景】 用flask写的Web应用,运行不正常,查看原因,发现视图函数a中设定的session内容在视图函数b忽然拿不到了。 【分析】 这个应用在两个服务器间互相Hook,因此可能涉及跨域的问题。 视图函数a设置的session,再次从前端调用视图…...