package org.ta.pddserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.ta.pddserver.entity.CollectOrderEntity;
import org.ta.pddserver.model.api.response.CollectOrderResponse;

@Mapper
public interface CollectOrderMapper extends BaseMapper<CollectOrderEntity> {

    @Select("SELECT `uid`,`orderCode`, `itemQuantityTotal`, `segmentCode` FROM `collect_order` WHERE `orderCode` = #{orderCode};")
    CollectOrderResponse findByOrderCode(String orderCode);

    @Update("UPDATE `collect_order` SET `status` = #{status} WHERE `uid` = #{uid};")
    int updateOrderStatusById(int status, String uid);
}
