70 lines
2.7 KiB
XML
70 lines
2.7 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.sky.mapper.OrderMapper">
|
|
|
|
<insert id="insert" parameterType="Orders" useGeneratedKeys="true" keyProperty="id">
|
|
insert into orders
|
|
(number, status, user_id, address_book_id, order_time, checkout_time, pay_method, pay_status, amount, remark,
|
|
phone, address, consignee, estimated_delivery_time, delivery_status, pack_amount, tableware_number,
|
|
tableware_status)
|
|
values (#{number}, #{status}, #{userId}, #{addressBookId}, #{orderTime}, #{checkoutTime}, #{payMethod},
|
|
#{payStatus}, #{amount}, #{remark}, #{phone}, #{address}, #{consignee},
|
|
#{estimatedDeliveryTime}, #{deliveryStatus}, #{packAmount}, #{tablewareNumber}, #{tablewareStatus})
|
|
</insert>
|
|
|
|
<update id="update" parameterType="com.sky.entity.Orders">
|
|
update orders
|
|
<set>
|
|
<if test="cancelReason != null and cancelReason!='' ">
|
|
cancel_reason=#{cancelReason},
|
|
</if>
|
|
<if test="rejectionReason != null and rejectionReason!='' ">
|
|
rejection_reason=#{rejectionReason},
|
|
</if>
|
|
<if test="cancelTime != null">
|
|
cancel_time=#{cancelTime},
|
|
</if>
|
|
<if test="payStatus != null">
|
|
pay_status=#{payStatus},
|
|
</if>
|
|
<if test="payMethod != null">
|
|
pay_method=#{payMethod},
|
|
</if>
|
|
<if test="checkoutTime != null">
|
|
checkout_time=#{checkoutTime},
|
|
</if>
|
|
<if test="status != null">
|
|
status = #{status},
|
|
</if>
|
|
<if test="deliveryTime != null">
|
|
delivery_time = #{deliveryTime}
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
<select id="pageQuery" resultType="Orders">
|
|
select * from orders
|
|
<where>
|
|
<if test="number != null and number!=''">
|
|
and number like concat('%',#{number},'%')
|
|
</if>
|
|
<if test="phone != null and phone!=''">
|
|
and phone like concat('%',#{phone},'%')
|
|
</if>
|
|
<if test="userId != null">
|
|
and user_id = #{userId}
|
|
</if>
|
|
<if test="status != null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="beginTime != null">
|
|
and order_time >= #{beginTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and order_time <= #{endTime}
|
|
</if>
|
|
</where>
|
|
order by order_time desc
|
|
</select>
|
|
</mapper>
|