package com.cyksj.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cyksj.model.entity.ChatgptUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author chan
 * @date 2024/3/19 10:44
 */
public interface ChatgptUserMapper extends BaseMapper<ChatgptUser> {

	@Update("update chatgpt_user cu set limit_num = #{gptLimitNum}, limit_time = #{gptLimitTime} where exists(select 1 from (select id from groups_trips where sku_id = #{skuId}) gt inner join groups_relation gr on gr.groups_id = gt.id where gr.id = cu.relationId)")
	void updateChatGptCarUserNumAndLimitTime(@Param("skuId") Long skuId, @Param("gptLimitNum") Integer gptLimitNum, @Param("gptLimitTime") Long gptLimitTime);
}
