您的位置:首页 > 游戏 > 手游 > # RocketMQ 实战:模拟电商网站场景综合案例(五)

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

2024/12/23 9:59:36 来源:https://blog.csdn.net/qfyh_djh/article/details/139573754  浏览:    关键词:# 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 实战:模拟电商网站场景综合案例(四)

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com