You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
homework/sky/sky-server/target/classes/mapper/OrderMapper.xml

109 lines
4.0 KiB

<?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" 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>
<update id="updateBatchStatus" parameterType="com.sky.entity.Orders">
update orders set status=#{status} where id in
<foreach collection="ordersList" separator="," close=")" open="(" item="order">
#{order.id}
</foreach>
</update>
<select id="pageQuery" resultType="com.sky.entity.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 &gt;= #{beginTime}
</if>
<if test="endTime != null">
and order_time &lt;= #{endTime}
</if>
</where>
order by order_time desc
</select>
<select id="getByStatusAndOrderTimeLT" resultType="com.sky.entity.Orders">
select * from orders
<where>
<if test="time!=null">
order_time <![CDATA[ < ]]> #{time}
</if>
<if test="pendingPayment!=null">
and status = #{pendingPayment}
</if>
</where>
</select>
<select id="countByMap" resultType="java.lang.Integer" parameterType="java.util.Map">
select count(*) from orders where order_time <![CDATA[
<
]]> #{map.end} and order_time <![CDATA[
>
]]> #{map.begin}
<if test="map.status!=null">
and status=#{map.status}
</if>
</select>
<select id="sumByMap" resultType="java.lang.Double" parameterType="java.util.Map">
select sum(amount) from orders where order_time <![CDATA[
<
]]> #{map.end} and order_time <![CDATA[
>
]]> #{map.begin}
</select>
</mapper>