123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?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.fdkankan.order.mapper.IOrderMapper">
- <resultMap id="resultMap" type="com.fdkankan.order.entity.Order">
- <id column="id" jdbcType="VARCHAR" property="id" />
- <result column="order_sn" jdbcType="VARCHAR" property="orderSn" />
- <result column="order_time" jdbcType="TIMESTAMP" property="orderTime" />
- <result column="trade_num" jdbcType="VARCHAR" property="tradeNum" />
- <result column="user_id" jdbcType="VARCHAR" property="userId" />
- <result column="goods_total_count" jdbcType="INTEGER" property="goodsTotalCount" />
- <result column="goods_amount" jdbcType="DECIMAL" property="goodsAmount" />
- <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
- <result column="order_status" jdbcType="VARCHAR" property="orderStatus" />
- <result column="payment_status" jdbcType="VARCHAR" property="paymentStatus" />
- <result column="shipping_status" jdbcType="VARCHAR" property="shippingStatus" />
- <result column="paid_amount" jdbcType="DECIMAL" property="paidAmount" />
- <result column="payment_type_name" jdbcType="INTEGER" property="paymentTypeName" />
- <result column="express_amount" jdbcType="DECIMAL" property="expressAmount" />
- <result column="delivery_type_name" jdbcType="VARCHAR" property="deliveryTypeName" />
- <result column="ship_address" jdbcType="VARCHAR" property="shipAddress" />
- <result column="ship_area" jdbcType="VARCHAR" property="shipArea" />
- <result column="ship_area_path" jdbcType="VARCHAR" property="shipAreaPath" />
- <result column="ship_mobile" jdbcType="VARCHAR" property="shipMobile" />
- <result column="ship_name" jdbcType="VARCHAR" property="shipName" />
- <result column="ship_phone" jdbcType="VARCHAR" property="shipPhone" />
- <result column="ship_zip_code" jdbcType="VARCHAR" property="shipZipCode" />
- <result column="finish_time" jdbcType="TIMESTAMP" property="finishTime" />
- <result column="memo" jdbcType="VARCHAR" property="memo" />
- <result column="comment" jdbcType="VARCHAR" property="comment" />
- <result column="abroad" jdbcType="INTEGER" property="abroad" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="rec_status" jdbcType="VARCHAR" property="recStatus" />
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="tb_status" jdbcType="INTEGER" property="tbStatus" />
- </resultMap>
- <sql id="columnList">
- id,order_sn,order_time,trade_num,user_id,goods_total_count,goods_amount,total_amount,order_status,payment_status,shipping_status,paid_amount,payment_type_name,express_amount,delivery_type_name,ship_address,ship_area,ship_area_path,ship_mobile,ship_name,ship_phone,ship_zip_code,finish_time,memo,comment,abroad,create_time,rec_status,update_time,tb_status </sql>
- <insert id="insert" useGeneratedKeys="true" keyProperty="entity.id">
- INSERT INTO ${tableName} (
- order_sn, order_time, trade_num, user_id, goods_total_count, goods_amount, total_amount, order_status, payment_status, shipping_status, paid_amount, payment_type_name, express_amount, delivery_type_name, ship_address, ship_area, ship_area_path, ship_mobile, ship_name, ship_phone, ship_zip_code, finish_time, memo, comment, abroad, rec_status
- ) VALUES (
- #{entity.orderSn}, #{entity.orderTime}, #{entity.tradeNum}, #{entity.userId}, #{entity.goodsTotalCount}, #{entity.goodsAmount}, #{entity.totalAmount}, #{entity.orderStatus}, #{entity.paymentStatus}, #{entity.shippingStatus}, #{entity.paidAmount}, #{entity.paymentTypeName}, #{entity.expressAmount}, #{entity.deliveryTypeName}, #{entity.shipAddress}, #{entity.shipArea}, #{entity.shipAreaPath}, #{entity.shipMobile}, #{entity.shipName}, #{entity.shipPhone}, #{entity.shipZipCode}, #{entity.finishTime}, #{entity.memo}, #{entity.comment}, #{entity.abroad}, #{entity.recStatus}
- ) </insert>
- <insert id="insertByBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" >
- INSERT INTO ${tableName} (
- order_sn, order_time, trade_num, user_id, goods_total_count, goods_amount, total_amount, order_status, payment_status, shipping_status, paid_amount, payment_type_name, express_amount, delivery_type_name, ship_address, ship_area, ship_area_path, ship_mobile, ship_name, ship_phone, ship_zip_code, finish_time, memo, comment, abroad, rec_status
- ) VALUES
- <foreach collection="list" item="entity" index="index" separator=",">
- (#{entity.orderSn}, #{entity.orderTime}, #{entity.tradeNum}, #{entity.userId}, #{entity.goodsTotalCount}, #{entity.goodsAmount}, #{entity.totalAmount}, #{entity.orderStatus}, #{entity.paymentStatus}, #{entity.shippingStatus}, #{entity.paidAmount}, #{entity.paymentTypeName}, #{entity.expressAmount}, #{entity.deliveryTypeName}, #{entity.shipAddress}, #{entity.shipArea}, #{entity.shipAreaPath}, #{entity.shipMobile}, #{entity.shipName}, #{entity.shipPhone}, #{entity.shipZipCode}, #{entity.finishTime}, #{entity.memo}, #{entity.comment}, #{entity.abroad}, #{entity.recStatus})
- </foreach>
- </insert>
- <update id="update" parameterType="java.util.List" >
- <foreach collection="list" item="entity" index="index" separator=";">
- UPDATE ${tableName} SET
- order_sn=#{entity.orderSn}, order_time=#{entity.orderTime}, trade_num=#{entity.tradeNum}, user_id=#{entity.userId}, goods_total_count=#{entity.goodsTotalCount}, goods_amount=#{entity.goodsAmount}, total_amount=#{entity.totalAmount}, order_status=#{entity.orderStatus}, payment_status=#{entity.paymentStatus}, shipping_status=#{entity.shippingStatus}, paid_amount=#{entity.paidAmount}, payment_type_name=#{entity.paymentTypeName}, express_amount=#{entity.expressAmount}, delivery_type_name=#{entity.deliveryTypeName}, ship_address=#{entity.shipAddress}, ship_area=#{entity.shipArea}, ship_area_path=#{entity.shipAreaPath}, ship_mobile=#{entity.shipMobile}, ship_name=#{entity.shipName}, ship_phone=#{entity.shipPhone}, ship_zip_code=#{entity.shipZipCode}, finish_time=#{entity.finishTime}, memo=#{entity.memo}, comment=#{entity.comment}, abroad=#{entity.abroad}, rec_status=#{entity.recStatus}, tb_status=#{entity.tbStatus}
- WHERE
- id = #{entity.id}
- </foreach>
- </update>
- <update id="updateByBatch" >
- UPDATE ${tableName} SET
- ${field}
- <where>
- <foreach collection="condition" index="key" item="value">
- ${value} ${key}
- </foreach>
- </where>
- </update>
- <select id="getById" parameterType="java.lang.Integer" resultMap="resultMap">
- select
- <include refid="columnList" />
- from ${tableName}
- where id = #{id}
- </select>
- <select id="getOne" parameterType="java.util.Map" resultMap="resultMap">
- select
- <if test="field == null">
- <include refid="columnList" />
- </if>
- <if test="field != null">
- ${field}
- </if>
- from ${tableName}
- <where>
- <foreach collection="condition" index="key" item="value">
- ${value} ${key}
- </foreach>
- </where>
- limit 1;
- </select>
- <select id="getCount" parameterType="java.util.Map" resultType="java.lang.Integer">
- select
- count(id)
- from ${tableName}
- <where>
- <foreach collection="condition" index="key" item="value">
- ${value} ${key}
- </foreach>
- </where>
- </select>
- <!-- 这部分为根据传递参数,自动生成SQL -->
- <select id="getList" parameterType="java.util.Map" resultMap="resultMap">
- select
- <if test="field == null">
- <include refid="columnList" />
- </if>
- <if test="field != null">
- ${field}
- </if>
- from ${tableName}
- <where>
- <foreach collection="condition" index="key" item="value">
- ${value} ${key}
- </foreach>
- </where>
- <if test="order != null">
- order by ${order}
- </if>
- <if test="limit != 0">
- <if test="offset != 0">
- limit ${offset}, ${limit}
- </if>
- <if test="offset == 0">
- limit ${limit}
- </if>
- </if>
- </select>
- <!-- 判断表格是否存在,如果不存在可以配合createTable使用,用于动态创建表格 -->
- <select id="existTable" parameterType="String" resultType="java.lang.Integer">
- select count(table_name) from information_schema.TABLES WHERE table_name=#{tableName} ;
- </select>
- <update id="createTable" parameterType="String">
- <!-- 这里是创建表格的SQL,复制过来,表名作为参数传递 -->
- <!-- create table ${tableName} ( // 表名要这样写 -->
- </update>
- </mapper>
|