占桩订单逻辑

This commit is contained in:
2023-08-14 16:44:39 +08:00
parent e4b04c4462
commit d537e1d995
7 changed files with 255 additions and 27 deletions

View File

@@ -8,11 +8,13 @@
<result column="occupy_code" jdbcType="VARCHAR" property="occupyCode" />
<result column="status" jdbcType="CHAR" property="status" />
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
<result column="station_id" jdbcType="VARCHAR" property="stationId" />
<result column="order_code" jdbcType="VARCHAR" property="orderCode" />
<result column="transaction_code" jdbcType="VARCHAR" property="transactionCode" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="pay_status" jdbcType="VARCHAR" property="payStatus" />
<result column="order_amount" jdbcType="DECIMAL" property="orderAmount" />
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn" />
<result column="connector_code" jdbcType="VARCHAR" property="connectorCode" />
<result column="pile_connector_code" jdbcType="VARCHAR" property="pileConnectorCode" />
@@ -24,9 +26,9 @@
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, occupy_code, `status`, member_id, order_code, transaction_code, start_time, end_time,
pay_status, pile_sn, connector_code, pile_connector_code, create_time, create_by,
update_time, update_by, del_flag
id, occupy_code, `status`, member_id, station_id, order_code, transaction_code, start_time,
end_time, pay_status, order_amount, pile_sn, connector_code, pile_connector_code,
create_time, create_by, update_time, update_by, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
@@ -43,17 +45,19 @@
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderPileOccupy" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into order_pile_occupy (occupy_code, `status`, member_id,
order_code, transaction_code, start_time,
end_time, pay_status, pile_sn,
connector_code, pile_connector_code, create_time,
create_by, update_time, update_by,
del_flag)
station_id, order_code, transaction_code,
start_time, end_time, pay_status,
order_amount, pile_sn, connector_code,
pile_connector_code, create_time, create_by,
update_time, update_by, del_flag
)
values (#{occupyCode,jdbcType=VARCHAR}, #{status,jdbcType=CHAR}, #{memberId,jdbcType=VARCHAR},
#{orderCode,jdbcType=VARCHAR}, #{transactionCode,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{payStatus,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR},
#{connectorCode,jdbcType=VARCHAR}, #{pileConnectorCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{delFlag,jdbcType=CHAR})
#{stationId,jdbcType=VARCHAR}, #{orderCode,jdbcType=VARCHAR}, #{transactionCode,jdbcType=VARCHAR},
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{payStatus,jdbcType=VARCHAR},
#{orderAmount,jdbcType=DECIMAL}, #{pileSn,jdbcType=VARCHAR}, #{connectorCode,jdbcType=VARCHAR},
#{pileConnectorCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderPileOccupy" useGeneratedKeys="true">
<!--@mbg.generated-->
@@ -68,6 +72,9 @@
<if test="memberId != null">
member_id,
</if>
<if test="stationId != null">
station_id,
</if>
<if test="orderCode != null">
order_code,
</if>
@@ -83,6 +90,9 @@
<if test="payStatus != null">
pay_status,
</if>
<if test="orderAmount != null">
order_amount,
</if>
<if test="pileSn != null">
pile_sn,
</if>
@@ -118,6 +128,9 @@
<if test="memberId != null">
#{memberId,jdbcType=VARCHAR},
</if>
<if test="stationId != null">
#{stationId,jdbcType=VARCHAR},
</if>
<if test="orderCode != null">
#{orderCode,jdbcType=VARCHAR},
</if>
@@ -133,6 +146,9 @@
<if test="payStatus != null">
#{payStatus,jdbcType=VARCHAR},
</if>
<if test="orderAmount != null">
#{orderAmount,jdbcType=DECIMAL},
</if>
<if test="pileSn != null">
#{pileSn,jdbcType=VARCHAR},
</if>
@@ -172,6 +188,9 @@
<if test="memberId != null">
member_id = #{memberId,jdbcType=VARCHAR},
</if>
<if test="stationId != null">
station_id = #{stationId,jdbcType=VARCHAR},
</if>
<if test="orderCode != null">
order_code = #{orderCode,jdbcType=VARCHAR},
</if>
@@ -187,6 +206,9 @@
<if test="payStatus != null">
pay_status = #{payStatus,jdbcType=VARCHAR},
</if>
<if test="orderAmount != null">
order_amount = #{orderAmount,jdbcType=DECIMAL},
</if>
<if test="pileSn != null">
pile_sn = #{pileSn,jdbcType=VARCHAR},
</if>
@@ -220,11 +242,13 @@
set occupy_code = #{occupyCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=CHAR},
member_id = #{memberId,jdbcType=VARCHAR},
station_id = #{stationId,jdbcType=VARCHAR},
order_code = #{orderCode,jdbcType=VARCHAR},
transaction_code = #{transactionCode,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
pay_status = #{payStatus,jdbcType=VARCHAR},
order_amount = #{orderAmount,jdbcType=DECIMAL},
pile_sn = #{pileSn,jdbcType=VARCHAR},
connector_code = #{connectorCode,jdbcType=VARCHAR},
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
@@ -254,6 +278,11 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="station_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.stationId,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="order_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.orderCode,jdbcType=VARCHAR}
@@ -279,6 +308,11 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.payStatus,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="order_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.orderAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="pile_sn = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.pileSn,jdbcType=VARCHAR}
@@ -350,6 +384,13 @@
</if>
</foreach>
</trim>
<trim prefix="station_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.stationId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.stationId,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="order_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.orderCode != null">
@@ -385,6 +426,13 @@
</if>
</foreach>
</trim>
<trim prefix="order_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.orderAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.orderAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="pile_sn = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.pileSn != null">
@@ -450,17 +498,18 @@
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into order_pile_occupy
(occupy_code, `status`, member_id, order_code, transaction_code, start_time, end_time,
pay_status, pile_sn, connector_code, pile_connector_code, create_time, create_by,
update_time, update_by, del_flag)
(occupy_code, `status`, member_id, station_id, order_code, transaction_code, start_time,
end_time, pay_status, order_amount, pile_sn, connector_code, pile_connector_code,
create_time, create_by, update_time, update_by, del_flag)
values
<foreach collection="list" item="item" separator=",">
(#{item.occupyCode,jdbcType=VARCHAR}, #{item.status,jdbcType=CHAR}, #{item.memberId,jdbcType=VARCHAR},
#{item.orderCode,jdbcType=VARCHAR}, #{item.transactionCode,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIMESTAMP},
#{item.endTime,jdbcType=TIMESTAMP}, #{item.payStatus,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR},
#{item.connectorCode,jdbcType=VARCHAR}, #{item.pileConnectorCode,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.createBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
#{item.updateBy,jdbcType=VARCHAR}, #{item.delFlag,jdbcType=CHAR})
#{item.stationId,jdbcType=VARCHAR}, #{item.orderCode,jdbcType=VARCHAR}, #{item.transactionCode,jdbcType=VARCHAR},
#{item.startTime,jdbcType=TIMESTAMP}, #{item.endTime,jdbcType=TIMESTAMP}, #{item.payStatus,jdbcType=VARCHAR},
#{item.orderAmount,jdbcType=DECIMAL}, #{item.pileSn,jdbcType=VARCHAR}, #{item.connectorCode,jdbcType=VARCHAR},
#{item.pileConnectorCode,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
#{item.createBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR},
#{item.delFlag,jdbcType=CHAR})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderPileOccupy" useGeneratedKeys="true">
@@ -473,15 +522,19 @@
occupy_code,
`status`,
member_id,
station_id,
order_code,
transaction_code,
start_time,
end_time,
pay_status,
order_amount,
pile_sn,
connector_code,
pile_connector_code,
create_time,
create_by,
update_time,
update_by,
del_flag,
</trim>
@@ -493,15 +546,19 @@
#{occupyCode,jdbcType=VARCHAR},
#{status,jdbcType=CHAR},
#{memberId,jdbcType=VARCHAR},
#{stationId,jdbcType=VARCHAR},
#{orderCode,jdbcType=VARCHAR},
#{transactionCode,jdbcType=VARCHAR},
#{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP},
#{payStatus,jdbcType=VARCHAR},
#{orderAmount,jdbcType=DECIMAL},
#{pileSn,jdbcType=VARCHAR},
#{connectorCode,jdbcType=VARCHAR},
#{pileConnectorCode,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=VARCHAR},
#{delFlag,jdbcType=CHAR},
</trim>
@@ -513,15 +570,19 @@
occupy_code = #{occupyCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=CHAR},
member_id = #{memberId,jdbcType=VARCHAR},
station_id = #{stationId,jdbcType=VARCHAR},
order_code = #{orderCode,jdbcType=VARCHAR},
transaction_code = #{transactionCode,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
pay_status = #{payStatus,jdbcType=VARCHAR},
order_amount = #{orderAmount,jdbcType=DECIMAL},
pile_sn = #{pileSn,jdbcType=VARCHAR},
connector_code = #{connectorCode,jdbcType=VARCHAR},
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
del_flag = #{delFlag,jdbcType=CHAR},
</trim>
@@ -542,6 +603,9 @@
<if test="memberId != null">
member_id,
</if>
<if test="stationId != null">
station_id,
</if>
<if test="orderCode != null">
order_code,
</if>
@@ -557,6 +621,9 @@
<if test="payStatus != null">
pay_status,
</if>
<if test="orderAmount != null">
order_amount,
</if>
<if test="pileSn != null">
pile_sn,
</if>
@@ -596,6 +663,9 @@
<if test="memberId != null">
#{memberId,jdbcType=VARCHAR},
</if>
<if test="stationId != null">
#{stationId,jdbcType=VARCHAR},
</if>
<if test="orderCode != null">
#{orderCode,jdbcType=VARCHAR},
</if>
@@ -611,6 +681,9 @@
<if test="payStatus != null">
#{payStatus,jdbcType=VARCHAR},
</if>
<if test="orderAmount != null">
#{orderAmount,jdbcType=DECIMAL},
</if>
<if test="pileSn != null">
#{pileSn,jdbcType=VARCHAR},
</if>
@@ -650,6 +723,9 @@
<if test="memberId != null">
member_id = #{memberId,jdbcType=VARCHAR},
</if>
<if test="stationId != null">
station_id = #{stationId,jdbcType=VARCHAR},
</if>
<if test="orderCode != null">
order_code = #{orderCode,jdbcType=VARCHAR},
</if>
@@ -665,6 +741,9 @@
<if test="payStatus != null">
pay_status = #{payStatus,jdbcType=VARCHAR},
</if>
<if test="orderAmount != null">
order_amount = #{orderAmount,jdbcType=DECIMAL},
</if>
<if test="pileSn != null">
pile_sn = #{pileSn,jdbcType=VARCHAR},
</if>
@@ -715,4 +794,15 @@
and pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
</if>
</select>
<select id="queryOccupiedOrder" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from order_pile_occupy
where del_flag = '0'
and status = '0'
and pay_status = '0'
and pile_sn = #{pileSn,jdbcType=VARCHAR}
and connector_code = #{connectorCode,jdbcType=VARCHAR}
</select>
</mapper>