66 lines
2.2 KiB
Java
66 lines
2.2 KiB
Java
package com.sky.mapper;
|
|
|
|
import com.github.pagehelper.Page;
|
|
import com.sky.dto.OrdersPageQueryDTO;
|
|
import com.sky.entity.Orders;
|
|
import org.apache.ibatis.annotations.*;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
@Mapper
|
|
public interface OrderMapper {
|
|
|
|
@Insert("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})")
|
|
@Options(useGeneratedKeys = true,keyProperty = "id")
|
|
void insert(Orders orders);
|
|
|
|
//处理支付pem问题
|
|
@Update("update orders set status = #{orderStatus},pay_status = #{orderPaidStatus},checkout_time = #{checkOutTime} where id = #{id}")
|
|
void updateStatus(Integer orderStatus, Integer orderPaidStatus, LocalDateTime checkOutTime, Long id);
|
|
|
|
@Select("select * from orders where number = #{number}")
|
|
Orders getByNumber(String number);
|
|
|
|
void update(Orders orders);
|
|
|
|
/**
|
|
* 分页条件查询并按下单时间排序
|
|
* @param ordersPageQueryDTO
|
|
*/
|
|
Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);
|
|
|
|
/**
|
|
* 根据id查询订单
|
|
* @param id
|
|
*/
|
|
@Select("select * from orders where id=#{id}")
|
|
Orders getById(Long id);
|
|
|
|
/**
|
|
* 根据状态统计订单数量
|
|
* @param status
|
|
*/
|
|
@Select("select count(id) from orders where status = #{status}")
|
|
Integer countStatus(Integer status);
|
|
|
|
/**
|
|
* 根据支付状态和时间获取订单的查询操作
|
|
* @param status
|
|
* @param time
|
|
* @return
|
|
*/
|
|
@Select("select * from orders where status = #{status} and order_time < #{time}")
|
|
List<Orders> getByStatusAndOrderTime(Integer status, LocalDateTime time);
|
|
|
|
Double sumByMap(Map map);
|
|
|
|
Integer countByMap(Map map);
|
|
}
|