<?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.ssm.manage.mapper.RecordsTradesMapper">

    <resultMap type="com.ssm.manage.entity.RecordsTrades" id=" recordsTradesMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="type" column="type" jdbcType="INTEGER"/>
        <result property="state" column="state" jdbcType="INTEGER"/>
        <result property="orderNum" column="order_num" jdbcType="VARCHAR"/>
        <result property="orderId" column="order_id" jdbcType="INTEGER"/>
        <result property="orderDate" column="order_date" jdbcType="TIMESTAMP"/>
        <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
        <result property="operatorsName" column="operators_name" jdbcType="VARCHAR"/>
        <result property="operatorsNumber" column="operators_number" jdbcType="VARCHAR"/>
        <result property="operatorsId" column="operators_id" jdbcType="INTEGER"/>
        <result property="storeId" column="store_id" jdbcType="INTEGER"/>
        <result property="storeNum" column="store_num" jdbcType="VARCHAR"/>
        <result property="storeName" column="store_name" jdbcType="VARCHAR"/>
        <result property="num" column="num" jdbcType="VARCHAR"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="price" column="price" jdbcType="NUMERIC"/>
        <result property="numbers" column="numbers" jdbcType="INTEGER"/>
        <result property="amount" column="amount" jdbcType="NUMERIC"/>
        <result property="owed" column="owed" jdbcType="NUMERIC"/>
    </resultMap>

<!--    &lt;!&ndash;查询单个&ndash;&gt;-->
<!--    <select id="queryById" resultMap=" recordsTradesMap">-->
<!--        select-->
<!--          id, type, state, order_num, order_id, order_date, update_date, operators_name, operators_number, operators_id, store_id, store_num, store_name, num, name, price, numbers, amount, owed-->
<!--        from  records_trades-->
<!--        where id = #{id}-->
<!--    </select>-->

<!--    &lt;!&ndash;查询指定行数据&ndash;&gt;-->
<!--    <select id="queryAllByLimit" resultMap=" recordsTradesMap">-->
<!--        select-->
<!--          id, type, state, order_num, order_id, order_date, update_date, operators_name, operators_number, operators_id, store_id, store_num, store_name, num, name, price, numbers, amount, owed-->
<!--        from  records_trades-->
<!--        <where>-->
<!--            <if test="id != null">-->
<!--                and id = #{id}-->
<!--            </if>-->
<!--            <if test="type != null">-->
<!--                and type = #{type}-->
<!--            </if>-->
<!--            <if test="state != null">-->
<!--                and state = #{state}-->
<!--            </if>-->
<!--            <if test="orderNum != null and orderNum != ''">-->
<!--                and order_num = #{orderNum}-->
<!--            </if>-->
<!--            <if test="orderId != null">-->
<!--                and order_id = #{orderId}-->
<!--            </if>-->
<!--            <if test="orderDate != null">-->
<!--                and order_date = #{orderDate}-->
<!--            </if>-->
<!--            <if test="updateDate != null">-->
<!--                and update_date = #{updateDate}-->
<!--            </if>-->
<!--            <if test="operatorsName != null and operatorsName != ''">-->
<!--                and operators_name = #{operatorsName}-->
<!--            </if>-->
<!--            <if test="operatorsNumber != null and operatorsNumber != ''">-->
<!--                and operators_number = #{operatorsNumber}-->
<!--            </if>-->
<!--            <if test="operatorsId != null">-->
<!--                and operators_id = #{operatorsId}-->
<!--            </if>-->
<!--            <if test="storeId != null">-->
<!--                and store_id = #{storeId}-->
<!--            </if>-->
<!--            <if test="storeNum != null and storeNum != ''">-->
<!--                and store_num = #{storeNum}-->
<!--            </if>-->
<!--            <if test="storeName != null and storeName != ''">-->
<!--                and store_name = #{storeName}-->
<!--            </if>-->
<!--            <if test="num != null and num != ''">-->
<!--                and num = #{num}-->
<!--            </if>-->
<!--            <if test="name != null and name != ''">-->
<!--                and name = #{name}-->
<!--            </if>-->
<!--            <if test="price != null">-->
<!--                and price = #{price}-->
<!--            </if>-->
<!--            <if test="numbers != null">-->
<!--                and numbers = #{numbers}-->
<!--            </if>-->
<!--            <if test="amount != null">-->
<!--                and amount = #{amount}-->
<!--            </if>-->
<!--            <if test="owed != null">-->
<!--                and owed = #{owed}-->
<!--            </if>-->
<!--        </where>-->
<!--        limit #{pageable.offset}, #{pageable.pageSize}-->
<!--    </select>-->

<!--    &lt;!&ndash;统计总行数&ndash;&gt;-->
<!--    <select id="count" resultType="java.lang.Long">-->
<!--        select count(1)-->
<!--        from  records_trades-->
<!--        <where>-->
<!--            <if test="id != null">-->
<!--                and id = #{id}-->
<!--            </if>-->
<!--            <if test="type != null">-->
<!--                and type = #{type}-->
<!--            </if>-->
<!--            <if test="state != null">-->
<!--                and state = #{state}-->
<!--            </if>-->
<!--            <if test="orderNum != null and orderNum != ''">-->
<!--                and order_num = #{orderNum}-->
<!--            </if>-->
<!--            <if test="orderId != null">-->
<!--                and order_id = #{orderId}-->
<!--            </if>-->
<!--            <if test="orderDate != null">-->
<!--                and order_date = #{orderDate}-->
<!--            </if>-->
<!--            <if test="updateDate != null">-->
<!--                and update_date = #{updateDate}-->
<!--            </if>-->
<!--            <if test="operatorsName != null and operatorsName != ''">-->
<!--                and operators_name = #{operatorsName}-->
<!--            </if>-->
<!--            <if test="operatorsNumber != null and operatorsNumber != ''">-->
<!--                and operators_number = #{operatorsNumber}-->
<!--            </if>-->
<!--            <if test="operatorsId != null">-->
<!--                and operators_id = #{operatorsId}-->
<!--            </if>-->
<!--            <if test="storeId != null">-->
<!--                and store_id = #{storeId}-->
<!--            </if>-->
<!--            <if test="storeNum != null and storeNum != ''">-->
<!--                and store_num = #{storeNum}-->
<!--            </if>-->
<!--            <if test="storeName != null and storeName != ''">-->
<!--                and store_name = #{storeName}-->
<!--            </if>-->
<!--            <if test="num != null and num != ''">-->
<!--                and num = #{num}-->
<!--            </if>-->
<!--            <if test="name != null and name != ''">-->
<!--                and name = #{name}-->
<!--            </if>-->
<!--            <if test="price != null">-->
<!--                and price = #{price}-->
<!--            </if>-->
<!--            <if test="numbers != null">-->
<!--                and numbers = #{numbers}-->
<!--            </if>-->
<!--            <if test="amount != null">-->
<!--                and amount = #{amount}-->
<!--            </if>-->
<!--            <if test="owed != null">-->
<!--                and owed = #{owed}-->
<!--            </if>-->
<!--        </where>-->
<!--    </select>-->

<!--    &lt;!&ndash;新增所有列&ndash;&gt;-->
<!--    <insert id="insert" keyProperty="id" useGeneratedKeys="true">-->
<!--        insert into  records_trades(type, state, order_num, order_id, order_date, update_date, operators_name, operators_number, operators_id, store_id, store_num, store_name, num, name, price, numbers, amount, owed)-->
<!--        values (#{type}, #{state}, #{orderNum}, #{orderId}, #{orderDate}, #{updateDate}, #{operatorsName}, #{operatorsNumber}, #{operatorsId}, #{storeId}, #{storeNum}, #{storeName}, #{num}, #{name}, #{price}, #{numbers}, #{amount}, #{owed})-->
<!--    </insert>-->

<!--    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">-->
<!--        insert into  records_trades(type, state, order_num, order_id, order_date, update_date, operators_name, operators_number, operators_id, store_id, store_num, store_name, num, name, price, numbers, amount, owed)-->
<!--        values-->
<!--        <foreach collection="entities" item="entity" separator=",">-->
<!--        (#{entity.type}, #{entity.state}, #{entity.orderNum}, #{entity.orderId}, #{entity.orderDate}, #{entity.updateDate}, #{entity.operatorsName}, #{entity.operatorsNumber}, #{entity.operatorsId}, #{entity.storeId}, #{entity.storeNum}, #{entity.storeName}, #{entity.num}, #{entity.name}, #{entity.price}, #{entity.numbers}, #{entity.amount}, #{entity.owed})-->
<!--        </foreach>-->
<!--    </insert>-->

<!--    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">-->
<!--        insert into  records_trades(type, state, order_num, order_id, order_date, update_date, operators_name, operators_number, operators_id, store_id, store_num, store_name, num, name, price, numbers, amount, owed)-->
<!--        values-->
<!--        <foreach collection="entities" item="entity" separator=",">-->
<!--            (#{entity.type}, #{entity.state}, #{entity.orderNum}, #{entity.orderId}, #{entity.orderDate}, #{entity.updateDate}, #{entity.operatorsName}, #{entity.operatorsNumber}, #{entity.operatorsId}, #{entity.storeId}, #{entity.storeNum}, #{entity.storeName}, #{entity.num}, #{entity.name}, #{entity.price}, #{entity.numbers}, #{entity.amount}, #{entity.owed})-->
<!--        </foreach>-->
<!--        on duplicate key update-->
<!--        type = values(type),-->
<!--        state = values(state),-->
<!--        order_num = values(order_num),-->
<!--        order_id = values(order_id),-->
<!--        order_date = values(order_date),-->
<!--        update_date = values(update_date),-->
<!--        operators_name = values(operators_name),-->
<!--        operators_number = values(operators_number),-->
<!--        operators_id = values(operators_id),-->
<!--        store_id = values(store_id),-->
<!--        store_num = values(store_num),-->
<!--        store_name = values(store_name),-->
<!--        num = values(num),-->
<!--        name = values(name),-->
<!--        price = values(price),-->
<!--        numbers = values(numbers),-->
<!--        amount = values(amount),-->
<!--        owed = values(owed)-->
<!--    </insert>-->

<!--    &lt;!&ndash;通过主键修改数据&ndash;&gt;-->
<!--    <update id="update">-->
<!--        update  records_trades-->
<!--        <set>-->
<!--            <if test="type != null">-->
<!--                type = #{type},-->
<!--            </if>-->
<!--            <if test="state != null">-->
<!--                state = #{state},-->
<!--            </if>-->
<!--            <if test="orderNum != null and orderNum != ''">-->
<!--                order_num = #{orderNum},-->
<!--            </if>-->
<!--            <if test="orderId != null">-->
<!--                order_id = #{orderId},-->
<!--            </if>-->
<!--            <if test="orderDate != null">-->
<!--                order_date = #{orderDate},-->
<!--            </if>-->
<!--            <if test="updateDate != null">-->
<!--                update_date = #{updateDate},-->
<!--            </if>-->
<!--            <if test="operatorsName != null and operatorsName != ''">-->
<!--                operators_name = #{operatorsName},-->
<!--            </if>-->
<!--            <if test="operatorsNumber != null and operatorsNumber != ''">-->
<!--                operators_number = #{operatorsNumber},-->
<!--            </if>-->
<!--            <if test="operatorsId != null">-->
<!--                operators_id = #{operatorsId},-->
<!--            </if>-->
<!--            <if test="storeId != null">-->
<!--                store_id = #{storeId},-->
<!--            </if>-->
<!--            <if test="storeNum != null and storeNum != ''">-->
<!--                store_num = #{storeNum},-->
<!--            </if>-->
<!--            <if test="storeName != null and storeName != ''">-->
<!--                store_name = #{storeName},-->
<!--            </if>-->
<!--            <if test="num != null and num != ''">-->
<!--                num = #{num},-->
<!--            </if>-->
<!--            <if test="name != null and name != ''">-->
<!--                name = #{name},-->
<!--            </if>-->
<!--            <if test="price != null">-->
<!--                price = #{price},-->
<!--            </if>-->
<!--            <if test="numbers != null">-->
<!--                numbers = #{numbers},-->
<!--            </if>-->
<!--            <if test="amount != null">-->
<!--                amount = #{amount},-->
<!--            </if>-->
<!--            <if test="owed != null">-->
<!--                owed = #{owed},-->
<!--            </if>-->
<!--        </set>-->
<!--        where id = #{id}-->
<!--    </update>-->

<!--    &lt;!&ndash;通过主键删除&ndash;&gt;-->
<!--    <delete id="deleteById">-->
<!--        delete from  records_trades where id = #{id}-->
<!--    </delete>-->

</mapper>

