package com.winsun.mapper;

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

import java.util.List;
import java.util.Map;

@Mapper
@Component
public interface SalesListMapper extends BaseMapper<SalesList> {
	
	@Select(" select * from hhr_phone_school ")
	List<Map<String, Object>> getPhoneSchool();
	
    @Insert(" replace into hhr_phone_school(order_phone,school) VALUES(#{orderPhone},#{school})")
    int updatePhoneSchool(@Param("orderPhone") String orderPhone,@Param("school") String school);
    
    @Update(" update hhr_sales_order set status = #{status}, remark = #{remark} where order_phone = #{orderPhone} and del_flag = 0"
    		+ " and order_type = 1 and send_bonus = 0 ")
    int updateRepealOrder(@Param("status") String status,@Param("remark") String remark,@Param("orderPhone") String orderPhone);
    
    @Select(" select * from hhr_phone_school where order_phone = #{orderPhone} ")
    List<Map<String, Object>> getPhoneSchoolByPhone(@Param("orderPhone") String orderPhone);
    
    @Delete("delete from hhr_phone_school where order_phone = #{orderPhone} ")
    int deletePhoneSchool(@Param("orderPhone") String orderPhone);

}
