143 lines
6.6 KiB
XML
143 lines
6.6 KiB
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.xhpc.invoice.mapper.XhpcInvoiceMapHistoryOrderMapper">
|
||
|
|
<resultMap id="BaseResultMap" type="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder">
|
||
|
|
<result column="invoice_id" jdbcType="BIGINT" property="invoiceId"/>
|
||
|
|
<result column="history_order_id" jdbcType="BIGINT" property="historyOrderId"/>
|
||
|
|
<result column="history_user_id" jdbcType="BIGINT" property="historyUserId"/>
|
||
|
|
<result column="history_user_type" jdbcType="BIGINT" property="historyUserType"/>
|
||
|
|
<result column="hisotry_serial_number" jdbcType="VARCHAR" property="hisotrySerialNumber"/>
|
||
|
|
<result column="power_price_total" jdbcType="DECIMAL" property="powerPriceTotal"/>
|
||
|
|
<result column="service_price_total" jdbcType="DECIMAL" property="servicePriceTotal"/>
|
||
|
|
<result column="promotion_discount" jdbcType="DECIMAL" property="promotionDiscount"/>
|
||
|
|
<result column="history_act_price" jdbcType="DECIMAL" property="historyActPrice"/>
|
||
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||
|
|
<result column="charging_mode" jdbcType="VARCHAR" property="chargingMode"/>
|
||
|
|
<result column="charging_station_id" jdbcType="BIGINT" property="chargingStationId"/>
|
||
|
|
<result column="terminal_id" jdbcType="BIGINT" property="terminalId"/>
|
||
|
|
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
|
||
|
|
</resultMap>
|
||
|
|
<insert id="insert" parameterType="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder">
|
||
|
|
insert into xhpc_invoice_map_history_order (invoice_id, history_order_id, history_user_id,
|
||
|
|
history_user_type, hisotry_serial_number, power_price_total,
|
||
|
|
service_price_total, promotion_discount, history_act_price,
|
||
|
|
create_time, charging_mode, charging_station_id,
|
||
|
|
terminal_id, del_flag)
|
||
|
|
values (#{invoiceId,jdbcType=BIGINT}, #{historyOrderId,jdbcType=BIGINT}, #{historyUserId,jdbcType=BIGINT},
|
||
|
|
#{historyUserType,jdbcType=BIGINT}, #{hisotrySerialNumber,jdbcType=VARCHAR},
|
||
|
|
#{powerPriceTotal,jdbcType=DECIMAL},
|
||
|
|
#{servicePriceTotal,jdbcType=DECIMAL}, #{promotionDiscount,jdbcType=DECIMAL},
|
||
|
|
#{historyActPrice,jdbcType=DECIMAL},
|
||
|
|
#{createTime,jdbcType=TIMESTAMP}, #{chargingMode,jdbcType=VARCHAR},
|
||
|
|
#{chargingStationId,jdbcType=BIGINT},
|
||
|
|
#{terminalId,jdbcType=BIGINT}, #{delFlag,jdbcType=INTEGER})
|
||
|
|
</insert>
|
||
|
|
<insert id="insertSelective" parameterType="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder">
|
||
|
|
insert into xhpc_invoice_map_history_order
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="invoiceId != null">
|
||
|
|
invoice_id,
|
||
|
|
</if>
|
||
|
|
<if test="historyOrderId != null">
|
||
|
|
history_order_id,
|
||
|
|
</if>
|
||
|
|
<if test="historyUserId != null">
|
||
|
|
history_user_id,
|
||
|
|
</if>
|
||
|
|
<if test="historyUserType != null">
|
||
|
|
history_user_type,
|
||
|
|
</if>
|
||
|
|
<if test="hisotrySerialNumber != null">
|
||
|
|
hisotry_serial_number,
|
||
|
|
</if>
|
||
|
|
<if test="powerPriceTotal != null">
|
||
|
|
power_price_total,
|
||
|
|
</if>
|
||
|
|
<if test="servicePriceTotal != null">
|
||
|
|
service_price_total,
|
||
|
|
</if>
|
||
|
|
<if test="promotionDiscount != null">
|
||
|
|
promotion_discount,
|
||
|
|
</if>
|
||
|
|
<if test="historyActPrice != null">
|
||
|
|
history_act_price,
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
create_time,
|
||
|
|
</if>
|
||
|
|
<if test="chargingMode != null">
|
||
|
|
charging_mode,
|
||
|
|
</if>
|
||
|
|
<if test="chargingStationId != null">
|
||
|
|
charging_station_id,
|
||
|
|
</if>
|
||
|
|
<if test="terminalId != null">
|
||
|
|
terminal_id,
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null">
|
||
|
|
del_flag,
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="invoiceId != null">
|
||
|
|
#{invoiceId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="historyOrderId != null">
|
||
|
|
#{historyOrderId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="historyUserId != null">
|
||
|
|
#{historyUserId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="historyUserType != null">
|
||
|
|
#{historyUserType,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="hisotrySerialNumber != null">
|
||
|
|
#{hisotrySerialNumber,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="powerPriceTotal != null">
|
||
|
|
#{powerPriceTotal,jdbcType=DECIMAL},
|
||
|
|
</if>
|
||
|
|
<if test="servicePriceTotal != null">
|
||
|
|
#{servicePriceTotal,jdbcType=DECIMAL},
|
||
|
|
</if>
|
||
|
|
<if test="promotionDiscount != null">
|
||
|
|
#{promotionDiscount,jdbcType=DECIMAL},
|
||
|
|
</if>
|
||
|
|
<if test="historyActPrice != null">
|
||
|
|
#{historyActPrice,jdbcType=DECIMAL},
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
#{createTime,jdbcType=TIMESTAMP},
|
||
|
|
</if>
|
||
|
|
<if test="chargingMode != null">
|
||
|
|
#{chargingMode,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="chargingStationId != null">
|
||
|
|
#{chargingStationId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="terminalId != null">
|
||
|
|
#{terminalId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null">
|
||
|
|
#{delFlag,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<select id="findOrdersByInvoiceId" resultMap="BaseResultMap">
|
||
|
|
SELECT *
|
||
|
|
FROM `xhpc_invoice_map_history_order`
|
||
|
|
WHERE invoice_id = #{invoiceId}
|
||
|
|
AND del_flag IS NULL;
|
||
|
|
</select>
|
||
|
|
<select id="getHistoryOrderScopeByInvoiceId" resultType="java.lang.String">
|
||
|
|
SELECT MIN(create_time)
|
||
|
|
FROM `xhpc_invoice_map_history_order`
|
||
|
|
WHERE invoice_id = #{invoiceId}
|
||
|
|
AND del_flag IS NULL
|
||
|
|
UNION
|
||
|
|
SELECT Max(create_time)
|
||
|
|
FROM `xhpc_invoice_map_history_order`
|
||
|
|
WHERE invoice_id = #{invoiceId}
|
||
|
|
AND del_flag IS NULL
|
||
|
|
</select>
|
||
|
|
</mapper>
|