package cn.com.ty.lift.ud.userOrders.mapper;

import cn.com.ty.lift.ud.userOrders.mapper.entity.UserOrders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 订单 -Repository
 * 
 * @author Xson
 * @date 2020-05-23
 */
public interface UserOrdersMapper extends BaseMapper<UserOrders> {

    /**
     * 根据诊单id修改订单状态
     * @param lifeCaseId
     */
    @Update("update user_orders uo LEFT JOIN lift_case lc on lc.id = uo.data_id\n" +
            "LEFT JOIN expert_comment ec on lc.id = ec.life_case_id\n" +
            "set uo.order_status = 5 where ec.life_case_id  = #{lifeCaseId}")
    void updateOrderStatus(Long lifeCaseId);
    
    @Update("update user_orders set order_status=#{status} where data_id=#{id}")
    void updateOrderStatusByDataId(@Param("id")Long id,@Param("status")Integer status);
    
}
