package com.winsun.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.bean.OrderView;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.sql.Timestamp;
import java.util.List;
import java.util.Map;

/**
 * @Author: chancy
 * @Date: 2020/2/18 17:04
 */
@Mapper
@Component
public interface OrderViewMapper extends BaseMapper<OrderView> {

    @Select("<script>SELECT * FROM `order_view` <where> ${ew.sqlSegment} </where> </script>")
    List<Map<String, Object>> downloadOrderView(@Param("ew") Wrapper<OrderView> wrapper);

    /**
     * 智能平台推送接收
     * @return
     */
    @Update("<script>UPDATE `hhr_order` set th_status = #{status},order_status = #{orderStatus} <where> ${ew.sqlSegment} </where> </script>")
    Integer IntelligentPlatformPush(@Param("ew") Wrapper<Object> wrapper,@Param("status")String status,@Param("orderStatus")String orderStatus);

    @Select("<script>SELECT id FROM `hhr_order` <where> ${ew.sqlSegment} </where> </script>")
    String selectOrderId(@Param("ew") Wrapper<Object> wrapper);

    @Insert("insert into`hhr_order_history`(order_id, status, create_date) values(#{id}, #{status}, #{createTime})")
    int insertOrderHistory(@Param("id")String id,@Param("status")String status,@Param("createTime") Timestamp createTime);
}
