package com.sw.mes.yb.production.dao;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.sw.mes.core.base.BaseDao;
import com.sw.mes.yb.production.entity.EquipmentExtendState;

/**
* @Author
* @Description：
* @Date:
* @Modified By:
*/
public interface EquipmentExtendStateDao extends BaseDao<EquipmentExtendState, Long>{

	EquipmentExtendState getByEquipmentCode(String equimentCode);

	List<EquipmentExtendState> findBySeries(String series);

	@Modifying
	@Query(value = "update production_equipment_extend_state set user_name=?1 , login_time=?2 , token=?3 , team_group=?4 , class_no=?5 , login_state=true where series=?6",nativeQuery = true)
	void updateLoginInfo(String loginName,Date loginDate, String token,String teamGroup, String classNo,String series);


	@Modifying
	@Query(value = "update production_equipment_extend_state set user_name=null , login_time=null,token=null,login_state=false,team_group=null, class_no=null where series=?2",nativeQuery = true)
	void updateLogoutInfo(String equipmentCode, String series);

}
