123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?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.IInvoiceMapper">
- <resultMap id="resultMap" type="com.fdkankan.order.entity.Invoice">
- <id column="id" jdbcType="VARCHAR" property="id" />
- <result column="order_id" jdbcType="VARCHAR" property="orderId" />
- <result column="virtual_order_id" jdbcType="VARCHAR" property="virtualOrderId" />
- <result column="increment_order_id" jdbcType="VARCHAR" property="incrementOrderId" />
- <result column="user_id" jdbcType="VARCHAR" property="userId" />
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="code" jdbcType="VARCHAR" property="code" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="organized_name" jdbcType="VARCHAR" property="organizedName" />
- <result column="organized_address" jdbcType="VARCHAR" property="organizedAddress" />
- <result column="register_phone" jdbcType="VARCHAR" property="registerPhone" />
- <result column="bank_name" jdbcType="VARCHAR" property="bankName" />
- <result column="bank_account" jdbcType="VARCHAR" property="bankAccount" />
- <result column="consume_type" jdbcType="INTEGER" property="consumeType" />
- <result column="money" jdbcType="DECIMAL" property="money" />
- <result column="camera_id" jdbcType="VARCHAR" property="cameraId" />
- <result column="finish" jdbcType="INTEGER" property="finish" />
- <result column="email_address" jdbcType="VARCHAR" property="emailAddress" />
- <result column="rec_status" jdbcType="VARCHAR" property="recStatus" />
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
- <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="send" jdbcType="INTEGER" property="send" />
- <result column="express_company" jdbcType="VARCHAR" property="expressCompany" />
- <result column="express_number" jdbcType="VARCHAR" property="expressNumber" />
- <result column="e_invoice" jdbcType="VARCHAR" property="eInvoice" />
- <result column="remarks" jdbcType="LONGVARCHAR" property="remarks" />
- <result column="download_order_id" jdbcType="VARCHAR" property="downloadOrderId" />
- <result column="tb_status" jdbcType="INTEGER" property="tbStatus" />
- </resultMap>
- <sql id="columnList">
- id,order_id,virtual_order_id,increment_order_id,user_id,type,title,code,create_time,organized_name,organized_address,register_phone,bank_name,bank_account,consume_type,money,camera_id,finish,email_address,rec_status,update_time,ship_address,ship_area,ship_area_path,ship_mobile,ship_name,ship_phone,ship_zip_code,send,express_company,express_number,e_invoice,remarks,download_order_id,tb_status </sql>
- <insert id="insert" useGeneratedKeys="true" keyProperty="entity.id">
- INSERT INTO ${tableName} (
- order_id, virtual_order_id, increment_order_id, user_id, type, title, code, organized_name, organized_address, register_phone, bank_name, bank_account, consume_type, money, camera_id, finish, email_address, rec_status, ship_address, ship_area, ship_area_path, ship_mobile, ship_name, ship_phone, ship_zip_code, send, express_company, express_number, e_invoice, remarks, download_order_id
- ) VALUES (
- #{entity.orderId}, #{entity.virtualOrderId}, #{entity.incrementOrderId}, #{entity.userId}, #{entity.type}, #{entity.title}, #{entity.code}, #{entity.organizedName}, #{entity.organizedAddress}, #{entity.registerPhone}, #{entity.bankName}, #{entity.bankAccount}, #{entity.consumeType}, #{entity.money}, #{entity.cameraId}, #{entity.finish}, #{entity.emailAddress}, #{entity.recStatus}, #{entity.shipAddress}, #{entity.shipArea}, #{entity.shipAreaPath}, #{entity.shipMobile}, #{entity.shipName}, #{entity.shipPhone}, #{entity.shipZipCode}, #{entity.send}, #{entity.expressCompany}, #{entity.expressNumber}, #{entity.eInvoice}, #{entity.remarks}, #{entity.downloadOrderId}
- ) </insert>
- <insert id="insertByBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" >
- INSERT INTO ${tableName} (
- order_id, virtual_order_id, increment_order_id, user_id, type, title, code, organized_name, organized_address, register_phone, bank_name, bank_account, consume_type, money, camera_id, finish, email_address, rec_status, ship_address, ship_area, ship_area_path, ship_mobile, ship_name, ship_phone, ship_zip_code, send, express_company, express_number, e_invoice, remarks, download_order_id
- ) VALUES
- <foreach collection="list" item="entity" index="index" separator=",">
- (#{entity.orderId}, #{entity.virtualOrderId}, #{entity.incrementOrderId}, #{entity.userId}, #{entity.type}, #{entity.title}, #{entity.code}, #{entity.organizedName}, #{entity.organizedAddress}, #{entity.registerPhone}, #{entity.bankName}, #{entity.bankAccount}, #{entity.consumeType}, #{entity.money}, #{entity.cameraId}, #{entity.finish}, #{entity.emailAddress}, #{entity.recStatus}, #{entity.shipAddress}, #{entity.shipArea}, #{entity.shipAreaPath}, #{entity.shipMobile}, #{entity.shipName}, #{entity.shipPhone}, #{entity.shipZipCode}, #{entity.send}, #{entity.expressCompany}, #{entity.expressNumber}, #{entity.eInvoice}, #{entity.remarks}, #{entity.downloadOrderId})
- </foreach>
- </insert>
- <update id="update" parameterType="java.util.List" >
- <foreach collection="list" item="entity" index="index" separator=";">
- UPDATE ${tableName} SET
- order_id=#{entity.orderId}, virtual_order_id=#{entity.virtualOrderId}, increment_order_id=#{entity.incrementOrderId}, user_id=#{entity.userId}, type=#{entity.type}, title=#{entity.title}, code=#{entity.code}, organized_name=#{entity.organizedName}, organized_address=#{entity.organizedAddress}, register_phone=#{entity.registerPhone}, bank_name=#{entity.bankName}, bank_account=#{entity.bankAccount}, consume_type=#{entity.consumeType}, money=#{entity.money}, camera_id=#{entity.cameraId}, finish=#{entity.finish}, email_address=#{entity.emailAddress}, rec_status=#{entity.recStatus}, 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}, send=#{entity.send}, express_company=#{entity.expressCompany}, express_number=#{entity.expressNumber}, e_invoice=#{entity.eInvoice}, remarks=#{entity.remarks}, download_order_id=#{entity.downloadOrderId}, 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>
|