package com.yihu.jw.base.dao.menu;

import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuShowDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

public interface BaseMenuShowDao  extends PagingAndSortingRepository<BaseMenuShowDO, String>, JpaSpecificationExecutor<BaseMenuShowDO> {
    @Modifying
    @Query("update BaseMenuShowDO p set p.isDel=?2 where p.id=?1")
    BaseMenuShowDO updateStatus(String id,String status);
    @Query( value = "select max(t.menu_sort) AS \"zuida\" from base_menu_show t where t.is_del='1' and t.model_id=?1",nativeQuery = true)
    Integer getMaxSort(String modelId);
    @Query( value = "select min(t.menu_sort) AS \"zuixiao\" from base_menu_show t where t.is_del='1' and t.model_id=?1",nativeQuery = true)
    Integer getMinSort(String modelId);
}
