# 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 实战:模拟电商网站场景综合案例(五) 一、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的区别: 优化:Debug版本通常不进行优化,以便更容易调试;Release版本则经过高度优化,以提高性能。调试信息:Debug版本包含详尽的调试信息,如符号信息和源代码映射;Rel…...

DevExpress 控件和库
UI控件和组件 DevExpress WinForms包括以下Windows窗体库和控件: 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: 电气与电子工程师协会,其中IEEE802.3工作小组致力于推进以太网相关标准的制定与完善,其发展主要经过一下三个阶段: 1.诊断/程序更新 2.智驾座舱 3.主干网 二、车载以太网协议(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…...

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

【全开源】Java无人共享棋牌室茶室台球室系统JAVA版本支持微信小程序+微信公众号
无人共享棋牌室系统——棋牌娱乐新体验 🎲引言 随着科技的不断发展,传统棋牌室正逐渐迈向智能化、无人化。今天,我要为大家介绍的就是这款引领潮流的“无人共享棋牌室系统”。它不仅为棋牌爱好者提供了全新的娱乐体验,更在便捷性…...
2024-6-10-zero shot,few shot以及无监督学习之间的关系是什么
Zero-shot learning、few-shot learning和无监督学习都是机器学习中的方法,它们共同的特点是在有限或没有标签数据的情况下进行学习。下面是这三种方法之间的关系和区别: Zero-shot Learning (零样本学习): 零样本学习是在模型训练过程中完全…...

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

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

Golang:使用时会遇到的错误及解决方法详解
Go语言使用时常常会遇到的一些错误及解决方法,文中的示例代码讲解详细,感兴趣的小伙伴可以了解一下 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 年的全球经济危机深刻改变了世界经济格局,引发了一系列连锁反应,波及各大洲。经济增长停滞不前,甚至在某些情况下出现负增长,给出口导向型发展中国家带来了不确定性。实体经济受到的冲击尤为严重,生…...

解决使用Jmeter进行测试时出现“302“,‘‘401“等用户未登录的问题
使用 JMeter 压力测试时解决登录问题的两种方法 在使用 JMeter 进行压力测试时,可能会遇程序存在安全验证,必须登录后才能对里面的具体方法进行测试: 如果遇到登录问题,通常是因为 JMeter 无法模拟用户的登录状态,导…...
MySql通过 Procedure 循环删除数据
一、问题描述 在日常使用运维中,一些特殊情况需要批量删除陈旧或异常数据。 如果通过 delete from 【表名】 where 【条件】 直接删除,可能会由于数据量过大,事务执行时间过长,造成死锁。 二、解决方案 通过 Procedure 使用循环…...
Spring Boot 的启动原理、Spring Boot 自动配置原理
Spring Boot启动原理包含自动装配原理。 Spring Boot 的启动原理: 1. 入口类与 SpringApplication 初始化: 应用程序通常从一个带有 SpringBootApplication 注解的主类开始,这个注解是一个组合注解,包含了 SpringBootConfigurat…...

不会开发的你也能管理好企业漏洞,开源免费工具:洞察(insight II)
公司刚开始建设安全管理时,都是从一片混沌开始的,资源总是不够的,我们每个做安全的人员,又要会渗透,又要抓制度,还得管理各种漏洞。在管理楼栋是,我相信大家都遇到过以下几个问题: …...
java实现两个不同对象的集合复制
场景: 我们开发中会遇到集合对象复制的场景,可以避免代码的重复编写 基于 com.alibaba.fastjson.JSON 实现对象集合的拷贝 对象定义:ObjectA属性:id,name,ageObjectB属性:id,name…...
bind failed: Address already in use
添加代码 这是个很常见的问题:在bind函数之前添加如下代码即可。 int yes 1; if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) -1) { perror("setsockopt"); exit(1); } 查看端口 如果还是不能结果,那么说…...

LabVIEW结构体内部缺陷振动检测
结构体内部缺陷会改变其振动特性,通过振动分析可以检测并定位这些缺陷。本文详细分析内部缺陷对振动的影响,从频谱分析、时域分析和模态分析等多角度探讨基于LabVIEW的检测方法,提供实施步骤和注意事项,帮助工程师有效利用LabVIEW…...
浅谈 React Hooks
React Hooks 是 React 16.8 引入的一组 API,用于在函数组件中使用 state 和其他 React 特性(例如生命周期方法、context 等)。Hooks 通过简洁的函数接口,解决了状态与 UI 的高度解耦,通过函数式编程范式实现更灵活 Rea…...
web vue 项目 Docker化部署
Web 项目 Docker 化部署详细教程 目录 Web 项目 Docker 化部署概述Dockerfile 详解 构建阶段生产阶段 构建和运行 Docker 镜像 1. Web 项目 Docker 化部署概述 Docker 化部署的主要步骤分为以下几个阶段: 构建阶段(Build Stage):…...

Prompt Tuning、P-Tuning、Prefix Tuning的区别
一、Prompt Tuning、P-Tuning、Prefix Tuning的区别 1. Prompt Tuning(提示调优) 核心思想:固定预训练模型参数,仅学习额外的连续提示向量(通常是嵌入层的一部分)。实现方式:在输入文本前添加可训练的连续向量(软提示),模型只更新这些提示参数。优势:参数量少(仅提…...
pam_env.so模块配置解析
在PAM(Pluggable Authentication Modules)配置中, /etc/pam.d/su 文件相关配置含义如下: 配置解析 auth required pam_env.so1. 字段分解 字段值说明模块类型auth认证类模块,负责验证用户身份&am…...

SpringBoot+uniapp 的 Champion 俱乐部微信小程序设计与实现,论文初版实现
摘要 本论文旨在设计并实现基于 SpringBoot 和 uniapp 的 Champion 俱乐部微信小程序,以满足俱乐部线上活动推广、会员管理、社交互动等需求。通过 SpringBoot 搭建后端服务,提供稳定高效的数据处理与业务逻辑支持;利用 uniapp 实现跨平台前…...
【android bluetooth 框架分析 04】【bt-framework 层详解 1】【BluetoothProperties介绍】
1. BluetoothProperties介绍 libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop BluetoothProperties.sysprop 是 Android AOSP 中的一种 系统属性定义文件(System Property Definition File),用于声明和管理 Bluetooth 模块相…...
【Web 进阶篇】优雅的接口设计:统一响应、全局异常处理与参数校验
系列回顾: 在上一篇中,我们成功地为应用集成了数据库,并使用 Spring Data JPA 实现了基本的 CRUD API。我们的应用现在能“记忆”数据了!但是,如果你仔细审视那些 API,会发现它们还很“粗糙”:有…...
浅谈不同二分算法的查找情况
二分算法原理比较简单,但是实际的算法模板却有很多,这一切都源于二分查找问题中的复杂情况和二分算法的边界处理,以下是博主对一些二分算法查找的情况分析。 需要说明的是,以下二分算法都是基于有序序列为升序有序的情况…...
08. C#入门系列【类的基本概念】:开启编程世界的奇妙冒险
C#入门系列【类的基本概念】:开启编程世界的奇妙冒险 嘿,各位编程小白探险家!欢迎来到 C# 的奇幻大陆!今天咱们要深入探索这片大陆上至关重要的 “建筑”—— 类!别害怕,跟着我,保准让你轻松搞…...

[论文阅读]TrustRAG: Enhancing Robustness and Trustworthiness in RAG
TrustRAG: Enhancing Robustness and Trustworthiness in RAG [2501.00879] TrustRAG: Enhancing Robustness and Trustworthiness in Retrieval-Augmented Generation 代码:HuichiZhou/TrustRAG: Code for "TrustRAG: Enhancing Robustness and Trustworthin…...